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
1=== modified file 'lib/lp/soyuz/scripts/populate_archive.py'
2--- lib/lp/soyuz/scripts/populate_archive.py 2010-06-16 22:16:46 +0000
3+++ lib/lp/soyuz/scripts/populate_archive.py 2010-07-01 17:10:49 +0000
4@@ -425,7 +425,19 @@
5 """Return the source package name for a publishing record."""
6 return pub.sourcepackagerelease.sourcepackagename.name
7
8+ archindep_unavailable = distroseries.nominatedarchindep not in (
9+ architectures)
10+
11 for pubrec in sources_published:
12+ if (pubrec.sourcepackagerelease.architecturehintlist == "all"
13+ and archindep_unavailable):
14+ self.logger.info(
15+ "Skipping %s, arch-all package can't be built since %s "
16+ "is not requested" % (
17+ get_spn(pubrec),
18+ distroseries.nominatedarchindep.architecturetag))
19+ continue
20+
21 builds = pubrec.createMissingBuilds(
22 architectures_available=architectures, logger=self.logger)
23 if len(builds) == 0:
24
25=== modified file 'lib/lp/soyuz/scripts/tests/test_populatearchive.py'
26--- lib/lp/soyuz/scripts/tests/test_populatearchive.py 2010-06-22 11:14:02 +0000
27+++ lib/lp/soyuz/scripts/tests/test_populatearchive.py 2010-07-01 17:10:49 +0000
28@@ -44,11 +44,13 @@
29 class PackageInfo:
30
31 def __init__(self, name, version,
32- status=PackagePublishingStatus.PUBLISHED, component="main"):
33+ status=PackagePublishingStatus.PUBLISHED, component="main",
34+ arch_hint=None):
35 self.name = name
36 self.version = version
37 self.status = status
38 self.component = component
39+ self.arch_hint = arch_hint
40
41
42 class TestPopulateArchiveScript(TestCaseWithFactory):
43@@ -189,12 +191,17 @@
44
45 def createSourcePublication(self, info, distroseries):
46 """Create a SourcePackagePublishingHistory based on a PackageInfo."""
47+ if info.arch_hint is None:
48+ arch_hint = "any"
49+ else:
50+ arch_hint = info.arch_hint
51+
52 self.factory.makeSourcePackagePublishingHistory(
53 sourcepackagename=self.factory.getOrMakeSourcePackageName(
54 name=info.name),
55 distroseries=distroseries, component=self.factory.makeComponent(
56 info.component),
57- version=info.version, architecturehintlist='any',
58+ version=info.version, architecturehintlist=arch_hint,
59 archive=distroseries.distribution.main_archive,
60 status=info.status, pocket=PackagePublishingPocket.RELEASE)
61
62@@ -482,6 +489,30 @@
63 # amd64 too
64 self.checkBuilds(copy_archive, [package_info])
65
66+ def testNoBuildsForArchAll(self):
67+ # If we have a copy for an architecture that is not the
68+ # nominatedarchindep architecture, then we don't want to create
69+ # builds for arch-all packages, as they can't be built at all
70+ # and createMissingBuilds blows up when it checks that.
71+ package_info = PackageInfo(
72+ "bzr", "2.1", status=PackagePublishingStatus.PUBLISHED,
73+ arch_hint="all")
74+ owner = self.createTargetOwner()
75+ distroseries = self.createSourceDistribution([package_info])
76+ self.factory.makeDistroArchSeries(
77+ distroseries=distroseries, architecturetag="amd64",
78+ processorfamily=ProcessorFamilySet().getByName("amd64"),
79+ supports_virtualized=True)
80+ archive_name = self.getTargetArchiveName(distroseries.distribution)
81+ copy_archive = self.copyArchive(
82+ distroseries, archive_name, owner,
83+ architectures=["amd64"])
84+ # We don't get any builds since amd64 is not the
85+ # nomindatedarchindep, i386 is.
86+ self.assertEqual(
87+ distroseries.nominatedarchindep.architecturetag, "i386")
88+ self.checkBuilds(copy_archive, [])
89+
90 def testMultipleArchTags(self):
91 """Test copying an archive with multiple architectures.
92