Skip to content

Extend url2purl/purl2url coverage for Git-based source hosts#223

Open
ziadhany wants to merge 12 commits intopackage-url:mainfrom
ziadhany:url2purl
Open

Extend url2purl/purl2url coverage for Git-based source hosts#223
ziadhany wants to merge 12 commits intopackage-url:mainfrom
ziadhany:url2purl

Conversation

@ziadhany
Copy link
Contributor

@ziadhany ziadhany commented Feb 10, 2026

Currently, many fix-commit URLs are not converted to PURLs during collection. Adding support for these URLs would ensure more accurate url2purl and purl2url conversions, as well as generating commit and patch URLs from PURLs.

  • git.kernel.org cgit /repo/commit/?id=HASH
  • gcc.gnu.org Gitweb /?p=repo.git;a=commit;h=HASH
  • sourceforge.net Apache Allura /p/project/repo/ci/HASH/
  • googlesource.com Gitiles /repo/+/HASH
  • codeberg.org / gitea.com gitea / forgejo commit/{HASH}"
  • gitlab-sub gitlab.gnome.org
  • github
  • gitlab
  • bitbucket

Related issue:

Signed-off-by: ziad hany <ziadhany2016@gmail.com>
Signed-off-by: ziad hany <ziadhany2016@gmail.com>
Add more tests

Signed-off-by: ziad hany <ziadhany2016@gmail.com>
Signed-off-by: ziad hany <ziadhany2016@gmail.com>
Add more test

Signed-off-by: ziad hany <ziadhany2016@gmail.com>
Add a test

Signed-off-by: ziad hany <ziadhany2016@gmail.com>
Add a test

Signed-off-by: ziad hany <ziadhany2016@gmail.com>
Signed-off-by: ziad hany <ziadhany2016@gmail.com>
ziadhany added 2 commits March 5, 2026 03:41
Add support for gitbox.apache.org

Signed-off-by: ziad hany <ziadhany2016@gmail.com>
Signed-off-by: ziad hany <ziadhany2016@gmail.com>
@ziadhany
Copy link
Contributor Author

ziadhany commented Mar 5, 2026

@TG1999 @keshav-space This PR is ready for review!. Take a look whenever you have a chance.

commit_match = re.search(gitea_commit_pattern, url)
if commit_match:
return PackageURL(
type="generic",
Copy link
Member

Choose a reason for hiding this comment

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

We need a Forgejo PURL! @johnmhoran

return None

return PackageURL(
type="generic",
Copy link
Member

Choose a reason for hiding this comment

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

There is in emerging git PURL for that from @darakian


if match := re.search(kernel_shorthand, url):
res = match.groupdict()
namespace = "git.kernel.org/pub/scm/linux/kernel/git/stable/"
Copy link
Member

Choose a reason for hiding this comment

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

This needs thinking and there is a emerging PURL registry that will cater to the kernel needs.

match = re.search(gitiles_project_pattern, url)
if match:
return PackageURL(
type="generic",
Copy link
Member

Choose a reason for hiding this comment

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

Likely also a candidate for the new git PURL type

commit_match = re.search(allura_pattern, url)
if commit_match:
return PackageURL(
type="generic",
Copy link
Member

Choose a reason for hiding this comment

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

We may have a sourceforge type? Or this is for a git type

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.

Looking great ... we need some PURL type refinements.

…t repositories.

Treat GitLab subdomains as GitLab when using the repository URL instead of a generic type.

Add support for salsa.debian.org, gitlab.eclipse.org, forge.fedoraproject.org domains

Signed-off-by: ziad hany <ziadhany2016@gmail.com>
Signed-off-by: ziad hany <ziadhany2016@gmail.com>
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