Skip to content

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

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

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

Conversation

@ziadhany
Copy link
Contributor

@ziadhany ziadhany commented Feb 10, 2026

Currently, many fix-commit URLs are not being converted to PURLs during collection. It would be great to add support for these URLs to ensure accurate url2purl and purl2url conversions.

  • 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

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.

},
# sub gitlab ( excludes gitlab.com )
(
r"git\.codelinaro\.org.*",
Copy link
Member

Choose a reason for hiding this comment

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

Add salsa for Debian projects https://salsa.debian.org/public and https://gitlab.eclipse.org for Eclipse

# gitea / forgejo
(
r"codeberg\.org",
r"gitea\.com",
Copy link
Member

Choose a reason for hiding this comment

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

commit_match = re.search(gitlab_sub_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.

If this is GitLab-based it should be a gitlab PURL with a repository_url qualifier

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.

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