launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #24514
[Merge] ~cjwatson/launchpad:built-using-ui into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:built-using-ui into launchpad:master with ~cjwatson/launchpad:built-using-model as a prerequisite.
Commit message:
Show Built-Using references in the web UI
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #1868558 in Launchpad itself: "Honour Built-Using field"
https://bugs.launchpad.net/launchpad/+bug/1868558
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/381237
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:built-using-ui into launchpad:master.
diff --git a/lib/lp/soyuz/browser/binarypackagerelease.py b/lib/lp/soyuz/browser/binarypackagerelease.py
index 74782db..e21110d 100644
--- a/lib/lp/soyuz/browser/binarypackagerelease.py
+++ b/lib/lp/soyuz/browser/binarypackagerelease.py
@@ -1,4 +1,4 @@
-# Copyright 2009-2012 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2020 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
__metaclass__ = type
@@ -9,8 +9,14 @@ __all__ = [
]
from lp.services.webapp import Navigation
-from lp.services.webapp.publisher import LaunchpadView
-from lp.soyuz.browser.packagerelationship import relationship_builder
+from lp.services.webapp.publisher import (
+ canonical_url,
+ LaunchpadView,
+ )
+from lp.soyuz.browser.packagerelationship import (
+ PackageRelationshipSet,
+ relationship_builder,
+ )
from lp.soyuz.interfaces.binarypackagerelease import IBinaryPackageRelease
@@ -55,3 +61,13 @@ class BinaryPackageView(LaunchpadView):
def breaks(self):
return self._relationship_parser(self.context.breaks)
+
+ def built_using(self):
+ relationship_set = PackageRelationshipSet()
+ for reference in self.context.built_using_references:
+ spr = reference.source_package_release
+ sp = spr.upload_distroseries.getSourcePackage(
+ spr.sourcepackagename)
+ sp_url = canonical_url(sp) if sp is not None else None
+ relationship_set.add(spr.name, '=', spr.version, sp_url)
+ return relationship_set
diff --git a/lib/lp/soyuz/browser/configure.zcml b/lib/lp/soyuz/browser/configure.zcml
index 4ab2e41..5aea5bd 100644
--- a/lib/lp/soyuz/browser/configure.zcml
+++ b/lib/lp/soyuz/browser/configure.zcml
@@ -72,6 +72,9 @@
<browser:page
name="+portlet-breaks"
template="../templates/binarypackagerelease-portlet-breaks.pt"/>
+ <browser:page
+ name="+portlet-builtusing"
+ template="../templates/binarypackagerelease-portlet-builtusing.pt"/>
</browser:pages>
<browser:pages
for="lp.soyuz.interfaces.sourcepackagerelease.ISourcePackageRelease"
diff --git a/lib/lp/soyuz/stories/soyuz/xx-binarypackagerelease-index.txt b/lib/lp/soyuz/stories/soyuz/xx-binarypackagerelease-index.txt
index 0919a00..09d9edf 100644
--- a/lib/lp/soyuz/stories/soyuz/xx-binarypackagerelease-index.txt
+++ b/lib/lp/soyuz/stories/soyuz/xx-binarypackagerelease-index.txt
@@ -29,6 +29,18 @@ XXX: noodles 2009-01-16 bug 317863: move this into the STP.
>>> login('foo.bar@xxxxxxxxxxxxx')
>>> build = getUtility(IBinaryPackageBuildSet).getByID(2)
+
+The sample data doesn't have any Built-Using references. For now, just
+manually insert one so that we can check how it's rendered.
+
+ >>> from lp.soyuz.enums import BinarySourceReferenceType
+ >>> from lp.soyuz.interfaces.binarysourcereference import (
+ ... IBinarySourceReferenceSet,
+ ... )
+ >>> bpr = build.getBinaryPackageRelease('mozilla-firefox')
+ >>> _ = getUtility(IBinarySourceReferenceSet).createFromRelationship(
+ ... bpr, 'iceweasel (= 1.0)', BinarySourceReferenceType.BUILT_USING)
+
>>> package_upload = build.distro_series.createQueueEntry(
... PackagePublishingPocket.UPDATES, build.archive,
... 'changes.txt', b'my changes')
@@ -73,11 +85,17 @@ links to a binary in the context in question.
TEXT: "bar"
LINK: "pmount" -> http://launchpad.test/ubuntu/warty/i386/pmount
-
>>> print_relation('breaks')
TEXT: "baz"
LINK: "pmount" -> http://launchpad.test/ubuntu/warty/i386/pmount
+The 'Built-Using' section contains a link to a source in the context in
+question.
+
+ >>> print_relation('builtusing')
+ LINK: "iceweasel (= 1.0)" ->
+ http://launchpad.test/ubuntu/warty/+source/iceweasel
+
'Depends', 'Conflicts', 'Replaces', 'Suggests' and 'Recommends'
sections contain only unsatisfied dependencies, which are rendered as
diff --git a/lib/lp/soyuz/templates/binarypackagerelease-portlet-builtusing.pt b/lib/lp/soyuz/templates/binarypackagerelease-portlet-builtusing.pt
new file mode 100644
index 0000000..08645f4
--- /dev/null
+++ b/lib/lp/soyuz/templates/binarypackagerelease-portlet-builtusing.pt
@@ -0,0 +1,14 @@
+<div
+ xmlns:tal="http://xml.zope.org/namespaces/tal"
+ xmlns:metal="http://xml.zope.org/namespaces/metal"
+ xmlns:i18n="http://xml.zope.org/namespaces/i18n"
+ tal:define="relationships view/built_using"
+ tal:condition="relationships/has_items"
+ class="first yui-u" id="portlet-builtusing">
+
+ <dl id="builtusing">
+ <dt>Built-Using:</dt>
+ <tal:block replace="structure relationships/@@+render-list"/>
+ </dl>
+
+</div>
diff --git a/lib/lp/soyuz/templates/distroarchseriesbinarypackagerelease-index.pt b/lib/lp/soyuz/templates/distroarchseriesbinarypackagerelease-index.pt
index d5a97b1..a9586c1 100644
--- a/lib/lp/soyuz/templates/distroarchseriesbinarypackagerelease-index.pt
+++ b/lib/lp/soyuz/templates/distroarchseriesbinarypackagerelease-index.pt
@@ -87,6 +87,7 @@
<div tal:replace="structure bpr/@@+portlet-predepends" />
<div tal:replace="structure bpr/@@+portlet-enhances" />
<div tal:replace="structure bpr/@@+portlet-breaks" />
+ <div tal:replace="structure bpr/@@+portlet-builtusing" />
</div><!--portlet-->
</div><!--yui-g-->
diff --git a/lib/lp/soyuz/tests/test_publishing.py b/lib/lp/soyuz/tests/test_publishing.py
index cd7d1ea..af4ae5f 100644
--- a/lib/lp/soyuz/tests/test_publishing.py
+++ b/lib/lp/soyuz/tests/test_publishing.py
@@ -38,9 +38,13 @@ from lp.services.log.logger import DevNullLogger
from lp.soyuz.enums import (
ArchivePurpose,
BinaryPackageFormat,
+ BinarySourceReferenceType,
PackageUploadStatus,
)
from lp.soyuz.interfaces.binarypackagename import IBinaryPackageNameSet
+from lp.soyuz.interfaces.binarysourcereference import (
+ IBinarySourceReferenceSet,
+ )
from lp.soyuz.interfaces.component import IComponentSet
from lp.soyuz.interfaces.publishing import (
active_publishing_status,