Merge ~cjwatson/launchpad:soss-source-url-deb into launchpad:master

Proposed by Colin Watson
Status: Merged
Approved by: Colin Watson
Approved revision: 1d16aba7f2c87b5074f888d8f001d72ad511bd15
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~cjwatson/launchpad:soss-source-url-deb
Merge into: launchpad:master
Diff against target: 72 lines (+29/-0)
2 files modified
lib/lp/archivepublisher/artifactory.py (+17/-0)
lib/lp/archivepublisher/tests/test_artifactory.py (+12/-0)
Reviewer Review Type Date Requested Status
Jürgen Gmach Approve
Review via email: mp+435284@code.launchpad.net

Commit message

Add soss.source_url property to Debian binaries in Artifactory

Description of the change

We agreed this in https://docs.google.com/spreadsheets/d/15Xkdi-CRu2NiQfLoclP5PKW63Zw6syiuao8VJG7zxvw some time ago in order to make it easier to build automation around Artifactory, but I managed to forget about it. Fortunately it's relatively straightforward, since .dsc file names are predictable given the source name and version.

To post a comment you must log in.
Revision history for this message
Jürgen Gmach (jugmac00) :
review: Approve
Revision history for this message
Colin Watson (cjwatson) :
Revision history for this message
Jürgen Gmach (jugmac00) :
3550818... by Colin Watson

Add an example URL in a comment

Revision history for this message
Colin Watson (cjwatson) :

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/lib/lp/archivepublisher/artifactory.py b/lib/lp/archivepublisher/artifactory.py
2index b0fd664..c8b74e6 100644
3--- a/lib/lp/archivepublisher/artifactory.py
4+++ b/lib/lp/archivepublisher/artifactory.py
5@@ -22,6 +22,7 @@ from packaging import utils as packaging_utils
6 from zope.security.proxy import isinstance as zope_isinstance
7
8 from lp.archivepublisher.diskpool import FileAddActionEnum, poolify
9+from lp.archiveuploader.utils import re_no_epoch
10 from lp.registry.interfaces.sourcepackage import SourcePackageFileType
11 from lp.services.config import config
12 from lp.services.librarian.utils import copy_and_close
13@@ -263,6 +264,22 @@ class ArtifactoryPoolEntry:
14 "/usr/share/doc/%s/copyright"
15 % publications[0].binary_package_name
16 ]
17+ # Point to the corresponding .dsc, so that binaries
18+ # uniformly have a property referring to their source
19+ # code. We don't have the .dsc conveniently in hand
20+ # here without a cumbersome database walk, but
21+ # fortunately it has a predictable file name, e.g.
22+ # {base_url}/{repository}/pool/f/foo/foo_1.0-1.dsc.
23+ properties["soss.source_url"] = [
24+ (
25+ self.rootpath
26+ / poolify(self.source_name)
27+ / "{}_{}.dsc".format(
28+ self.source_name,
29+ re_no_epoch.sub("", self.source_version),
30+ )
31+ ).as_posix()
32+ ]
33 else:
34 properties["launchpad.channel"] = sorted(
35 {
36diff --git a/lib/lp/archivepublisher/tests/test_artifactory.py b/lib/lp/archivepublisher/tests/test_artifactory.py
37index 924d12c..c978e3d 100644
38--- a/lib/lp/archivepublisher/tests/test_artifactory.py
39+++ b/lib/lp/archivepublisher/tests/test_artifactory.py
40@@ -623,6 +623,10 @@ class TestArtifactoryPoolFromLibrarian(TestCaseWithFactory):
41 "deb.component": ["main"],
42 "deb.architecture": [processor.name],
43 "soss.license": ["/usr/share/doc/foo/copyright"],
44+ "soss.source_url": [
45+ "https://foo.example.com/artifactory/repository/"
46+ "pool/f/foo/foo_1.0.dsc"
47+ ],
48 "soss.type": ["binary"],
49 },
50 path.properties,
51@@ -695,6 +699,10 @@ class TestArtifactoryPoolFromLibrarian(TestCaseWithFactory):
52 sorted(das.architecturetag for das in dases)
53 ),
54 "soss.license": ["/usr/share/doc/foo/copyright"],
55+ "soss.source_url": [
56+ "https://foo.example.com/artifactory/repository/"
57+ "pool/f/foo/foo_1.0.dsc"
58+ ],
59 "soss.type": ["binary"],
60 },
61 path.properties,
62@@ -1435,6 +1443,10 @@ class TestArtifactoryPoolFromLibrarian(TestCaseWithFactory):
63 "deb.architecture": [das.architecturetag],
64 "deb.version": ["1.0"],
65 "soss.license": ["/usr/share/doc/foo/copyright"],
66+ "soss.source_url": [
67+ "https://foo.example.com/artifactory/repository/"
68+ "pool/f/foo/foo_1.0.dsc"
69+ ],
70 "soss.type": ["binary"],
71 },
72 path.properties,

Subscribers

People subscribed via source and target branches

to status/vote changes: