Skip to content

Commit ebf8667

Browse files
committed
chore: fix type qualifier for java-source artifacts and add comment clarifying support for qualifiers
Signed-off-by: Nathan Nguyen <[email protected]>
1 parent 1fbe7ec commit ebf8667

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/macaron/artifact/maven.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@ class MavenArtifactType(_MavenArtifactType, Enum):
3131
For reference, see:
3232
- https://maven.apache.org/ref/3.9.6/maven-core/artifact-handlers.html
3333
- https://github.com/package-url/purl-spec/blob/master/PURL-TYPES.rst#maven
34+
35+
Note: For the time being, we are only supporting the ``"type"`` qualifier, although the
36+
Maven section in the PackageURL docs also mention the ``"classifier"`` qualifier.
37+
This is because not all artifact types has a unique value of ``"classifier"`` according
38+
to the Artifact Handlers table in the Maven Core reference. In addition, not supporting
39+
the ``"classifier"`` qualifier at the moment simplifies the implementation for PURL
40+
decoding and generation until there is a concrete use case for this additional qualifier.
3441
"""
3542

3643
# Enum with custom value type.
@@ -49,7 +56,7 @@ class MavenArtifactType(_MavenArtifactType, Enum):
4956
)
5057
JAVA_SOURCE = _MavenArtifactType(
5158
filename_pattern="{artifact_id}-{version}-sources.jar",
52-
purl_qualifiers={"type": "sources"},
59+
purl_qualifiers={"type": "java-source"},
5360
)
5461

5562

tests/artifact/test_maven.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
id="purl for javadoc artifact",
3535
),
3636
pytest.param(
37-
"pkg:maven/com.fasterxml.jackson/[email protected]?type=sources",
37+
"pkg:maven/com.fasterxml.jackson/[email protected]?type=java-source",
3838
MavenArtifact(
3939
group_id="com.fasterxml.jackson",
4040
artifact_id="jackson-annotations",
@@ -140,7 +140,7 @@ def test_maven_artifact_from_artifact_name(params: dict, maven_artifact: MavenAr
140140
id="purl for javadoc artifact",
141141
),
142142
pytest.param(
143-
"pkg:maven/com.fasterxml.jackson/[email protected]?type=sources",
143+
"pkg:maven/com.fasterxml.jackson/[email protected]?type=java-source",
144144
2,
145145
id="purl for java source artifact",
146146
),

0 commit comments

Comments
 (0)