Merge lp:~stefanor/launchpad/retry-cancelled-build into lp:launchpad

Proposed by Stefano Rivera on 2012-10-09
Status: Merged
Approved by: Francesco Banconi on 2012-10-09
Approved revision: no longer in the source branch.
Merged at revision: 16117
Proposed branch: lp:~stefanor/launchpad/retry-cancelled-build
Merge into: lp:launchpad
Diff against target: 33 lines (+12/-0)
2 files modified
lib/lp/soyuz/model/binarypackagebuild.py (+1/-0)
lib/lp/soyuz/tests/test_build.py (+11/-0)
To merge this branch: bzr merge lp:~stefanor/launchpad/retry-cancelled-build
Reviewer Review Type Date Requested Status
Francesco Banconi (community) 2012-10-09 Approve on 2012-10-09
Review via email: mp+128683@code.launchpad.net

Commit Message

Enable retry of user-cancelled builds.

Description of the Change

== Summary ==

Cancelled PPA builds (non-virtual builds aren't cancellable) should be retryable. The standard mechanisms for retrying builds will work just fine, so it's simply a matter of enabling it.

== Complexity rationale ==

I'm 309 LoC in the green.

== Tests ==

There is a test in lp.soyuz.tests.test_build to ensure that cancelled builds are retryable.

== QA ==

Testing this requires a virtualised PPA builder:
* Upload a source package.
* Cancel the build.
* Retry it.
* See that it builds & publishes correctly.

But as the change is so trivial, it's probably just simpler to just not QA it.

To post a comment you must log in.
Francesco Banconi (frankban) wrote :

This branch looks good, the tests pass.

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/model/binarypackagebuild.py'
2--- lib/lp/soyuz/model/binarypackagebuild.py 2012-10-03 09:15:55 +0000
3+++ lib/lp/soyuz/model/binarypackagebuild.py 2012-10-09 11:05:28 +0000
4@@ -335,6 +335,7 @@
5 BuildStatus.MANUALDEPWAIT,
6 BuildStatus.CHROOTWAIT,
7 BuildStatus.FAILEDTOUPLOAD,
8+ BuildStatus.CANCELLED,
9 ]
10
11 # If the build is currently in any of the failed states,
12
13=== modified file 'lib/lp/soyuz/tests/test_build.py'
14--- lib/lp/soyuz/tests/test_build.py 2012-01-01 02:58:52 +0000
15+++ lib/lp/soyuz/tests/test_build.py 2012-10-09 11:05:28 +0000
16@@ -215,6 +215,17 @@
17 build.status = BuildStatus.FAILEDTOBUILD
18 self.assertTrue(build.can_be_retried)
19
20+ def test_retry_cancelled(self):
21+ # A cancelled build can be retried
22+ spph = self.publisher.getPubSource(
23+ sourcename=self.factory.getUniqueString(),
24+ version="%s.1" % self.factory.getUniqueInteger(),
25+ distroseries=self.distroseries)
26+ [build] = spph.createMissingBuilds()
27+ with person_logged_in(self.admin):
28+ build.status = BuildStatus.CANCELLED
29+ self.assertTrue(build.can_be_retried)
30+
31 def test_uploadlog(self):
32 # The upload log can be attached to a build
33 spph = self.publisher.getPubSource(