Merge lp:~julian-edwards/launchpad/copy-archive-dispatch-bug-575165 into lp:launchpad

Proposed by Julian Edwards
Status: Merged
Approved by: Julian Edwards
Approved revision: no longer in the source branch.
Merged at revision: 11569
Proposed branch: lp:~julian-edwards/launchpad/copy-archive-dispatch-bug-575165
Merge into: lp:launchpad
Diff against target: 40 lines (+19/-0)
2 files modified
lib/lp/soyuz/model/archive.py (+5/-0)
lib/lp/soyuz/tests/test_archive.py (+14/-0)
To merge this branch: bzr merge lp:~julian-edwards/launchpad/copy-archive-dispatch-bug-575165
Reviewer Review Type Date Requested Status
Abel Deuring (community) code Approve
Review via email: mp+35684@code.launchpad.net

Commit message

Prevent the buildd-manager from falling over when it tries to dispatch COPY archive builds in a release pocket for a released distroseries.

Description of the change

= Summary =
When the buildd-manager dispatches builds it does a last-ditch check to make
sure the build is not getting dispatched for an invalid pocket, such as the
Release pocket in a stable distroseries. (Consider it a belt-and-braces
approach to preventing archive corruption.)

We're currently falling foul of this for COPY archives that are still running
builds when the development distroseries switches to a released state - all of
a sudden perfectly valid builds cause OOPSes in the buildd-manager.

The solution to this is to allow COPY archive uploads to any pocket. We do a
similar thing for the PARTNER archive in fact.

== Implementation details ==
Trivial change and test in the pocket check.

== Tests ==
bin/test -cvvt test_queue

== Demo and Q/A ==
To QA on dogfood:
 * Create a few rebuilds on an unreleased distro series and set them off
 * Switch the series to released
 * Watch the buildd-manager log file and make sure subsequent builds are not
OOPSing when being dispatched.

= Launchpad lint =

Checking for conflicts and issues in changed files.

Linting changed files:
  lib/lp/soyuz/tests/test_archive.py
  lib/lp/soyuz/model/archive.py

To post a comment you must log in.
Revision history for this message
Abel Deuring (adeuring) :
review: Approve (code)
Revision history for this message
Julian Edwards (julian-edwards) wrote :

Thanks Abel.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/soyuz/model/archive.py'
2--- lib/lp/soyuz/model/archive.py 2010-08-31 11:31:04 +0000
3+++ lib/lp/soyuz/model/archive.py 2010-09-16 16:21:09 +0000
4@@ -1109,6 +1109,11 @@
5 elif self.is_ppa:
6 if pocket != PackagePublishingPocket.RELEASE:
7 return InvalidPocketForPPA()
8+ elif self.is_copy:
9+ # Any pocket is allowed for COPY archives, otherwise it can
10+ # make the buildd-manager throw exceptions when dispatching
11+ # existing builds after a series is released.
12+ return
13 else:
14 # Uploads to the partner archive are allowed in any distroseries
15 # state.
16
17=== modified file 'lib/lp/soyuz/tests/test_archive.py'
18--- lib/lp/soyuz/tests/test_archive.py 2010-08-27 11:19:54 +0000
19+++ lib/lp/soyuz/tests/test_archive.py 2010-09-16 16:21:09 +0000
20@@ -618,6 +618,20 @@
21 NoRightsForArchive, archive, person, sourcepackagename,
22 distroseries=distroseries)
23
24+ def test_checkUploadToPocket_for_released_distroseries_copy_archive(self):
25+ # Uploading to the release pocket in a released COPY archive
26+ # should be allowed. This is mainly so that rebuilds that are
27+ # running during the release process don't suddenly cause
28+ # exceptions in the buildd-manager.
29+ archive = self.factory.makeArchive(purpose=ArchivePurpose.COPY)
30+ distroseries = self.factory.makeDistroSeries(
31+ distribution=archive.distribution,
32+ status=SeriesStatus.CURRENT)
33+ self.assertIs(
34+ None,
35+ archive.checkUploadToPocket(
36+ distroseries, PackagePublishingPocket.RELEASE))
37+
38 def test_checkUpload_package_permission(self):
39 archive, distroseries = self.makeArchiveAndActiveDistroSeries(
40 purpose=ArchivePurpose.PRIMARY)