Skip to content

Commit

Permalink
Revert "Capture the whole git tag as the version for GutHub URL in ur…
Browse files Browse the repository at this point in the history
…l2purl (package-url#159)"

This reverts commit dd33e2d.
  • Loading branch information
jloehel committed Sep 10, 2024
1 parent e5b1223 commit 7118af9
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
1 change: 0 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ Changelog

0.16.0 (unreleased)
-------------------

- Drop support for Python 3.7.
https://github.com/package-url/packageurl-python/issues/160

Expand Down
1 change: 1 addition & 0 deletions src/packageurl/contrib/django/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
from packageurl import PackageURL
from packageurl.contrib.django.utils import purl_to_lookups


PACKAGE_URL_FIELDS = ("type", "namespace", "name", "version", "qualifiers", "subpath")


Expand Down
8 changes: 4 additions & 4 deletions src/packageurl/contrib/url2purl.py
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ def build_github_api_purl(url):
github_codeload_pattern = (
r"https?://codeload.github.com/(?P<namespace>.+)/(?P<name>.+)/"
r"(zip|tar.gz|tar.bz2|tgz)/(.*/)*"
r"(?P<version>.+)$"
r"(?P<version_prefix>v|V?)(?P<version>.+)$"
)

register_pattern("github", github_codeload_pattern)
Expand All @@ -619,13 +619,13 @@ def build_github_purl(url):
download_pattern = (
r"https?://github.com/downloads/(?P<namespace>.+)/(?P<name>.+)/"
r"((?P=name)(-|@)?)?"
r"(?P<version>.+).(zip|tar.gz|tar.bz2|.tgz)"
r"(?P<version_prefix>v|V?)(?P<version>.+).(zip|tar.gz|tar.bz2|.tgz)"
)

# https://github.com/pypa/get-virtualenv/raw/20.0.31/public/virtualenv.pyz
raw_pattern = (
r"https?://github.com/(?P<namespace>.+)/(?P<name>.+)"
r"/raw/(?P<version>[^/]+)/(?P<subpath>.*)$"
r"/raw/(?P<version_prefix>v|V?)(?P<version>[^/]+)/(?P<subpath>.*)$"
)

# https://github.com/fanf2/unifdef/blob/master/unifdef.c
Expand All @@ -636,7 +636,7 @@ def build_github_purl(url):

releases_download_pattern = (
r"https?://github.com/(?P<namespace>.+)/(?P<name>.+)"
r"/releases/download/(?P<version>[^/]+)/.*$"
r"/releases/download/(?P<version_prefix>v|V?)(?P<version>[^/]+)/.*$"
)

releases_tag_pattern = (
Expand Down
18 changes: 9 additions & 9 deletions tests/contrib/data/url2purl.json
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@
"https://github.com/TG1999/fetchcode/fetchcode/src": "pkg:github/tg1999/fetchcode@fetchcode#src",
"https://github.com/NEXB/SCANCODE-TOOLKIT/tree/develop/PLUGINS/scancode-ctags-macosx_10_9_intel": "pkg:github/nexb/scancode-toolkit@develop#PLUGINS/scancode-ctags-macosx_10_9_intel",
"https://github.com/NEXB/SCANCODE-TOOLKIT/tree/DEVELOP/PLUGINS/scancode-ctags-macosx_10_9_intel": "pkg:github/nexb/scancode-toolkit@DEVELOP#PLUGINS/scancode-ctags-macosx_10_9_intel",
"https://github.com/apache/nifi/archive/refs/tags/rel/nifi-2.0.0-M3.tar.gz": "pkg:github/apache/nifi@rel/nifi-2.0.0-M3",
"https://github.com/apache/nifi/archive/refs/tags/rel/nifi-2.0.0-M3.tar.gz": "pkg:github/apache/[email protected]?version_prefix=rel/nifi-",
"https://raw.githubusercontent.com/volatilityfoundation/dwarf2json/master/LICENSE.txt": "pkg:github/volatilityfoundation/dwarf2json@master#LICENSE.txt",
"https://raw.githubusercontent.com/LeZuse/flex-sdk/master/frameworks/projects/mx/src/mx/containers/accordionClasses/AccordionHeader.as": "pkg:github/lezuse/flex-sdk@master#frameworks/projects/mx/src/mx/containers/accordionClasses/AccordionHeader.as",
"https://raw.githubusercontent.com/NCIP/lexevs/master/lgSharedLibraries/jettison/jettison-1.1.jar": "pkg:github/ncip/lexevs@master#lgSharedLibraries/jettison/jettison-1.1.jar",
Expand All @@ -203,23 +203,23 @@
"https://api.github.com/repos/nexB/scancode-toolkit": "pkg:github/nexb/scancode-toolkit",
"https://api.github.com/repos/nexB/scancode-toolkit/commits/40593af0df6c8378d2b180324b97cb439fa11d66": "pkg:github/nexb/scancode-toolkit@40593af0df6c8378d2b180324b97cb439fa11d66",
"https://codeload.github.com/nexB/scancode-toolkit/tar.gz/3.1.1": "pkg:github/nexb/[email protected]",
"https://codeload.github.com/nexB/scancode-toolkit/tar.gz/v3.1.1": "pkg:github/nexb/scancode-toolkit@v3.1.1",
"https://codeload.github.com/nexB/scancode-toolkit/tar.gz/v3.1.1": "pkg:github/nexb/scancode-toolkit@3.1.1?version_prefix=v",
"https://codeload.github.com/nexB/scancode-toolkit/zip/3.1.1": "pkg:github/nexb/[email protected]",
"https://codeload.github.com/nexB/scancode-toolkit/zip/v3.1.1": "pkg:github/nexb/scancode-toolkit@v3.1.1",
"https://codeload.github.com/nexB/scancode-toolkit/zip/v3.1.1": "pkg:github/nexb/scancode-toolkit@3.1.1?version_prefix=v",
"https://codeload.github.com/nexB/scancode.io/tar.gz/1.0": "pkg:github/nexb/[email protected]",
"https://codeload.github.com/nexB/scancode.io/tar.gz/V1.0": "pkg:github/nexb/scancode.io@V1.0",
"https://codeload.github.com/nexB/scancode.io/tar.gz/V1.0": "pkg:github/nexb/scancode.io@1.0?version_prefix=V",
"https://codeload.github.com/berngp/grails-rest/zip/release/0.7": "pkg:github/berngp/[email protected]",
"https://codeload.github.com/eclipse/m2e-core/zip/releases/1.2/1.2.0.20120903-1050": "pkg:github/eclipse/[email protected]",
"https://github.com/nexB/scancode-toolkit/archive/3.1.1.zip": "pkg:github/nexb/[email protected]",
"https://github.com/nexB/scancode-toolkit/archive/v3.1.1.zip": "pkg:github/nexb/scancode-toolkit@v3.1.1",
"https://github.com/nexB/scancode-toolkit/archive/v3.1.1.zip": "pkg:github/nexb/scancode-toolkit@3.1.1?version_prefix=v",
"https://github.com/pypa/get-virtualenv/raw/20.0.31/public/virtualenv.pyz": "pkg:github/pypa/[email protected]#public/virtualenv.pyz",
"https://github.com/pypa/get-virtualenv/raw/v20.0.31/public/virtualenv.pyz": "pkg:github/pypa/get-virtualenv@v20.0.31#public/virtualenv.pyz",
"https://github.com/pypa/get-virtualenv/raw/v20.0.31/public/virtualenv.pyz": "pkg:github/pypa/get-virtualenv@20.0.31?version_prefix=v#public/virtualenv.pyz",
"https://github.com/fanf2/unifdef/blob/master/unifdef.c": "pkg:github/fanf2/unifdef@master#unifdef.c",
"https://github.com/joebeeson/amazon/blob/master/vendors/aws-sdk/sdk.class.php": "pkg:github/joebeeson/amazon@master#vendors/aws-sdk/sdk.class.php",
"https://github.com/modelfabric/yowl/blob/master/bin/yowl": "pkg:github/modelfabric/yowl@master#bin/yowl",
"https://github.com/syncthing/syncthing/releases/download/v0.14.36/syncthing-source-v0.14.36.tar.gz": "pkg:github/syncthing/syncthing@v0.14.36?download_url=https://github.com/syncthing/syncthing/releases/download/v0.14.36/syncthing-source-v0.14.36.tar.gz",
"https://github.com/torakiki/pdfsam/releases/download/v3.3.2/pdfsam-3.3.2-bin.zip": "pkg:github/torakiki/pdfsam@v3.3.2?download_url=https://github.com/torakiki/pdfsam/releases/download/v3.3.2/pdfsam-3.3.2-bin.zip",
"https://github.com/yarnpkg/yarn/releases/download/v1.3.2/yarn-v1.3.2.tar.gz": "pkg:github/yarnpkg/yarn@v1.3.2?download_url=https://github.com/yarnpkg/yarn/releases/download/v1.3.2/yarn-v1.3.2.tar.gz",
"https://github.com/syncthing/syncthing/releases/download/v0.14.36/syncthing-source-v0.14.36.tar.gz": "pkg:github/syncthing/syncthing@0.14.36?download_url=https://github.com/syncthing/syncthing/releases/download/v0.14.36/syncthing-source-v0.14.36.tar.gz&version_prefix=v",
"https://github.com/torakiki/pdfsam/releases/download/v3.3.2/pdfsam-3.3.2-bin.zip": "pkg:github/torakiki/pdfsam@3.3.2?download_url=https://github.com/torakiki/pdfsam/releases/download/v3.3.2/pdfsam-3.3.2-bin.zip&version_prefix=v",
"https://github.com/yarnpkg/yarn/releases/download/v1.3.2/yarn-v1.3.2.tar.gz": "pkg:github/yarnpkg/yarn@1.3.2?download_url=https://github.com/yarnpkg/yarn/releases/download/v1.3.2/yarn-v1.3.2.tar.gz&version_prefix=v",
"https://github.com/z3APA3A/3proxy/releases/download/0.8.11/3proxy-0.8.11.zip": "pkg:github/z3apa3a/[email protected]?download_url=https://github.com/z3APA3A/3proxy/releases/download/0.8.11/3proxy-0.8.11.zip",
"https://github.com/FasterXML/woodstox/archive/woodstox-core-5.0.2.zip": "pkg:github/fasterxml/[email protected]?version_prefix=woodstox-core-",
"https://github.com/adobe-fonts/source-code-pro/archive/2.030R-ro/1.050R-it.tar.gz": "pkg:github/adobe-fonts/[email protected]/1.050R-it",
Expand Down

0 comments on commit 7118af9

Please sign in to comment.