← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~wgrant/launchpad/deleted-copies-are-not-ppas into lp:launchpad

 

William Grant has proposed merging lp:~wgrant/launchpad/deleted-copies-are-not-ppas into lp:launchpad.

Commit message:
Deleted copy archives aren't PPAs.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~wgrant/launchpad/deleted-copies-are-not-ppas/+merge/307427

Deleted copy archives aren't PPAs.

Fixes PPA publisher OOPSes -- copy archives aren't deletable, and
they're on a different machine anyway.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~wgrant/launchpad/deleted-copies-are-not-ppas into lp:launchpad.
=== modified file 'lib/lp/archivepublisher/tests/test_publisher.py'
--- lib/lp/archivepublisher/tests/test_publisher.py	2016-06-17 21:48:44 +0000
+++ lib/lp/archivepublisher/tests/test_publisher.py	2016-10-03 12:43:04 +0000
@@ -1289,16 +1289,18 @@
         self.assertEqual(spiv.archive.id, pending_archive.id)
 
     def testDeletingArchive(self):
-        # IArchiveSet.getPendingPPAs should return archives that have a
+        # IArchiveSet.getPendingPPAs should include PPAs that have a
         # status of DELETING.
         ubuntu = getUtility(IDistributionSet)['ubuntu']
 
-        archive = self.factory.makeArchive()
-        old_num_pending_archives = ubuntu.getPendingPublicationPPAs().count()
-        archive.status = ArchiveStatus.DELETING
-        new_num_pending_archives = ubuntu.getPendingPublicationPPAs().count()
-        self.assertEqual(
-            1 + old_num_pending_archives, new_num_pending_archives)
+        ppa = self.factory.makeArchive(purpose=ArchivePurpose.PPA)
+        copy_archive = self.factory.makeArchive(purpose=ArchivePurpose.COPY)
+        self.assertNotIn(ppa, ubuntu.getPendingPublicationPPAs())
+        self.assertNotIn(copy_archive, ubuntu.getPendingPublicationPPAs())
+        ppa.status = ArchiveStatus.DELETING
+        copy_archive.status = ArchiveStatus.DELETING
+        self.assertIn(ppa, ubuntu.getPendingPublicationPPAs())
+        self.assertNotIn(copy_archive, ubuntu.getPendingPublicationPPAs())
 
     def testPendingArchiveWithReapableFiles(self):
         # getPendingPublicationPPAs returns archives that have reapable

=== modified file 'lib/lp/registry/model/distribution.py'
--- lib/lp/registry/model/distribution.py	2016-05-26 16:25:52 +0000
+++ lib/lp/registry/model/distribution.py	2016-10-03 12:43:04 +0000
@@ -1297,7 +1297,8 @@
             orderBy=['archive.id'], distinct=True)
 
         deleting_archives = Archive.selectBy(
-            status=ArchiveStatus.DELETING).orderBy(['archive.id'])
+            status=ArchiveStatus.DELETING,
+            purpose=ArchivePurpose.PPA).orderBy(['archive.id'])
 
         return src_archives.union(bin_archives).union(
             reapable_af_archives).union(deleting_archives)


Follow ups