Merge lp:~mvo/pkgme-devportal/lib-overrides-fixes into lp:pkgme-devportal

Proposed by Michael Vogt
Status: Merged
Approved by: Jonathan Lange
Approved revision: 59
Merged at revision: 55
Proposed branch: lp:~mvo/pkgme-devportal/lib-overrides-fixes
Merge into: lp:pkgme-devportal
Diff against target: 118 lines (+26/-28)
4 files modified
devportalbinary/binary.py (+1/-1)
devportalbinary/configuration.py (+15/-23)
devportalbinary/testing.py (+9/-3)
devportalbinary/tests/test_binary.py (+1/-1)
To merge this branch: bzr merge lp:~mvo/pkgme-devportal/lib-overrides-fixes
Reviewer Review Type Date Requested Status
Jonathan Lange Approve
Review via email: mp+115290@code.launchpad.net

Commit message

Make the lib overrides work by making configglue case-sensitive and fixing the default for libgl1-mesa-glx (mvo)

Description of the change

This branch fixes some issues in my previous lib-overrides work:
- its "libGL.so.1" not "libgl.so.1" (case matters)
- the configglue code by default is not case-sensitive so that needs to be tweaks
- the example config is fixed to actually work
- the test is improved to really test the config values instead of the default values

Amazing how much issues such a small branch can have :/

To post a comment you must log in.
58. By Michael Vogt

adjust the naming to make the config file more readable

Revision history for this message
Jonathan Lange (jml) wrote :

Looks good. Thanks.

Please remove the XXX comment about lucid before landing.
 a) we don't deploy to lucid any more, or support it either
 b) tarmac will catch it anyway

Revision history for this message
Jonathan Lange (jml) :
review: Approve
59. By Michael Vogt

devportalbinary/configuration.py: remove configglue.pyschema fallbacks as they should be no longer needed (thanks to jml for this!)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'devportalbinary/binary.py'
--- devportalbinary/binary.py 2012-07-16 16:14:46 +0000
+++ devportalbinary/binary.py 2012-07-17 09:24:18 +0000
@@ -161,7 +161,7 @@
161161
162def get_packages_for_libraries(library_names, arch):162def get_packages_for_libraries(library_names, arch):
163 conf = load_configuration()163 conf = load_configuration()
164 lib_overrides = conf.options.lib_overrides_overrides164 lib_overrides = conf.options.libraries_overrides
165 db = PackageDatabase.create()165 db = PackageDatabase.create()
166 deps = set()166 deps = set()
167 for lib in library_names:167 for lib in library_names:
168168
=== modified file 'devportalbinary/configuration.py'
--- devportalbinary/configuration.py 2012-07-16 16:14:46 +0000
+++ devportalbinary/configuration.py 2012-07-17 09:24:18 +0000
@@ -1,24 +1,14 @@
1import os1import os
22
3try:3from configglue import glue
4 from configglue import glue4from configglue import parser
5except ImportError:
6 from configglue.pyschema import glue
75
8try:6from configglue.schema import (
9 from configglue.schema import (7 Schema,
10 Schema,8 Section,
11 Section,9 DictOption,
12 DictOption,10 StringOption,
13 StringOption,
14 )11 )
15except ImportError:
16 from configglue.pyschema.schema import (
17 Schema,
18 ConfigSection as Section,
19 DictConfigOption as DictOption,
20 StringConfigOption as StringOption,
21 )
2212
2313
24# XXX: 'pkgme-binary' is the historic name of this package. Change this14# XXX: 'pkgme-binary' is the historic name of this package. Change this
@@ -51,12 +41,12 @@
51 help='To scan binary or source packages.')41 help='To scan binary or source packages.')
5242
53 # overrides43 # overrides
54 lib_overrides = Section()44 libraries = Section()
55 overrides = { 'libasound.so.2': 'libasound2',45 default_lib_overrides = { 'libasound.so.2': 'libasound2',
56 'libgl.so.1': 'libgl1-mesa-glx',46 'libGL.so.1': 'libgl1-mesa-glx',
57 }47 }
58 lib_overrides.overrides = DictOption(48 libraries.overrides = DictOption(
59 default=overrides,49 default=default_lib_overrides,
60 help='mapping of library name to pkgname to force picking selected '50 help='mapping of library name to pkgname to force picking selected '
61 'dependencies')51 'dependencies')
6252
@@ -66,4 +56,6 @@
66 config_files = []56 config_files = []
67 if os.path.exists(config_location):57 if os.path.exists(config_location):
68 config_files.append(config_location)58 config_files.append(config_location)
59 # tell the SchemaConfigParser that we need our data case-sensitive
60 parser.SchemaConfigParser.optionxform = str
69 return glue.configglue(DevportalSchema, config_files)61 return glue.configglue(DevportalSchema, config_files)
7062
=== modified file 'devportalbinary/testing.py'
--- devportalbinary/testing.py 2012-07-16 18:49:48 +0000
+++ devportalbinary/testing.py 2012-07-17 09:24:18 +0000
@@ -117,17 +117,23 @@
117 117
118 # for the test, needs to be in sync with the config file below118 # for the test, needs to be in sync with the config file below
119 TEST_LIBS = { 'libasound.so.2' : 'libasound2',119 TEST_LIBS = { 'libasound.so.2' : 'libasound2',
120 'libgl.so.1' : 'libgl1-mesa-glx',120 'libGL.so.1' : 'libgl1-mesa-glx',
121 'libfoo.so.2' : 'libfoo',
121 }122 }
122123
123 def setUp(self):124 def setUp(self):
124 super(ConfigFileFixture, self).setUp()125 super(ConfigFileFixture, self).setUp()
125 os.makedirs(os.path.dirname(os.path.expanduser(CONF_FILE)))126 os.makedirs(os.path.dirname(os.path.expanduser(CONF_FILE)))
127 # the syntax for dicts in configglue is slightly arcane,
126 with open(os.path.expanduser(CONF_FILE), 'w') as f:128 with open(os.path.expanduser(CONF_FILE), 'w') as f:
127 f.write("""129 f.write("""
128[lib_overrides]130[libraries]
131overrides = library_overrides
132
133[library_overrides]
129libasound.so.2 = libasound2134libasound.so.2 = libasound2
130libgl1.so.1 = libglx-mesa-dri135libGL.so.1 = libgl1-mesa-glx
136libfoo.so.2 = libfoo
131""")137""")
132138
133139
134140
=== modified file 'devportalbinary/tests/test_binary.py'
--- devportalbinary/tests/test_binary.py 2012-07-16 17:39:13 +0000
+++ devportalbinary/tests/test_binary.py 2012-07-17 09:24:18 +0000
@@ -305,7 +305,7 @@
305 self.useFixture(ConfigFileFixture())305 self.useFixture(ConfigFileFixture())
306 conf = load_configuration()306 conf = load_configuration()
307 self.assertEqual(307 self.assertEqual(
308 conf.options.lib_overrides_overrides, ConfigFileFixture.TEST_LIBS)308 conf.options.libraries_overrides, ConfigFileFixture.TEST_LIBS)
309309
310 def test_get_lib_overrides_for_packages_for_libraries(self):310 def test_get_lib_overrides_for_packages_for_libraries(self):
311 """Test that the configuration file overrides the found311 """Test that the configuration file overrides the found

Subscribers

People subscribed via source and target branches