Merge lp:~julian-edwards/launchpad/copy-archive-arch-all-bug-600621 into lp:launchpad

Proposed by Julian Edwards
Status: Merged
Approved by: Julian Edwards
Approved revision: no longer in the source branch.
Merged at revision: 11090
Proposed branch: lp:~julian-edwards/launchpad/copy-archive-arch-all-bug-600621
Merge into: lp:launchpad
Diff against target: 91 lines (+45/-2)
2 files modified
lib/lp/soyuz/scripts/populate_archive.py (+12/-0)
lib/lp/soyuz/scripts/tests/test_populatearchive.py (+33/-2)
To merge this branch: bzr merge lp:~julian-edwards/launchpad/copy-archive-arch-all-bug-600621
Reviewer Review Type Date Requested Status
Paul Hummer (community) code Approve
Review via email: mp+29021@code.launchpad.net

Description of the change

When we create copy archives for rebuild testing, sometimes only a small
subset of architectures is required to be rebuilt.

In the case where those architectures don't include the "nominatedarchindep"
architecture, then "arch-all" packages cannot be built and currently populate-
archive blows up when trying to do so since there's catch-all assertion in the
core build creation code.

This branch skips the creation of build records for those packages in this
situation when the populate-archive script runs.

To post a comment you must log in.
Revision history for this message
Paul Hummer (rockstar) wrote :

<rockstar> bigjools, why do you "create copy archives for rebuild testing"? That's not a PPA thing, right?
<bigjools> rockstar: no, it's more like a main archive presented like a PPA. It allows us to copy source from somewhere else and rebuild it
<rockstar> bigjools, presented like a PPA? What's the use case there?
<bigjools> UI code re-use :)
<rockstar> (Patch looks fine, just trying to squeeze a few user stories out)
<bigjools> we didn't want it looking like the normal distro pages
<bigjools> the main use case is to find failed builds
<rockstar> Why shouldn't it look the same?
<rockstar> Er, why shouldn't it look like the normal distro pages?
<bigjools> they're overkill for this type of archive, mainly
<rockstar> bigjools, so I guess the thing I'm not understanding is what type of archive this is.
<rockstar> Is it a distro archive or a PPA or something else I don't know about.
<james_w> it's a third type
<rockstar> james_w, which is?
<rockstar> Is it like a throwaway archive just for rebuilding copies of existing packages?
<james_w> rockstar: pretty much
<rockstar> james_w, ah, okay. That parses better now.

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/lp/soyuz/scripts/populate_archive.py'
--- lib/lp/soyuz/scripts/populate_archive.py 2010-06-16 22:16:46 +0000
+++ lib/lp/soyuz/scripts/populate_archive.py 2010-07-01 17:10:49 +0000
@@ -425,7 +425,19 @@
425 """Return the source package name for a publishing record."""425 """Return the source package name for a publishing record."""
426 return pub.sourcepackagerelease.sourcepackagename.name426 return pub.sourcepackagerelease.sourcepackagename.name
427427
428 archindep_unavailable = distroseries.nominatedarchindep not in (
429 architectures)
430
428 for pubrec in sources_published:431 for pubrec in sources_published:
432 if (pubrec.sourcepackagerelease.architecturehintlist == "all"
433 and archindep_unavailable):
434 self.logger.info(
435 "Skipping %s, arch-all package can't be built since %s "
436 "is not requested" % (
437 get_spn(pubrec),
438 distroseries.nominatedarchindep.architecturetag))
439 continue
440
429 builds = pubrec.createMissingBuilds(441 builds = pubrec.createMissingBuilds(
430 architectures_available=architectures, logger=self.logger)442 architectures_available=architectures, logger=self.logger)
431 if len(builds) == 0:443 if len(builds) == 0:
432444
=== modified file 'lib/lp/soyuz/scripts/tests/test_populatearchive.py'
--- lib/lp/soyuz/scripts/tests/test_populatearchive.py 2010-06-22 11:14:02 +0000
+++ lib/lp/soyuz/scripts/tests/test_populatearchive.py 2010-07-01 17:10:49 +0000
@@ -44,11 +44,13 @@
44class PackageInfo:44class PackageInfo:
4545
46 def __init__(self, name, version,46 def __init__(self, name, version,
47 status=PackagePublishingStatus.PUBLISHED, component="main"):47 status=PackagePublishingStatus.PUBLISHED, component="main",
48 arch_hint=None):
48 self.name = name49 self.name = name
49 self.version = version50 self.version = version
50 self.status = status51 self.status = status
51 self.component = component52 self.component = component
53 self.arch_hint = arch_hint
5254
5355
54class TestPopulateArchiveScript(TestCaseWithFactory):56class TestPopulateArchiveScript(TestCaseWithFactory):
@@ -189,12 +191,17 @@
189191
190 def createSourcePublication(self, info, distroseries):192 def createSourcePublication(self, info, distroseries):
191 """Create a SourcePackagePublishingHistory based on a PackageInfo."""193 """Create a SourcePackagePublishingHistory based on a PackageInfo."""
194 if info.arch_hint is None:
195 arch_hint = "any"
196 else:
197 arch_hint = info.arch_hint
198
192 self.factory.makeSourcePackagePublishingHistory(199 self.factory.makeSourcePackagePublishingHistory(
193 sourcepackagename=self.factory.getOrMakeSourcePackageName(200 sourcepackagename=self.factory.getOrMakeSourcePackageName(
194 name=info.name),201 name=info.name),
195 distroseries=distroseries, component=self.factory.makeComponent(202 distroseries=distroseries, component=self.factory.makeComponent(
196 info.component),203 info.component),
197 version=info.version, architecturehintlist='any',204 version=info.version, architecturehintlist=arch_hint,
198 archive=distroseries.distribution.main_archive,205 archive=distroseries.distribution.main_archive,
199 status=info.status, pocket=PackagePublishingPocket.RELEASE)206 status=info.status, pocket=PackagePublishingPocket.RELEASE)
200207
@@ -482,6 +489,30 @@
482 # amd64 too489 # amd64 too
483 self.checkBuilds(copy_archive, [package_info])490 self.checkBuilds(copy_archive, [package_info])
484491
492 def testNoBuildsForArchAll(self):
493 # If we have a copy for an architecture that is not the
494 # nominatedarchindep architecture, then we don't want to create
495 # builds for arch-all packages, as they can't be built at all
496 # and createMissingBuilds blows up when it checks that.
497 package_info = PackageInfo(
498 "bzr", "2.1", status=PackagePublishingStatus.PUBLISHED,
499 arch_hint="all")
500 owner = self.createTargetOwner()
501 distroseries = self.createSourceDistribution([package_info])
502 self.factory.makeDistroArchSeries(
503 distroseries=distroseries, architecturetag="amd64",
504 processorfamily=ProcessorFamilySet().getByName("amd64"),
505 supports_virtualized=True)
506 archive_name = self.getTargetArchiveName(distroseries.distribution)
507 copy_archive = self.copyArchive(
508 distroseries, archive_name, owner,
509 architectures=["amd64"])
510 # We don't get any builds since amd64 is not the
511 # nomindatedarchindep, i386 is.
512 self.assertEqual(
513 distroseries.nominatedarchindep.architecturetag, "i386")
514 self.checkBuilds(copy_archive, [])
515
485 def testMultipleArchTags(self):516 def testMultipleArchTags(self):
486 """Test copying an archive with multiple architectures.517 """Test copying an archive with multiple architectures.
487518