← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~julian-edwards/launchpad/ppa-pockets-bug-684321 into lp:launchpad

 

Julian Edwards has proposed merging lp:~julian-edwards/launchpad/ppa-pockets-bug-684321 into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  #684321 The PPA publisher carefully considers each pocket to publish when PPAs don't have them
  https://bugs.launchpad.net/bugs/684321


Speed up the PPA publisher by stopping it from unnecessarily considering non-Release pockets in all distroseries.  PPAs only have the Release pocket in their indexes.
-- 
https://code.launchpad.net/~julian-edwards/launchpad/ppa-pockets-bug-684321/+merge/42824
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~julian-edwards/launchpad/ppa-pockets-bug-684321 into lp:launchpad.
=== modified file 'lib/lp/archivepublisher/publishing.py'
--- lib/lp/archivepublisher/publishing.py	2010-11-09 14:35:52 +0000
+++ lib/lp/archivepublisher/publishing.py	2010-12-06 11:03:16 +0000
@@ -15,7 +15,6 @@
 import shutil
 
 from debian.deb822 import Release
-from zope.component import getUtility
 
 from canonical.database.sqlbase import sqlvalues
 from canonical.librarian.client import LibrarianClient
@@ -46,7 +45,6 @@
     BinaryPackageFormat,
     PackagePublishingStatus,
     )
-from lp.soyuz.interfaces.component import IComponentSet
 
 
 def reorder_components(components):
@@ -216,7 +214,7 @@
         self.log.debug("* Step A: Publishing packages")
 
         for distroseries in self.distro.series:
-            for pocket in PackagePublishingPocket.items:
+            for pocket in self.archive.getPockets():
                 if (self.allowed_suites and not (distroseries.name, pocket) in
                     self.allowed_suites):
                     self.log.debug(
@@ -256,7 +254,7 @@
 
         # Loop for each pocket in each distroseries:
         for distroseries in self.distro.series:
-            for pocket in PackagePublishingPocket.items:
+            for pocket in self.archive.getPockets():
                 if self.cannotModifySuite(distroseries, pocket):
                     # We don't want to mark release pockets dirty in a
                     # stable distroseries, no matter what other bugs
@@ -292,7 +290,7 @@
         self.log.debug("* Step B: dominating packages")
         judgejudy = Dominator(self.log, self.archive)
         for distroseries in self.distro.series:
-            for pocket in PackagePublishingPocket.items:
+            for pocket in self.archive.getPockets():
                 if not force_domination:
                     if not self.isDirty(distroseries, pocket):
                         self.log.debug("Skipping domination for %s/%s" %
@@ -316,7 +314,7 @@
         """
         self.log.debug("* Step C': write indexes directly from DB")
         for distroseries in self.distro:
-            for pocket in PackagePublishingPocket.items:
+            for pocket in self.archive.getPockets():
                 if not is_careful:
                     if not self.isDirty(distroseries, pocket):
                         self.log.debug("Skipping index generation for %s/%s" %
@@ -340,7 +338,7 @@
         """
         self.log.debug("* Step D: Generating Release files.")
         for distroseries in self.distro:
-            for pocket in PackagePublishingPocket.items:
+            for pocket in self.archive.getPockets():
                 if not is_careful:
                     if not self.isDirty(distroseries, pocket):
                         self.log.debug("Skipping release files for %s/%s" %

=== modified file 'lib/lp/soyuz/interfaces/archive.py'
--- lib/lp/soyuz/interfaces/archive.py	2010-11-09 23:39:59 +0000
+++ lib/lp/soyuz/interfaces/archive.py	2010-12-06 11:03:16 +0000
@@ -905,6 +905,10 @@
         :param proposed_name: A String identifying the proposed PPA name.
         """
 
+    def getPockets():
+        """Return iterable containing valid pocket names for this archive."""
+
+
 class IArchiveView(IHasBuildRecords):
     """Archive interface for operations restricted by view privilege."""
 

=== modified file 'lib/lp/soyuz/model/archive.py'
--- lib/lp/soyuz/model/archive.py	2010-12-02 14:57:58 +0000
+++ lib/lp/soyuz/model/archive.py	2010-12-06 11:03:16 +0000
@@ -1734,6 +1734,15 @@
         else:
             return "You already have a PPA named '%s'." % proposed_name
 
+    def getPockets(self):
+        """See `IArchive`."""
+        if self.is_ppa:
+            return [PackagePublishingPocket.RELEASE]
+        
+        # Cast to a list so we don't trip up with the security proxy not
+        # understandiung EnumItems.
+        return list(PackagePublishingPocket.items)
+
 
 class ArchiveSet:
     implements(IArchiveSet)

=== modified file 'lib/lp/soyuz/tests/test_archive.py'
--- lib/lp/soyuz/tests/test_archive.py	2010-12-02 16:46:19 +0000
+++ lib/lp/soyuz/tests/test_archive.py	2010-12-06 11:03:16 +0000
@@ -1490,3 +1490,18 @@
         main_comp = getUtility(IComponentSet)['main']
         self.assertEquals(
             [main_comp], list(archive.getComponentsForSeries(self.series)))
+
+
+class TestGetPockets(TestCaseWithFactory):
+
+    layer = DatabaseFunctionalLayer
+
+    def test_getPockets_for_other_archives(self):
+        archive = self.factory.makeArchive(purpose=ArchivePurpose.PRIMARY)
+        self.assertEqual(
+            list(PackagePublishingPocket.items), archive.getPockets())
+
+    def test_getPockets_for_PPAs(self):
+        archive = self.factory.makeArchive(purpose=ArchivePurpose.PPA)
+        self.assertEqual(
+            [PackagePublishingPocket.RELEASE], archive.getPockets())


Follow ups