← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:artifactory-deb-properties into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:artifactory-deb-properties into launchpad:master.

Commit message:
Set more Artifactory properties for Debian-format packages

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/425173

`deb.name` and `deb.version` work around Artifactory not really supporting Debian-format source packages yet, providing a bit more uniformity with binary packages.

`soss.license` should eventually be set for everything we publish via Artifactory, but for now just set it for the easy cases of Debian-format packages which have predefined expectations for the path within the package where the license text should live.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:artifactory-deb-properties into launchpad:master.
diff --git a/lib/lp/archivepublisher/artifactory.py b/lib/lp/archivepublisher/artifactory.py
index 3e912ed..585e92b 100644
--- a/lib/lp/archivepublisher/artifactory.py
+++ b/lib/lp/archivepublisher/artifactory.py
@@ -199,6 +199,27 @@ class ArtifactoryPoolEntry:
                 )
                 if architectures:
                     properties["deb.architecture"] = architectures
+                if release_id.startswith("source:"):
+                    # Artifactory doesn't support publishing Sources files
+                    # for Debian-format source packages
+                    # (https://www.jfrog.com/jira/browse/RTFACT-9206), and
+                    # so also doesn't automatically populate name and
+                    # version properties for them.  Partially work around
+                    # this by setting those properties manually (although
+                    # this doesn't cause Sources files to exist).
+                    properties["deb.name"] = self.source_name
+                    properties["deb.version"] = self.source_version
+                    # Debian-format source packages have a license path
+                    # required by policy.
+                    properties["soss.license"] = "debian/copyright"
+                elif release_id.startswith("binary:"):
+                    # Debian-format binary packages have a license path
+                    # required by policy (although examining it may require
+                    # dereferencing symlinks).
+                    properties["soss.license"] = (
+                        "/usr/share/doc/%s/copyright"
+                        % publications[0].binary_package_name
+                    )
             else:
                 properties["launchpad.channel"] = sorted(
                     {
diff --git a/lib/lp/archivepublisher/tests/test_artifactory.py b/lib/lp/archivepublisher/tests/test_artifactory.py
index 3edb76b..ecf2a2f 100644
--- a/lib/lp/archivepublisher/tests/test_artifactory.py
+++ b/lib/lp/archivepublisher/tests/test_artifactory.py
@@ -377,6 +377,9 @@ class TestArtifactoryPoolFromLibrarian(TestCaseWithFactory):
                 "launchpad.source-version": ["1.0"],
                 "deb.distribution": list(sorted(ds.name for ds in dses)),
                 "deb.component": ["main"],
+                "deb.name": [spr.name],
+                "deb.version": [spr.version],
+                "soss.license": ["debian/copyright"],
             },
             path.properties,
         )
@@ -450,6 +453,7 @@ class TestArtifactoryPoolFromLibrarian(TestCaseWithFactory):
                 "deb.distribution": list(sorted(ds.name for ds in dses)),
                 "deb.component": ["main"],
                 "deb.architecture": [processor.name],
+                "soss.license": ["/usr/share/doc/foo/copyright"],
             },
             path.properties,
         )
@@ -519,6 +523,7 @@ class TestArtifactoryPoolFromLibrarian(TestCaseWithFactory):
                 "deb.architecture": list(
                     sorted(das.architecturetag for das in dases)
                 ),
+                "soss.license": ["/usr/share/doc/foo/copyright"],
             },
             path.properties,
         )
@@ -888,6 +893,7 @@ class TestArtifactoryPoolFromLibrarian(TestCaseWithFactory):
                 "deb.component": ["main"],
                 "deb.architecture": [das.architecturetag],
                 "deb.version": ["1.0"],
+                "soss.license": ["/usr/share/doc/foo/copyright"],
             },
             path.properties,
         )
diff --git a/lib/lp/archivepublisher/tests/test_publisher.py b/lib/lp/archivepublisher/tests/test_publisher.py
index 0bdd04b..e823415 100644
--- a/lib/lp/archivepublisher/tests/test_publisher.py
+++ b/lib/lp/archivepublisher/tests/test_publisher.py
@@ -4253,11 +4253,14 @@ class TestArtifactoryPublishing(TestPublisherBase):
             {
                 "deb.component": ["main"],
                 "deb.distribution": ["breezy-autotest"],
+                "deb.name": ["hello"],
+                "deb.version": ["1.0"],
                 "launchpad.release-id": [
                     "source:%d" % source.sourcepackagereleaseID
                 ],
                 "launchpad.source-name": ["hello"],
                 "launchpad.source-version": ["1.0"],
+                "soss.license": ["debian/copyright"],
             },
             source_path.properties,
         )
@@ -4277,6 +4280,7 @@ class TestArtifactoryPublishing(TestPublisherBase):
                 ],
                 "launchpad.source-name": ["hello"],
                 "launchpad.source-version": ["1.0"],
+                "soss.license": ["/usr/share/doc/hello/copyright"],
             },
             binary_path.properties,
         )
@@ -4338,11 +4342,14 @@ class TestArtifactoryPublishing(TestPublisherBase):
             {
                 "deb.component": ["main"],
                 "deb.distribution": ["breezy-autotest", "hoary-test"],
+                "deb.name": ["hello"],
+                "deb.version": ["1.0"],
                 "launchpad.release-id": [
                     "source:%d" % source.sourcepackagereleaseID
                 ],
                 "launchpad.source-name": ["hello"],
                 "launchpad.source-version": ["1.0"],
+                "soss.license": ["debian/copyright"],
             },
             source_path.properties,
         )
@@ -4356,6 +4363,7 @@ class TestArtifactoryPublishing(TestPublisherBase):
                 ],
                 "launchpad.source-name": ["hello"],
                 "launchpad.source-version": ["1.0"],
+                "soss.license": ["/usr/share/doc/hello/copyright"],
             },
             binary_path.properties,
         )
@@ -4409,11 +4417,14 @@ class TestArtifactoryPublishing(TestPublisherBase):
         # included in indexes.
         self.assertEqual(
             {
+                "deb.name": ["hello"],
+                "deb.version": ["1.0"],
                 "launchpad.release-id": [
                     "source:%d" % source.sourcepackagereleaseID
                 ],
                 "launchpad.source-name": ["hello"],
                 "launchpad.source-version": ["1.0"],
+                "soss.license": ["debian/copyright"],
             },
             source_path.properties,
         )
@@ -4424,6 +4435,7 @@ class TestArtifactoryPublishing(TestPublisherBase):
                 ],
                 "launchpad.source-name": ["hello"],
                 "launchpad.source-version": ["1.0"],
+                "soss.license": ["/usr/share/doc/hello/copyright"],
             },
             binary_path.properties,
         )