launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #19250
[Merge] lp:~cjwatson/launchpad/bpb-recalculate-virt into lp:launchpad
Colin Watson has proposed merging lp:~cjwatson/launchpad/bpb-recalculate-virt into lp:launchpad.
Commit message:
Recalculate BinaryPackageBuild.virtualized when retrying a build.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/bpb-recalculate-virt/+merge/269323
Recalculate BinaryPackageBuild.virtualized when retrying a build.
As discussed on #launchpad-ops today, this will let us decommission the non-virtualized x86 builders without having to do DB surgery for existing build records; they'll just magically flip to virtualized if they're ever retried.
This also has the benefit that, in the case of a processor that still supports non-virtualized builds, changing an existing PPA to not require virtualized builds will no longer require reuploading packages.
--
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/bpb-recalculate-virt into lp:launchpad.
=== modified file 'lib/lp/soyuz/model/binarypackagebuild.py'
--- lib/lp/soyuz/model/binarypackagebuild.py 2015-07-31 00:50:08 +0000
+++ lib/lp/soyuz/model/binarypackagebuild.py 2015-08-27 10:12:30 +0000
@@ -142,6 +142,13 @@
COPY_ARCHIVE_SCORE_PENALTY = 2600
+def is_build_virtualized(archive, processor):
+ """Should a build for this `IArchive` and `IProcessor` be virtualized?"""
+ return (
+ archive.require_virtualized
+ or not processor.supports_nonvirtualized)
+
+
@implementer(IBinaryPackageBuild)
class BinaryPackageBuild(PackageBuildMixin, SQLBase):
_table = 'BinaryPackageBuild'
@@ -475,6 +482,7 @@
self.upload_log = None
self.dependencies = None
self.failure_count = 0
+ self.virtualized = is_build_virtualized(self.archive, self.processor)
self.queueBuild()
def rescore(self, score):
@@ -762,9 +770,7 @@
BinaryPackageBuild.job_type, status, date_created, builder,
archive)
processor = distro_arch_series.processor
- virtualized = (
- archive.require_virtualized
- or not processor.supports_nonvirtualized)
+ virtualized = is_build_virtualized(archive, processor)
return BinaryPackageBuild(
build_farm_job=build_farm_job,
distro_arch_series=distro_arch_series,
=== modified file 'lib/lp/soyuz/tests/test_build.py'
--- lib/lp/soyuz/tests/test_build.py 2015-05-14 08:50:41 +0000
+++ lib/lp/soyuz/tests/test_build.py 2015-08-27 10:12:30 +0000
@@ -1,4 +1,4 @@
-# Copyright 2011 Canonical Ltd. This software is licensed under the
+# Copyright 2011-2015 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
__metaclass__ = type
@@ -252,6 +252,23 @@
self.assertEquals(None, build.upload_log)
self.assertEquals(0, build.failure_count)
+ def test_retry_resets_virtualized(self):
+ # Retrying a build recalculates its virtualization.
+ archive = self.factory.makeArchive(
+ distribution=self.distroseries.distribution, virtualized=False)
+ build = self.factory.makeBinaryPackageBuild(
+ distroarchseries=self.das, archive=archive,
+ processor=self.processor)
+ self.assertFalse(build.virtualized)
+ build.updateStatus(BuildStatus.BUILDING)
+ build.updateStatus(BuildStatus.FAILEDTOBUILD)
+ build.gotFailure()
+ self.processor.supports_nonvirtualized = False
+ with person_logged_in(self.admin):
+ build.retry()
+ self.assertEqual(BuildStatus.NEEDSBUILD, build.status)
+ self.assertTrue(build.virtualized)
+
def test_create_bpr(self):
# Test that we can create a BPR from a given build.
spn = self.factory.getUniqueString()
Follow ups