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
1=== modified file 'devportalbinary/binary.py'
2--- devportalbinary/binary.py 2012-07-16 16:14:46 +0000
3+++ devportalbinary/binary.py 2012-07-17 09:24:18 +0000
4@@ -161,7 +161,7 @@
5
6 def get_packages_for_libraries(library_names, arch):
7 conf = load_configuration()
8- lib_overrides = conf.options.lib_overrides_overrides
9+ lib_overrides = conf.options.libraries_overrides
10 db = PackageDatabase.create()
11 deps = set()
12 for lib in library_names:
13
14=== modified file 'devportalbinary/configuration.py'
15--- devportalbinary/configuration.py 2012-07-16 16:14:46 +0000
16+++ devportalbinary/configuration.py 2012-07-17 09:24:18 +0000
17@@ -1,24 +1,14 @@
18 import os
19
20-try:
21- from configglue import glue
22-except ImportError:
23- from configglue.pyschema import glue
24+from configglue import glue
25+from configglue import parser
26
27-try:
28- from configglue.schema import (
29- Schema,
30- Section,
31- DictOption,
32- StringOption,
33+from configglue.schema import (
34+ Schema,
35+ Section,
36+ DictOption,
37+ StringOption,
38 )
39-except ImportError:
40- from configglue.pyschema.schema import (
41- Schema,
42- ConfigSection as Section,
43- DictConfigOption as DictOption,
44- StringConfigOption as StringOption,
45- )
46
47
48 # XXX: 'pkgme-binary' is the historic name of this package. Change this
49@@ -51,12 +41,12 @@
50 help='To scan binary or source packages.')
51
52 # overrides
53- lib_overrides = Section()
54- overrides = { 'libasound.so.2': 'libasound2',
55- 'libgl.so.1': 'libgl1-mesa-glx',
56- }
57- lib_overrides.overrides = DictOption(
58- default=overrides,
59+ libraries = Section()
60+ default_lib_overrides = { 'libasound.so.2': 'libasound2',
61+ 'libGL.so.1': 'libgl1-mesa-glx',
62+ }
63+ libraries.overrides = DictOption(
64+ default=default_lib_overrides,
65 help='mapping of library name to pkgname to force picking selected '
66 'dependencies')
67
68@@ -66,4 +56,6 @@
69 config_files = []
70 if os.path.exists(config_location):
71 config_files.append(config_location)
72+ # tell the SchemaConfigParser that we need our data case-sensitive
73+ parser.SchemaConfigParser.optionxform = str
74 return glue.configglue(DevportalSchema, config_files)
75
76=== modified file 'devportalbinary/testing.py'
77--- devportalbinary/testing.py 2012-07-16 18:49:48 +0000
78+++ devportalbinary/testing.py 2012-07-17 09:24:18 +0000
79@@ -117,17 +117,23 @@
80
81 # for the test, needs to be in sync with the config file below
82 TEST_LIBS = { 'libasound.so.2' : 'libasound2',
83- 'libgl.so.1' : 'libgl1-mesa-glx',
84+ 'libGL.so.1' : 'libgl1-mesa-glx',
85+ 'libfoo.so.2' : 'libfoo',
86 }
87
88 def setUp(self):
89 super(ConfigFileFixture, self).setUp()
90 os.makedirs(os.path.dirname(os.path.expanduser(CONF_FILE)))
91+ # the syntax for dicts in configglue is slightly arcane,
92 with open(os.path.expanduser(CONF_FILE), 'w') as f:
93 f.write("""
94-[lib_overrides]
95+[libraries]
96+overrides = library_overrides
97+
98+[library_overrides]
99 libasound.so.2 = libasound2
100-libgl1.so.1 = libglx-mesa-dri
101+libGL.so.1 = libgl1-mesa-glx
102+libfoo.so.2 = libfoo
103 """)
104
105
106
107=== modified file 'devportalbinary/tests/test_binary.py'
108--- devportalbinary/tests/test_binary.py 2012-07-16 17:39:13 +0000
109+++ devportalbinary/tests/test_binary.py 2012-07-17 09:24:18 +0000
110@@ -305,7 +305,7 @@
111 self.useFixture(ConfigFileFixture())
112 conf = load_configuration()
113 self.assertEqual(
114- conf.options.lib_overrides_overrides, ConfigFileFixture.TEST_LIBS)
115+ conf.options.libraries_overrides, ConfigFileFixture.TEST_LIBS)
116
117 def test_get_lib_overrides_for_packages_for_libraries(self):
118 """Test that the configuration file overrides the found

Subscribers

People subscribed via source and target branches