Merge lp:~julian-edwards/launchpad/delete-ppa-bug-386167 into lp:launchpad

Proposed by Julian Edwards
Status: Merged
Approved by: Graham Binns
Approved revision: no longer in the source branch.
Merged at revision: 10967
Proposed branch: lp:~julian-edwards/launchpad/delete-ppa-bug-386167
Merge into: lp:launchpad
Diff against target: 64 lines (+19/-3)
2 files modified
lib/lp/archivepublisher/tests/test_publisher.py (+14/-1)
lib/lp/registry/model/distribution.py (+5/-2)
To merge this branch: bzr merge lp:~julian-edwards/launchpad/delete-ppa-bug-386167
Reviewer Review Type Date Requested Status
Francis J. Lacoste (community) release-critical Approve
Graham Binns (community) code Approve
Review via email: mp+27056@code.launchpad.net

Description of the change

= Summary =
Ensure all PPAs are deleted properly when requested. Currently there are a
load that are pending deletion but are not actually deleted, which still
blocks account renaming.

== Proposed fix ==
Make getPendingPublicationPPAs return PPAs waiting for deletion.

== Implementation details ==
IDistribution.getPendingPublicationPPAs() was only returning PPAs with
outstanding publication changes. It needs to also return PPAs awaiting
deletion so that the publisher can deal with them appropriately.

== Tests ==
bin/test -cvvt testDeletingArchive

== Demo and Q/A ==
Already QA'ed on dogfood, and it works fine.

= Launchpad lint =

Checking for conflicts. and issues in doctests and templates.
Running jslint, xmllint, pyflakes, and pylint.
Using normal rules.

Linting changed files:
  lib/lp/archivepublisher/tests/test_publisher.py
  lib/lp/registry/model/distribution.py

To post a comment you must log in.
Revision history for this message
Graham Binns (gmb) :
review: Approve (code)
Revision history for this message
Francis J. Lacoste (flacoste) :
review: Approve (release-critical)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/archivepublisher/tests/test_publisher.py'
2--- lib/lp/archivepublisher/tests/test_publisher.py 2010-04-22 12:02:06 +0000
3+++ lib/lp/archivepublisher/tests/test_publisher.py 2010-06-08 14:20:47 +0000
4@@ -18,6 +18,7 @@
5 from zope.component import getUtility
6 from zope.security.proxy import removeSecurityProxy
7
8+from canonical.zeca.ftests.harness import ZecaTestSetup
9 from lp.archivepublisher.config import getPubConfig
10 from lp.archivepublisher.diskpool import DiskPool
11 from lp.archivepublisher.publishing import Publisher, getPublisher
12@@ -37,7 +38,6 @@
13 from lp.archivepublisher.interfaces.archivesigningkey import (
14 IArchiveSigningKey)
15 from lp.soyuz.tests.test_publishing import TestNativePublishingBase
16-from canonical.zeca.ftests.harness import ZecaTestSetup
17
18
19 class TestPublisherBase(TestNativePublishingBase):
20@@ -437,6 +437,19 @@
21 pending_archive = pending_archives[0]
22 self.assertEqual(spiv.archive.id, pending_archive.id)
23
24+ def testDeletingArchive(self):
25+ # IArchiveSet.getPendingPPAs should return archives that have a
26+ # status of DELETING.
27+ ubuntu = getUtility(IDistributionSet)['ubuntu']
28+
29+ archive = self.factory.makeArchive()
30+ old_num_pending_archives = ubuntu.getPendingPublicationPPAs().count()
31+ archive.status = ArchiveStatus.DELETING
32+ new_num_pending_archives = ubuntu.getPendingPublicationPPAs().count()
33+ self.assertEqual(
34+ 1 + old_num_pending_archives, new_num_pending_archives)
35+
36+
37 def _checkCompressedFile(self, archive_publisher, compressed_file_path,
38 uncompressed_file_path):
39 """Assert that a compressed file is equal to its uncompressed version.
40
41=== modified file 'lib/lp/registry/model/distribution.py'
42--- lib/lp/registry/model/distribution.py 2010-05-27 17:20:07 +0000
43+++ lib/lp/registry/model/distribution.py 2010-06-08 14:20:47 +0000
44@@ -75,7 +75,7 @@
45 HasTranslationImportsMixin)
46 from canonical.launchpad.helpers import shortlist
47 from lp.soyuz.interfaces.archive import (
48- ArchivePurpose, IArchiveSet, MAIN_ARCHIVE_PURPOSES)
49+ ArchivePurpose, ArchiveStatus, IArchiveSet, MAIN_ARCHIVE_PURPOSES)
50 from lp.soyuz.interfaces.archivepermission import (
51 IArchivePermissionSet)
52 from lp.bugs.interfaces.bugsupervisor import IHasBugSupervisor
53@@ -1345,7 +1345,10 @@
54 bin_query, clauseTables=['BinaryPackagePublishingHistory'],
55 orderBy=['archive.id'], distinct=True)
56
57- return src_archives.union(bin_archives)
58+ deleting_archives = Archive.selectBy(
59+ status=ArchiveStatus.DELETING).orderBy(['archive.id'])
60+
61+ return src_archives.union(bin_archives).union(deleting_archives)
62
63 def getArchiveByComponent(self, component_name):
64 """See `IDistribution`."""