Merge lp:~mvo/pkgme-devportal/i386-only-for-now into lp:pkgme-devportal

Proposed by Michael Vogt
Status: Merged
Approved by: James Westby
Approved revision: 62
Merged at revision: 62
Proposed branch: lp:~mvo/pkgme-devportal/i386-only-for-now
Merge into: lp:pkgme-devportal
Diff against target: 125 lines (+31/-16)
4 files modified
devportalbinary/binary.py (+5/-2)
devportalbinary/configuration.py (+15/-0)
devportalbinary/database.py (+4/-14)
devportalbinary/tests/test_binary.py (+7/-0)
To merge this branch: bzr merge lp:~mvo/pkgme-devportal/i386-only-for-now
Reviewer Review Type Date Requested Status
James Westby Needs Information
Review via email: mp+115684@code.launchpad.net

Commit message

Makes supported architectures configurable, and default to i386 for now.

Description of the change

This is a branch that make the architectures configurable and defaults to "i386" for now. It does affect the database as the previous default for the architectures included "all". AFAICT this should cause any regressions as in the database it was overriden.

Reference is bug #832128.

This will eventually lead to lp:~mvo/pkgme-devportal/more-architecture-when-scanning-binaries where the architecture configuration will actually mean that the database is filled with the additional architectures.

To post a comment you must log in.
Revision history for this message
James Westby (james-w) wrote :

Hi Michael,

I'm not really sure what "supported" architectures mean here, could you help me
out?

37 + # XXX: mvo: it seems we don't need "all" here as we are interessted
38 + # in binary symbols only?

I'm not sure what that means, but it sounds like something we should have an
answer for before we land this?

53 +ARCHITECTURES = load_configuration().options.architectures_supported

Setting a module-level variable based on reading a config file is bad form,
because it will read the config file at import, which means it's hard
to write tests for example. Querying the config at use would be better.

Thanks,

James

review: Needs Information
61. By Michael Vogt

do not load ARCHITECTURES configuration on a module level but instead in each function that needs it, thanks to james_w for this suggestion

Revision history for this message
Michael Vogt (mvo) wrote :

On Thu, Jul 19, 2012 at 05:15:33PM -0000, James Westby wrote:
> Review: Needs Information
>
> Hi Michael,
Hi James,

> I'm not really sure what "supported" architectures mean here, could you help me
> out?

Just to clarify, do you mean that the string for the configuration
option in the configglue part is not clear? Or that its overall not
clear?

What I mean with "supported" for the architectures is that those are
the architectures we have symbols for in the database and expect to
generate packages for. Do you think a different name would make it
clearer? Maybe "known" or something like this?

> 37 + # XXX: mvo: it seems we don't need "all" here as we are interessted
> 38 + # in binary symbols only?
>
> I'm not sure what that means, but it sounds like something we should have an
> answer for before we land this?

Indeed, its based on the previous code that remove "all" from the list
of ARCHITECTURES for the launchpad querry. And it made me wonder if we
need "all" at all. I think not, but maybe I'm overlooking something.

> 53 +ARCHITECTURES = load_configuration().options.architectures_supported
>
> Setting a module-level variable based on reading a config file is bad form,
> because it will read the config file at import, which means it's hard
> to write tests for example. Querying the config at use would be better.

This is fixed now in my branch.

Thinking a bit more about the branch it may actually not be that
useful, I mainly did it in preparation for the
lp:~mvo/pkgme-devportal/raise-on-unsupported-architectures

But given that the database currently does not have a architecture
field afaik it may well be a bit pointless to make it configurable
before it is actually configurable. So I'm fine putting that branch on
hold for now until the rest of the code is updated to work with
multiple architectures too.

Cheers,
 Michael

Revision history for this message
James Westby (james-w) wrote :

On Fri, 20 Jul 2012 06:47:26 -0000, Michael Vogt <email address hidden> wrote:
> On Thu, Jul 19, 2012 at 05:15:33PM -0000, James Westby wrote:
> > Review: Needs Information
> >
> > Hi Michael,
> Hi James,
>
> > I'm not really sure what "supported" architectures mean here, could you help me
> > out?
>
> Just to clarify, do you mean that the string for the configuration
> option in the configglue part is not clear? Or that its overall not
> clear?

I'm not sure what it means for an architecture to be "supported".

> What I mean with "supported" for the architectures is that those are
> the architectures we have symbols for in the database and expect to
> generate packages for. Do you think a different name would make it
> clearer? Maybe "known" or something like this?

Maybe. If the info is in the database, then could it be inferred from
that?

> > 37 + # XXX: mvo: it seems we don't need "all" here as we are interessted
> > 38 + # in binary symbols only?
> >
> > I'm not sure what that means, but it sounds like something we should have an
> > answer for before we land this?
>
> Indeed, its based on the previous code that remove "all" from the list
> of ARCHITECTURES for the launchpad querry. And it made me wonder if we
> need "all" at all. I think not, but maybe I'm overlooking something.

Right, if this is the architectures we are looking in packages for
symbols for then all probably isn't needed.

> > 53 +ARCHITECTURES = load_configuration().options.architectures_supported
> >
> > Setting a module-level variable based on reading a config file is bad form,
> > because it will read the config file at import, which means it's hard
> > to write tests for example. Querying the config at use would be better.
>
> This is fixed now in my branch.

Great, thanks.

> Thinking a bit more about the branch it may actually not be that
> useful, I mainly did it in preparation for the
> lp:~mvo/pkgme-devportal/raise-on-unsupported-architectures
>
> But given that the database currently does not have a architecture
> field afaik it may well be a bit pointless to make it configurable
> before it is actually configurable. So I'm fine putting that branch on
> hold for now until the rest of the code is updated to work with
> multiple architectures too.

Ok.

If this is just about giving better error messages until we have
architectures figured then I'm fine with it, but we might as well skip
the configuration overhead and just hardcode the list in that case.

Thanks,

James

Revision history for this message
Michael Vogt (mvo) wrote :

Thanks James, I agree that in itself this is probably not useful to have this as a config option. Maybe it makes more sense in the context that this will eventually lead up to lp:~mvo/pkgme-devportal/more-architectures which should make it easy to add additional architecture via this config option.

62. By Michael Vogt

merged trunk and resolved conflicts

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-24 14:16:18 +0000
+++ devportalbinary/binary.py 2012-07-24 14:43:20 +0000
@@ -283,8 +283,11 @@
283 DEPENDS = '${shlibs:Depends}, ${misc:Depends}'283 DEPENDS = '${shlibs:Depends}, ${misc:Depends}'
284284
285 def get_architecture(self, metadata):285 def get_architecture(self, metadata):
286 # XXX: No idea about architecture286 # XXX: once we scan more than one architecture we need to actually
287 return None287 # pick the ones that we build for (e.g. set to "i386 amd64")
288 # But currently our database only does i386 so its ok for now
289 conf = load_configuration()
290 return "".join(conf.options.architectures_supported)
288291
289 def get_build_depends(self, metadata):292 def get_build_depends(self, metadata):
290 return ', '.join(guess_dependencies(self.path))293 return ', '.join(guess_dependencies(self.path))
291294
=== modified file 'devportalbinary/configuration.py'
--- devportalbinary/configuration.py 2012-07-17 13:26:31 +0000
+++ devportalbinary/configuration.py 2012-07-24 14:43:20 +0000
@@ -11,6 +11,7 @@
11 Section,11 Section,
12 DictOption,12 DictOption,
13 StringOption,13 StringOption,
14 TupleOption,
14 )15 )
1516
1617
@@ -57,6 +58,20 @@
57 help='mapping of library name to pkgname to force picking selected '58 help='mapping of library name to pkgname to force picking selected '
58 'dependencies')59 'dependencies')
5960
61 # The architectures that we fetch binary packages for.
62 #
63 # XXX: Really, we should be fetching the binary packages for _all_
64 # architectures and storing their symbols in the database keyed by
65 # architecture, and then using the architecture of the incoming binary to
66 # figure out which libraries we need (XXX - not sure how multiarch affects
67 # this. Instead, for the moment we are assuming that all binaries are
68 # i386.
69 architectures = Section()
70 architectures.supported = TupleOption(
71 # XXX: mvo: it seems we don't need "all" here as we are interessted
72 # in binary symbols only?
73 default=("i386",),
74 help='The supported architectures')
6075
61def get_config_file_path():76def get_config_file_path():
62 """Return the path to the configuration file."""77 """Return the path to the configuration file."""
6378
=== modified file 'devportalbinary/database.py'
--- devportalbinary/database.py 2012-07-17 13:51:11 +0000
+++ devportalbinary/database.py 2012-07-24 14:43:20 +0000
@@ -34,16 +34,6 @@
34SERVICE_ROOT = uris.LPNET_SERVICE_ROOT34SERVICE_ROOT = uris.LPNET_SERVICE_ROOT
3535
3636
37# The architectures that we fetch binary packages for.
38#
39# XXX: Really, we should be fetching the binary packages for _all_
40# architectures and storing their symbols in the database keyed by
41# architecture, and then using the architecture of the incoming binary to
42# figure out which libraries we need (XXX - not sure how multiarch affects
43# this. Instead, for the moment we are assuming that all binaries are i386.
44ARCHITECTURES = ('i386', 'all')
45
46
47class LaunchpadFixture(Fixture):37class LaunchpadFixture(Fixture):
4838
49 def __init__(self, application_name, service_root):39 def __init__(self, application_name, service_root):
@@ -78,16 +68,15 @@
7868
7969
80def iter_published_binaries(lp, since=None, name=None, exact_match=False):70def iter_published_binaries(lp, since=None, name=None, exact_match=False):
71 architectures = load_configuration().options.architectures_supported
81 ubuntu = lp.distributions['ubuntu']72 ubuntu = lp.distributions['ubuntu']
82 archive = ubuntu.main_archive73 archive = ubuntu.main_archive
83 # XXX: oneiric is a puppy that is just for christmas. Specifically, it's a74 # XXX: oneiric is a puppy that is just for christmas. Specifically, it's a
84 # bug that this is looking in oneiric, should instead be looking in75 # bug that this is looking in oneiric, should instead be looking in
85 # ... well, we don't know.76 # ... well, we don't know.
86 oneiric = ubuntu.getSeries(name_or_version='oneiric')77 oneiric = ubuntu.getSeries(name_or_version='oneiric')
87 # XXX: 'all' doesn't work?
88 ARCHITECTURES = ['i386']
89 our_series = (78 our_series = (
90 oneiric.getDistroArchSeries(archtag=tag) for tag in ARCHITECTURES)79 oneiric.getDistroArchSeries(archtag=tag) for tag in architectures)
91 filters = dict(status='Published')80 filters = dict(status='Published')
92 if since:81 if since:
93 filters['created_since_date'] = since82 filters['created_since_date'] = since
@@ -174,6 +163,7 @@
174 """163 """
175 directory = tempfile.mkdtemp()164 directory = tempfile.mkdtemp()
176 binary_file_urls = self.spph.binaryFileUrls()165 binary_file_urls = self.spph.binaryFileUrls()
166 architectures = load_configuration().options.architectures_supported
177 for url in binary_file_urls:167 for url in binary_file_urls:
178 # XXX: This is a bit of a hack to work around the fact that Launchpad168 # XXX: This is a bit of a hack to work around the fact that Launchpad
179 # has no way of filtering binary packages for a source package by169 # has no way of filtering binary packages for a source package by
@@ -185,7 +175,7 @@
185 # binary packages that export symbols and *don't* start with lib.175 # binary packages that export symbols and *don't* start with lib.
186 continue176 continue
187 architecture = filename.split('_')[-1]177 architecture = filename.split('_')[-1]
188 if architecture not in ARCHITECTURES:178 if architecture not in architectures:
189 continue179 continue
190 path = download_file(url, directory)180 path = download_file(url, directory)
191 symbols_contents = extract_symbols_file(path)181 symbols_contents = extract_symbols_file(path)
192182
=== modified file 'devportalbinary/tests/test_binary.py'
--- devportalbinary/tests/test_binary.py 2012-07-24 14:16:18 +0000
+++ devportalbinary/tests/test_binary.py 2012-07-24 14:43:20 +0000
@@ -344,6 +344,13 @@
344 get_packages_for_libraries(["libasound.so.2"], "i386"),344 get_packages_for_libraries(["libasound.so.2"], "i386"),
345 set(["libasound2"]))345 set(["libasound2"]))
346346
347 def test_architecture(self):
348 backend = self.make_backend()
349 conf = load_configuration()
350 self.assertEqual(
351 backend.get_architecture(metadata={}),
352 "".join(conf.options.architectures_supported))
353
347 def test_get_extra_targets_no_bundled_libs(self):354 def test_get_extra_targets_no_bundled_libs(self):
348 package_name = self.getUniqueString()355 package_name = self.getUniqueString()
349 path = self.getUniqueString()356 path = self.getUniqueString()

Subscribers

People subscribed via source and target branches