Merge lp:~julian-edwards/launchpad/copy-archive-virtualization-bug-600640 into lp:launchpad

Proposed by Julian Edwards
Status: Merged
Approved by: Jelmer Vernooij
Approved revision: no longer in the source branch.
Merged at revision: 11089
Proposed branch: lp:~julian-edwards/launchpad/copy-archive-virtualization-bug-600640
Merge into: lp:launchpad
Diff against target: 108 lines (+23/-9)
2 files modified
lib/lp/soyuz/scripts/populate_archive.py (+12/-3)
lib/lp/soyuz/scripts/tests/test_populatearchive.py (+11/-6)
To merge this branch: bzr merge lp:~julian-edwards/launchpad/copy-archive-virtualization-bug-600640
Reviewer Review Type Date Requested Status
Jelmer Vernooij (community) Approve
Review via email: mp+29009@code.launchpad.net

Description of the change

When creating copy archives, they currently default to virtualized so that
they use the PPA builders.

Unfortunately this has the side effect of restricting the available build
architectures to those available as PPA builders, which is quite limited. In
the most recent use case, we want to do an armel rebuild and this is
impossible.

I've made a simple change so that the virtualization state of the new copy
archive is settable on the command line via a new paramter "--nonvirtualized",
which if present will change from the default of virtual, to non-virtual.

To post a comment you must log in.
Revision history for this message
Jelmer Vernooij (jelmer) :
review: Approve

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 16:05:51 +0000
4@@ -53,7 +53,7 @@
5 self, from_archive, from_distribution, from_suite, from_user,
6 component, to_distribution, to_suite, to_archive, to_user, reason,
7 include_binaries, arch_tags, merge_copy_flag,
8- packageset_delta_flag):
9+ packageset_delta_flag, nonvirtualized):
10 """Create archive, populate it with packages and builds.
11
12 Please note: if a component was specified for the origin then the
13@@ -206,10 +206,12 @@
14 # before the switch is flipped and build activity starts.
15 # Also, builds for copy archives should default to using
16 # virtual builders.
17+ virtual = not nonvirtualized
18 copy_archive = getUtility(IArchiveSet).new(
19 ArchivePurpose.COPY, registrant, name=to_archive,
20 distribution=the_destination.distribution,
21- description=reason, enabled=False, require_virtualized=True)
22+ description=reason, enabled=False,
23+ require_virtualized=virtual)
24 the_destination.archive = copy_archive
25 # Associate the newly created copy archive with the processor
26 # families specified by the user.
27@@ -310,12 +312,14 @@
28 raise SoyuzScriptError(
29 "Invalid origin archive name: '%s'" % opts.from_archive)
30
31+ # For the love of $DEITY, WTF doesn't this method just accept a
32+ # single parameter "opts" ...
33 self.populateArchive(
34 opts.from_archive, opts.from_distribution, opts.from_suite,
35 opts.from_user, opts.component, opts.to_distribution,
36 opts.to_suite, opts.to_archive, opts.to_user, opts.reason,
37 opts.include_binaries, opts.arch_tags, opts.merge_copy_flag,
38- opts.packageset_delta_flag)
39+ opts.packageset_delta_flag, opts.nonvirtualized)
40
41 def add_my_options(self):
42 """Parse command line arguments for copy archive creation/population.
43@@ -379,6 +383,11 @@
44 'Only show packages that are fresher or new in origin '
45 'archive. Destination archive must exist already.'))
46
47+ self.parser.add_option(
48+ "--nonvirtualized", dest="nonvirtualized", default=False,
49+ action="store_true",
50+ help='Create the archive as nonvirtual if specified.')
51+
52 def _createMissingBuilds(
53 self, distroseries, archive, proc_families):
54 """Create builds for all cloned source packages.
55
56=== modified file 'lib/lp/soyuz/scripts/tests/test_populatearchive.py'
57--- lib/lp/soyuz/scripts/tests/test_populatearchive.py 2010-06-22 11:14:02 +0000
58+++ lib/lp/soyuz/scripts/tests/test_populatearchive.py 2010-07-01 16:05:51 +0000
59@@ -214,7 +214,7 @@
60
61 def copyArchive(self, distroseries, archive_name, owner,
62 architectures=None, component="main", from_user=None,
63- from_archive=None):
64+ from_archive=None, nonvirtualized=False):
65 """Run the copy-archive script."""
66 extra_args = [
67 '--from-distribution', distroseries.distribution.name,
68@@ -237,6 +237,9 @@
69 if architectures is None:
70 architectures = ["386"]
71
72+ if nonvirtualized:
73+ extra_args.extend(["--nonvirtualized"])
74+
75 for architecture in architectures:
76 extra_args.extend(['-a', architecture])
77
78@@ -253,9 +256,9 @@
79 # flag turned off.
80 self.assertFalse(copy_archive.enabled)
81
82- # Also, make sure that the builds for the new copy archive will be
83- # carried out on non-virtual builders.
84- self.assertTrue(copy_archive.require_virtualized)
85+ # Assert the virtualization is correct.
86+ virtual = not nonvirtualized
87+ self.assertEqual(copy_archive.require_virtualized, virtual)
88
89 return copy_archive
90
91@@ -282,13 +285,15 @@
92 self.createSourcePublications(package_infos, distroseries)
93 return distroseries
94
95- def makeCopyArchive(self, package_infos, component="main"):
96+ def makeCopyArchive(self, package_infos, component="main",
97+ nonvirtualized=False):
98 """Make a copy archive based on a new distribution."""
99 owner = self.createTargetOwner()
100 distroseries = self.createSourceDistribution(package_infos)
101 archive_name = self.getTargetArchiveName(distroseries.distribution)
102 copy_archive = self.copyArchive(
103- distroseries, archive_name, owner, component=component)
104+ distroseries, archive_name, owner, component=component,
105+ nonvirtualized=nonvirtualized)
106 return (copy_archive, distroseries)
107
108 def checkBuilds(self, archive, package_infos):