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

Proposed by Julian Edwards on 2010-12-06
Status: Merged
Approved by: Julian Edwards on 2010-12-06
Approved revision: no longer in the source branch.
Merged at revision: 12026
Proposed branch: lp:~julian-edwards/launchpad/ppa-pockets-bug-684321
Merge into: lp:launchpad
Diff against target: 122 lines (+33/-7)
4 files modified
lib/lp/archivepublisher/publishing.py (+5/-7)
lib/lp/soyuz/interfaces/archive.py (+4/-0)
lib/lp/soyuz/model/archive.py (+9/-0)
lib/lp/soyuz/tests/test_archive.py (+15/-0)
To merge this branch: bzr merge lp:~julian-edwards/launchpad/ppa-pockets-bug-684321
Reviewer Review Type Date Requested Status
Henning Eggers (community) code 2010-12-06 Approve on 2010-12-06
Review via email: mp+42824@code.launchpad.net

Commit Message

Speed up the PPA publisher by stopping it from unnecessarily considering non-Release pockets in all distroseries.

Description of the Change

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.

To post a comment you must log in.
Henning Eggers (henninge) wrote :

<henninge> bigjools:
<henninge> 93 + # Cast to a list so we don't trip up with the security proxy not
<henninge> 94 + # understandiung EnumItems
<henninge> Is that a known bug?
<bigjools> henninge: I don't know. It's easily fixed in lp_sitecustomize though
<bigjools> depends on what the foundations chaps say
<henninge> bigjools: So did you discover this? I am relly just asking if there is a bug for it ... ;)
<bigjools> henninge: well I discovered it but like Australia, there's some debate over whether I was first or not
<henninge> bigjools: ;-)
<bigjools> henninge: if you look in lib/lp_sitecustomize.py you'll see the proxy is removed for a few objects
<bigjools> Deferred being one that I previously added :)
<bigjools> we could add EnumItems there too but I want to check with Gary first
<henninge> yes, that's actually all I was going to ask you to do ... ;) (Talk to gary)

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/archivepublisher/publishing.py'
2--- lib/lp/archivepublisher/publishing.py 2010-11-09 14:35:52 +0000
3+++ lib/lp/archivepublisher/publishing.py 2010-12-08 11:53:56 +0000
4@@ -15,7 +15,6 @@
5 import shutil
6
7 from debian.deb822 import Release
8-from zope.component import getUtility
9
10 from canonical.database.sqlbase import sqlvalues
11 from canonical.librarian.client import LibrarianClient
12@@ -46,7 +45,6 @@
13 BinaryPackageFormat,
14 PackagePublishingStatus,
15 )
16-from lp.soyuz.interfaces.component import IComponentSet
17
18
19 def reorder_components(components):
20@@ -216,7 +214,7 @@
21 self.log.debug("* Step A: Publishing packages")
22
23 for distroseries in self.distro.series:
24- for pocket in PackagePublishingPocket.items:
25+ for pocket in self.archive.getPockets():
26 if (self.allowed_suites and not (distroseries.name, pocket) in
27 self.allowed_suites):
28 self.log.debug(
29@@ -256,7 +254,7 @@
30
31 # Loop for each pocket in each distroseries:
32 for distroseries in self.distro.series:
33- for pocket in PackagePublishingPocket.items:
34+ for pocket in self.archive.getPockets():
35 if self.cannotModifySuite(distroseries, pocket):
36 # We don't want to mark release pockets dirty in a
37 # stable distroseries, no matter what other bugs
38@@ -292,7 +290,7 @@
39 self.log.debug("* Step B: dominating packages")
40 judgejudy = Dominator(self.log, self.archive)
41 for distroseries in self.distro.series:
42- for pocket in PackagePublishingPocket.items:
43+ for pocket in self.archive.getPockets():
44 if not force_domination:
45 if not self.isDirty(distroseries, pocket):
46 self.log.debug("Skipping domination for %s/%s" %
47@@ -316,7 +314,7 @@
48 """
49 self.log.debug("* Step C': write indexes directly from DB")
50 for distroseries in self.distro:
51- for pocket in PackagePublishingPocket.items:
52+ for pocket in self.archive.getPockets():
53 if not is_careful:
54 if not self.isDirty(distroseries, pocket):
55 self.log.debug("Skipping index generation for %s/%s" %
56@@ -340,7 +338,7 @@
57 """
58 self.log.debug("* Step D: Generating Release files.")
59 for distroseries in self.distro:
60- for pocket in PackagePublishingPocket.items:
61+ for pocket in self.archive.getPockets():
62 if not is_careful:
63 if not self.isDirty(distroseries, pocket):
64 self.log.debug("Skipping release files for %s/%s" %
65
66=== modified file 'lib/lp/soyuz/interfaces/archive.py'
67--- lib/lp/soyuz/interfaces/archive.py 2010-11-09 23:39:59 +0000
68+++ lib/lp/soyuz/interfaces/archive.py 2010-12-08 11:53:56 +0000
69@@ -905,6 +905,10 @@
70 :param proposed_name: A String identifying the proposed PPA name.
71 """
72
73+ def getPockets():
74+ """Return iterable containing valid pocket names for this archive."""
75+
76+
77 class IArchiveView(IHasBuildRecords):
78 """Archive interface for operations restricted by view privilege."""
79
80
81=== modified file 'lib/lp/soyuz/model/archive.py'
82--- lib/lp/soyuz/model/archive.py 2010-12-02 14:57:58 +0000
83+++ lib/lp/soyuz/model/archive.py 2010-12-08 11:53:56 +0000
84@@ -1734,6 +1734,15 @@
85 else:
86 return "You already have a PPA named '%s'." % proposed_name
87
88+ def getPockets(self):
89+ """See `IArchive`."""
90+ if self.is_ppa:
91+ return [PackagePublishingPocket.RELEASE]
92+
93+ # Cast to a list so we don't trip up with the security proxy not
94+ # understandiung EnumItems.
95+ return list(PackagePublishingPocket.items)
96+
97
98 class ArchiveSet:
99 implements(IArchiveSet)
100
101=== modified file 'lib/lp/soyuz/tests/test_archive.py'
102--- lib/lp/soyuz/tests/test_archive.py 2010-12-02 16:46:19 +0000
103+++ lib/lp/soyuz/tests/test_archive.py 2010-12-08 11:53:56 +0000
104@@ -1490,3 +1490,18 @@
105 main_comp = getUtility(IComponentSet)['main']
106 self.assertEquals(
107 [main_comp], list(archive.getComponentsForSeries(self.series)))
108+
109+
110+class TestGetPockets(TestCaseWithFactory):
111+
112+ layer = DatabaseFunctionalLayer
113+
114+ def test_getPockets_for_other_archives(self):
115+ archive = self.factory.makeArchive(purpose=ArchivePurpose.PRIMARY)
116+ self.assertEqual(
117+ list(PackagePublishingPocket.items), archive.getPockets())
118+
119+ def test_getPockets_for_PPAs(self):
120+ archive = self.factory.makeArchive(purpose=ArchivePurpose.PPA)
121+ self.assertEqual(
122+ [PackagePublishingPocket.RELEASE], archive.getPockets())