I've just gotten back to this now - when I originally tried to land this while at UDS there were a bunch of ec2 errors - one of which pointed out an error in the query itself. There are two parts the failures fixed by this incremental. * First, there was an actual error in the query (details below), * second, a number of tests were affected by the change as we now return builds from other archive contexts if the build has binaries published in the current archive context (ie. by a copy) * third, we have some bogus sample data (effectively two i386 builds for ice-weasel 1.0 in cprov's ppa - one built in that context but without any corresponding bpr's or bpph (so pending, buildid=25), the other copied and published there with a new bpph (buildid=23). As this branch exposed this data, I modified two tests to use a different package instead (yes, I would like to have re-written the test to use STP etc. etc., but). So, annotated diff below, raw diff at: http://pastebin.ubuntu.com/336595/ (-r 9889..9892) === modified file 'lib/lp/soyuz/model/publishing.py' --- lib/lp/soyuz/model/publishing.py 2009-12-04 13:46:43 +0000 +++ lib/lp/soyuz/model/publishing.py 2009-12-07 11:11:28 +0000 @@ -594,7 +594,7 @@ # not blow up because of bad data. return None source, packageupload, spr, changesfile, lfc = result - + # Return a webapp-proxied LibraryFileAlias so that restricted # librarian files are accessible. Non-restricted files will get # a 302 so that webapp threads are not tied up. @@ -1290,7 +1290,8 @@ Build, builds_for_distroseries_expr, SourcePackagePublishingHistory.archiveID != Build.archiveID, - BinaryPackagePublishingHistory.archive == Build.archiveID, + BinaryPackagePublishingHistory.archive == + SourcePackagePublishingHistory.archiveID, ### So this was the error in the original MP - we're looking for builds that originated in other contexts that have binaries published in the SPPH archive context - not the Build's archive context :/ BinaryPackagePublishingHistory.binarypackagerelease == BinaryPackageRelease.id, BinaryPackageRelease.build == Build.id, === modified file 'lib/lp/soyuz/scripts/tests/test_copypackage.py' --- lib/lp/soyuz/scripts/tests/test_copypackage.py 2009-10-17 00:58:51 +0000 +++ lib/lp/soyuz/scripts/tests/test_copypackage.py 2009-12-07 11:15:16 +0000 @@ -1340,6 +1340,21 @@ target_archive = copy_helper.destination.archive self.checkCopies(copied, target_archive, 3) + # The second copy will fail explicitly because the new BPPH + # records are not yet published. + nothing_copied = copy_helper.mainTask() + self.assertEqual(len(nothing_copied), 0) + self.assertEqual( + copy_helper.logger.buffer.getvalue().splitlines()[-1], + 'ERROR: foo 666 in hoary (same version has unpublished binaries ' + 'in the destination archive for Hoary, please wait for them to ' + 'be published before copying)') + + # If we ensure that the copied binaries are published, the + # copy won't fail but will simply not copy anything. + for bin_pub in copied[1:3]: + bin_pub.secure_record.setPublished() + ### The above, part of testWillNotCopyTwice, needed to be added as before the binaries are published, the copy actually fails. Previously this was not picked up by the copier during the check for potential conflicts, because conflict_candidate_spph.getStatusSummaryForBuilds() was not including builds from other archives even if they had binaries published in the spph archive context. nothing_copied = copy_helper.mainTask() self.assertEqual(len(nothing_copied), 0) self.assertEqual( @@ -1476,7 +1491,7 @@ name='boing') self.assertEqual(copied_source.displayname, 'boing 1.0 in hoary') self.assertEqual(len(copied_source.getPublishedBinaries()), 2) - self.assertEqual(len(copied_source.getBuilds()), 0) + self.assertEqual(len(copied_source.getBuilds()), 1) ### The copy works as per normal, but we do now see the build in the copied source's context (where we previously did not). def _setupArchitectureGrowingScenario(self, architecturehintlist="all"): """Prepare distroseries with different sets of architectures. === modified file 'lib/lp/soyuz/stories/ppa/xx-copy-packages.txt' --- lib/lp/soyuz/stories/ppa/xx-copy-packages.txt 2009-10-13 10:05:58 +0000 +++ lib/lp/soyuz/stories/ppa/xx-copy-packages.txt 2009-12-07 14:47:54 +0000 @@ -1062,7 +1062,7 @@ >>> print_ppa_packages(jblack_browser.contents) Source Published Status Series Section Build Status - foo - 2.0 (changesfile) Pending Hoary Base + foo - 2.0 (changesfile) Pending Hoary Base i386 foo - 1.1 (changesfile) Pending Warty Base pmount - 0.1-1 Pending Hoary Editors pmount - 0.1-1 Pending Warty Editors ### This copied spph has pending binaries which we did not see before (as the build originated elsewhere, and immediately after copying the new bpph is pending publication). === modified file 'lib/lp/soyuz/stories/ppa/xx-ppa-packages.txt' --- lib/lp/soyuz/stories/ppa/xx-ppa-packages.txt 2009-11-05 10:51:36 +0000 +++ lib/lp/soyuz/stories/ppa/xx-ppa-packages.txt 2009-12-07 14:47:54 +0000 @@ -129,29 +129,51 @@ If a the binaries for a package are fully built, but have not yet been published, this will be indicated to the viewer: - >>> anon_browser.open( - ... "http://launchpad.dev/~cprov/+archive/ppa/+packages") - >>> expander_url = anon_browser.getLink(id='pub28-expander').url + # First, we'll update the binary publishing history for the i386 + # record so that it is pending publication. + >>> login('