Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Maven support for purl2url #177

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

fafanoulele
Copy link

Add Maven support e.g.:

> purl2url.get_repo_url("pkg:maven/org.apache.commons/[email protected]")
"https://repo1.maven.org/maven2/org/apache/commons/commons-io/1.3.2"

> purl2url.get_download_url("pkg:maven/org.apache.commons/[email protected]")
"https://repo1.maven.org/maven2/org/apache/commons/commons-io/1.3.2/commons-io-1.3.2.jar"

@pombredanne
Copy link
Member

@fafanoulele Thanks. The thing may be a bit more complex for JARs because of the many "artefacts" available for a given version....

@pombredanne
Copy link
Member

See also #179 (comment)

Copy link
Member

@pombredanne pombredanne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. Here is some feedback for your consideration.

name = purl_data.name
version = purl_data.version

base_url = "https://repo1.maven.org/maven2"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you handle the case with a repository_url qualifier that would override the default?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added support of repository_url cf. 2bc0cb9

@pombredanne
Copy link
Member

You may also want to check this by @robertguetzkow aboutcode-org/dejacode#256 (comment)

I would also suggest using resolved URLs as the basis when they are already included in the SBOM and identifiable, instead of relying on purl2url which might not work for every package manager.

@fafanoulele
Copy link
Author

@fafanoulele Thanks. The thing may be a bit more complex for JARs because of the many "artefacts" available for a given version....

I've added support for type and classifier as qualifiers e.g.:

> purl2url.get_download_url("pkg:maven/org.apache.commons/[email protected]?type=pom")
"https://repo1.maven.org/maven2/org/apache/commons/commons-io/1.3.2/commons-io-1.3.2.pom"

> purl2url.get_download_url("pkg:maven/org.apache.commons/[email protected]?classifier=arbitrary")
"https://repo1.maven.org/maven2/org/apache/commons/commons-io/1.3.2/commons-io-1.3.2-arbitrary.jar"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants