Merge lp:~wgrant/launchpad/bug-616154-guessPackageNames-order-fix into lp:launchpad/db-devel

Proposed by William Grant
Status: Merged
Approved by: Robert Collins
Approved revision: no longer in the source branch.
Merged at revision: 9648
Proposed branch: lp:~wgrant/launchpad/bug-616154-guessPackageNames-order-fix
Merge into: lp:launchpad/db-devel
Diff against target: 45 lines (+23/-1)
2 files modified
lib/lp/registry/model/distribution.py (+2/-1)
lib/lp/soyuz/doc/distribution.txt (+21/-0)
To merge this branch: bzr merge lp:~wgrant/launchpad/bug-616154-guessPackageNames-order-fix
Reviewer Review Type Date Requested Status
Tim Penhey (community) Approve
Robert Collins (community) release-critical Approve
Julian Edwards release-critical Pending
Review via email: mp+32285@code.launchpad.net

Commit message

Distribution.guessPackageNames once again returns the latest source name for the given binary name.

Description of the change

In the fix for bug #613686, I rewrote the queries used by Distribution.guessPackageNames. For the first query, order was unimportant, so I dropped it -- for the second, however, I failed to notice that the order was critical. As a result, 'libgcc1' now resolves to 'gcc-3.3', rather than 'gcc-4.5' where it is currently built.

This branch returns the BPPH.id DESC sort removed by my last branch, and adds a test for order.

To post a comment you must log in.
Revision history for this message
Robert Collins (lifeless) wrote :

Thanks, rc=lifeless, code change looks fine too.

review: Approve (release-critical)
Revision history for this message
Robert Collins (lifeless) wrote :

Copied Julian FHI.

Revision history for this message
Robert Collins (lifeless) wrote :

Apparently ec2 land has a bug or two :P.

review: Approve
Revision history for this message
Robert Collins (lifeless) wrote :

And so does MP's. grah.

review: Approve (release-critical)
Revision history for this message
Tim Penhey (thumper) :
review: Approve
Revision history for this message
Julian Edwards (julian-edwards) wrote :

Thanks for the fix, although I'm disappointed to see more unit testing inside
a doc test :(

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/registry/model/distribution.py'
2--- lib/lp/registry/model/distribution.py 2010-08-10 21:54:41 +0000
3+++ lib/lp/registry/model/distribution.py 2010-08-11 02:26:45 +0000
4@@ -1268,7 +1268,8 @@
5 bpph = IStore(BinaryPackagePublishingHistory).find(
6 BinaryPackagePublishingHistory,
7 BinaryPackageRelease.binarypackagename == binarypackagename,
8- *bpph_location_clauses).any()
9+ *bpph_location_clauses).order_by(
10+ Desc(BinaryPackagePublishingHistory.id)).first()
11 if bpph is not None:
12 spr = bpph.binarypackagerelease.build.source_package_release
13 return (spr.sourcepackagename, binarypackagename)
14
15=== modified file 'lib/lp/soyuz/doc/distribution.txt'
16--- lib/lp/soyuz/doc/distribution.txt 2010-02-08 11:40:06 +0000
17+++ lib/lp/soyuz/doc/distribution.txt 2010-08-11 02:26:45 +0000
18@@ -173,6 +173,27 @@
19 source: u'linux-source-2.6.15'
20 binary: u'linux-2.6.12'
21
22+If there are multiple matching binary packages, the source of the latest
23+publication is used. If we create a new 'linux' source with a 'linux-2.6.12'
24+binary, 'linux' will be returned instead of 'linux-source-2.6.15'.
25+
26+ >>> from lp.soyuz.tests.test_publishing import (
27+ ... SoyuzTestPublisher)
28+ >>> test_publisher = SoyuzTestPublisher()
29+ >>> hoary = test_publisher.setUpDefaultDistroSeries(
30+ ... ubuntu.getSeries('hoary'))
31+ >>> fake_chroot = test_publisher.addMockFile('fake_chroot.tar.gz')
32+ >>> unused = hoary['i386'].addOrUpdateChroot(fake_chroot)
33+ >>> login('admin@canonical.com')
34+ >>> test_publisher.getPubBinaries(
35+ ... 'linux-2.6.12', architecturespecific=True)
36+ [<BinaryPackagePublishingHistory ...>]
37+ >>> login(ANONYMOUS)
38+
39+ >>> print_guessed_names('linux-2.6.12')
40+ source: u'linux'
41+ binary: u'linux-2.6.12'
42+
43
44 Handling Personal Package Archives
45 ----------------------------------

Subscribers

People subscribed via source and target branches

to status/vote changes: