launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #29674
[Merge] ~cjwatson/launchpad:artifactory-sdist-patterns into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:artifactory-sdist-patterns into launchpad:master.
Commit message:
Add Python sdist patterns to ArtifactoryPool.getArtifactPatterns
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #2006785 in Launchpad itself: "launchpad.channel property not being applied to sdists in soss"
https://bugs.launchpad.net/launchpad/+bug/2006785
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/437217
These (unfortunately) have to be kept in sync with `CIBuildUploadJob`, or else properties won't be applied to all necessary files. I've added comments in both places as a reminder of this.
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:artifactory-sdist-patterns into launchpad:master.
diff --git a/lib/lp/archivepublisher/artifactory.py b/lib/lp/archivepublisher/artifactory.py
index 041e73e..7575b30 100644
--- a/lib/lp/archivepublisher/artifactory.py
+++ b/lib/lp/archivepublisher/artifactory.py
@@ -584,6 +584,11 @@ class ArtifactoryPool:
may be pushed for this repository format. They do not match
indexes.
"""
+ # XXX cjwatson 2023-02-13: The non-Debian patterns here must
+ # currently be kept in sync with the patterns matched by
+ # lp.soyuz.model.archivejob.CIBuildUploadJob._scan*. This is
+ # cumbersome, and it would be helpful if we could somehow ensure
+ # that there's no drift.
if repository_format == ArchiveRepositoryFormat.DEBIAN:
return [
"*.ddeb",
@@ -594,7 +599,11 @@ class ArtifactoryPool:
"*.udeb",
]
elif repository_format == ArchiveRepositoryFormat.PYTHON:
- return ["*.whl"]
+ return [
+ "*.tar.gz",
+ "*.whl",
+ "*.zip",
+ ]
elif repository_format == ArchiveRepositoryFormat.CONDA:
return [
"*.tar.bz2",
diff --git a/lib/lp/archivepublisher/tests/test_artifactory.py b/lib/lp/archivepublisher/tests/test_artifactory.py
index c978e3d..d91898e 100644
--- a/lib/lp/archivepublisher/tests/test_artifactory.py
+++ b/lib/lp/archivepublisher/tests/test_artifactory.py
@@ -259,7 +259,12 @@ class TestArtifactoryPool(TestCase):
def test_getArtifactPatterns_python(self):
pool = self.makePool()
self.assertEqual(
- ["*.whl"], pool.getArtifactPatterns(ArchiveRepositoryFormat.PYTHON)
+ [
+ "*.tar.gz",
+ "*.whl",
+ "*.zip",
+ ],
+ pool.getArtifactPatterns(ArchiveRepositoryFormat.PYTHON),
)
def test_getArtifactPatterns_conda(self):
@@ -338,12 +343,26 @@ class TestArtifactoryPool(TestCase):
pool=pool,
source_name="bar",
source_version="1.0",
+ filename="bar-1.0.tar.gz",
+ release_type=FakeReleaseType.SOURCE,
+ release_id=2,
+ ).addToPool()
+ ArtifactoryPoolTestingFile(
+ pool=pool,
+ source_name="bar",
+ source_version="1.0",
filename="bar-1.0.whl",
release_type=FakeReleaseType.BINARY,
release_id=3,
).addToPool()
self.assertEqual(
{
+ PurePath("bar/1.0/bar-1.0.tar.gz"): {
+ "launchpad.release-id": ["source:2"],
+ "launchpad.source-name": ["bar"],
+ "launchpad.source-version": ["1.0"],
+ "soss.type": ["source"],
+ },
PurePath("bar/1.0/bar-1.0.whl"): {
"launchpad.release-id": ["binary:3"],
"launchpad.source-name": ["bar"],
diff --git a/lib/lp/soyuz/model/archivejob.py b/lib/lp/soyuz/model/archivejob.py
index 50c6b8f..0e9ae4d 100644
--- a/lib/lp/soyuz/model/archivejob.py
+++ b/lib/lp/soyuz/model/archivejob.py
@@ -417,6 +417,12 @@ class CIBuildUploadJob(ArchiveJobDerived):
def target_channel(self):
return self.metadata["target_channel"]
+ # XXX cjwatson 2023-02-13: The patterns in the various _scan* methods here
+ # must currently be kept in sync with the patterns matched by
+ # lp.archivepublisher.artifactory.ArtifactoryPool.getArtifactPatterns.
+ # This is cumbersome, and it would be helpful if we could somehow ensure
+ # that there's no drift.
+
def _scanWheel(
self, report: IRevisionStatusReport, paths: Iterable[Path]
) -> Dict[str, ArtifactMetadata]: