Skip to content

Commit

Permalink
Add support for "archive/refs/tags/" github URLs in url2purl #47
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Druez <[email protected]>
  • Loading branch information
tdruez committed Oct 4, 2021
1 parent 291e11b commit 78b6e38
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ install::

run tests::

bin/py.test -vvs
bin/py.test tests


Make a new release
Expand Down
3 changes: 2 additions & 1 deletion src/packageurl/contrib/url2purl.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,8 @@ def build_github_purl(url):
# https://github.com/nexB/scancode-toolkit/archive/v3.1.1.zip
archive_pattern = (
r"https?://github.com/(?P<namespace>.+)/(?P<name>.+)"
r"/archive/v?(?P<version>.+).(zip|tar.gz|tar.bz2|.tgz)"
r"/archive/(refs/tags/)?"
r"v?(?P<version>.+).(zip|tar.gz|tar.bz2|.tgz)"
)

# https://github.com/pypa/get-virtualenv/raw/20.0.31/public/virtualenv.pyz
Expand Down
1 change: 1 addition & 0 deletions tests/contrib/data/url2purl.json
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@
"https://github.com/grnet/synnefo/archive/synnefo/v0.12.3.zip": "pkg:github/grnet/synnefo@synnefo/v0.12.3",
"https://github.com/n8n-io/n8n/archive/[email protected]": "pkg:github/n8n-io/n8n@n8n%400.23.0",
"https://github.com/nginx/nginx/archive/branches/stable-0.7.zip": "pkg:github/nginx/nginx@branches/stable-0.7",
"https://github.com/swagger-api/swagger-codegen/archive/refs/tags/v3.0.25.tar.gz": "pkg:github/swagger-api/[email protected]",

"https://bitbucket.org/TG1999/first_repo/src/qa/": "pkg:bitbucket/tg1999/first_repo@qa",
"https://bitbucket.org/TG1999/first_repo/src/QA/": "pkg:bitbucket/tg1999/first_repo@QA",
Expand Down

0 comments on commit 78b6e38

Please sign in to comment.