launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #00557
[Merge] lp:~wgrant/launchpad/bug-616154-guessPackageNames-order-fix into lp:launchpad
William Grant has proposed merging lp:~wgrant/launchpad/bug-616154-guessPackageNames-order-fix into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
#616154 Distribution.guessPackageNames needs to return the source for the latest published binary
https://bugs.launchpad.net/bugs/616154
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.
--
https://code.launchpad.net/~wgrant/launchpad/bug-616154-guessPackageNames-order-fix/+merge/32285
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~wgrant/launchpad/bug-616154-guessPackageNames-order-fix into lp:launchpad.
=== modified file 'lib/lp/registry/model/distribution.py'
--- lib/lp/registry/model/distribution.py 2010-08-10 21:54:41 +0000
+++ lib/lp/registry/model/distribution.py 2010-08-11 02:26:45 +0000
@@ -1268,7 +1268,8 @@
bpph = IStore(BinaryPackagePublishingHistory).find(
BinaryPackagePublishingHistory,
BinaryPackageRelease.binarypackagename == binarypackagename,
- *bpph_location_clauses).any()
+ *bpph_location_clauses).order_by(
+ Desc(BinaryPackagePublishingHistory.id)).first()
if bpph is not None:
spr = bpph.binarypackagerelease.build.source_package_release
return (spr.sourcepackagename, binarypackagename)
=== modified file 'lib/lp/soyuz/doc/distribution.txt'
--- lib/lp/soyuz/doc/distribution.txt 2010-02-08 11:40:06 +0000
+++ lib/lp/soyuz/doc/distribution.txt 2010-08-11 02:26:45 +0000
@@ -173,6 +173,27 @@
source: u'linux-source-2.6.15'
binary: u'linux-2.6.12'
+If there are multiple matching binary packages, the source of the latest
+publication is used. If we create a new 'linux' source with a 'linux-2.6.12'
+binary, 'linux' will be returned instead of 'linux-source-2.6.15'.
+
+ >>> from lp.soyuz.tests.test_publishing import (
+ ... SoyuzTestPublisher)
+ >>> test_publisher = SoyuzTestPublisher()
+ >>> hoary = test_publisher.setUpDefaultDistroSeries(
+ ... ubuntu.getSeries('hoary'))
+ >>> fake_chroot = test_publisher.addMockFile('fake_chroot.tar.gz')
+ >>> unused = hoary['i386'].addOrUpdateChroot(fake_chroot)
+ >>> login('admin@xxxxxxxxxxxxx')
+ >>> test_publisher.getPubBinaries(
+ ... 'linux-2.6.12', architecturespecific=True)
+ [<BinaryPackagePublishingHistory ...>]
+ >>> login(ANONYMOUS)
+
+ >>> print_guessed_names('linux-2.6.12')
+ source: u'linux'
+ binary: u'linux-2.6.12'
+
Handling Personal Package Archives
----------------------------------