launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #22564
[Merge] lp:~cjwatson/launchpad/optimise-built-packages into lp:launchpad
Colin Watson has proposed merging lp:~cjwatson/launchpad/optimise-built-packages into lp:launchpad.
Commit message:
Optimise "Built packages" section of SPPH:+listing-archive-extra.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #1769979 in Launchpad itself: "lp times out for source package pages with some more binary packages"
https://bugs.launchpad.net/launchpad/+bug/1769979
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/optimise-built-packages/+merge/346738
--
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/optimise-built-packages into lp:launchpad.
=== modified file 'lib/lp/soyuz/browser/publishing.py'
--- lib/lp/soyuz/browser/publishing.py 2018-05-11 17:52:37 +0000
+++ lib/lp/soyuz/browser/publishing.py 2018-05-23 13:45:59 +0000
@@ -15,6 +15,7 @@
from operator import attrgetter
from lazr.delegates import delegate_to
+from zope.component import getUtility
from zope.interface import implementer
from lp.archiveuploader.utils import re_isadeb
@@ -37,6 +38,7 @@
from lp.soyuz.interfaces.packagediff import IPackageDiff
from lp.soyuz.interfaces.publishing import (
IBinaryPackagePublishingHistory,
+ IPublishingSet,
ISourcePackagePublishingHistory,
)
@@ -317,19 +319,9 @@
the binarypackagename is unique (i.e. it ignores the same package
published in more than one place/architecture.)
"""
- results = []
- packagenames = set()
- for pub in self.context.getPublishedBinaries():
- package = pub.binarypackagerelease
- packagename = package.binarypackagename.name
- if packagename not in packagenames:
- entry = {
- "binarypackagename": packagename,
- "summary": package.summary,
- }
- results.append(entry)
- packagenames.add(packagename)
- return results
+ publishing_set = getUtility(IPublishingSet)
+ return publishing_set.getBuiltPackagesSummaryForSourcePublication(
+ self.context)
@cachedproperty
def builds(self):
=== modified file 'lib/lp/soyuz/interfaces/publishing.py'
--- lib/lp/soyuz/interfaces/publishing.py 2016-09-24 06:22:43 +0000
+++ lib/lp/soyuz/interfaces/publishing.py 2018-05-23 13:45:59 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2015 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2018 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Publishing interfaces."""
@@ -1040,6 +1040,15 @@
`BinaryPackageRelease`, `BinaryPackageName`, `DistroArchSeries`)
"""
+ def getBuiltPackagesSummaryForSourcePublication(source_publication):
+ """Return a summary of the built packages for this source publication.
+
+ For each built package from this published source, return a
+ dictionary with keys "binarypackagename" and "summary", where
+ the binarypackagename is unique (i.e. it ignores the same package
+ published in more than one place/architecture.)
+ """
+
def getActiveArchSpecificPublications(sourcepackagerelease, archive,
distroseries, pocket):
"""Find architecture-specific binary publications for a source.
=== modified file 'lib/lp/soyuz/model/publishing.py'
--- lib/lp/soyuz/model/publishing.py 2018-05-04 21:59:32 +0000
+++ lib/lp/soyuz/model/publishing.py 2018-05-23 13:45:59 +0000
@@ -1448,6 +1448,22 @@
return result_set
+ def getBuiltPackagesSummaryForSourcePublication(self, source_publication):
+ """See `IPublishingSet`."""
+ result_set = IStore(BinaryPackageName).find(
+ (BinaryPackageName.name, BinaryPackageRelease.summary,
+ DistroArchSeries.architecturetag,
+ BinaryPackagePublishingHistory.id),
+ self._getSourceBinaryJoinForSources([source_publication.id]))
+ result_set.config(distinct=(BinaryPackageName.name,))
+ result_set.order_by(
+ BinaryPackageName.name,
+ DistroArchSeries.architecturetag,
+ Desc(BinaryPackagePublishingHistory.id))
+ return [
+ {"binarypackagename": name, "summary": summary}
+ for name, summary, _, _ in result_set]
+
def getActiveArchSpecificPublications(self, sourcepackagerelease, archive,
distroseries, pocket):
"""See `IPublishingSet`."""
=== modified file 'lib/lp/soyuz/templates/sourcepackagepublishinghistory-listing-archive-extra.pt'
--- lib/lp/soyuz/templates/sourcepackagepublishinghistory-listing-archive-extra.pt 2010-05-27 22:18:16 +0000
+++ lib/lp/soyuz/templates/sourcepackagepublishinghistory-listing-archive-extra.pt 2018-05-23 13:45:59 +0000
@@ -38,9 +38,11 @@
</li>
</ul>
- <tal:built-packages condition="view/built_packages" omit-tag="">
+ <tal:built-packages
+ define="built_packages view/built_packages"
+ condition="built_packages" omit-tag="">
<h3>Built packages</h3>
- <ul tal:repeat="package view/built_packages"
+ <ul tal:repeat="package built_packages"
style="margin-top: 0; margin-bottom: 0">
<li>
<b><tal:name replace="package/binarypackagename"/></b>
Follow ups