Skip to content

Commit fbff2d3

Browse files
committed
No patch url for allura ( sourceforge.net , forge-allura.apache.org )
Signed-off-by: ziad hany <ziadhany2016@gmail.com>
1 parent dc169d8 commit fbff2d3

2 files changed

Lines changed: 10 additions & 9 deletions

File tree

src/packageurl/contrib/purl2url.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ def build_gitlab_repo_url(purl):
238238
(r"sourceforge\.net", r"forge-allura\.apache\.org"): {
239239
"repo_url": "https://{namespace}/{name}",
240240
"commit_url": "https://{namespace}/{name}/ci/{version}",
241-
"patch_url": "https://{namespace}/{name}/ci/{version}", # FIXME
241+
"patch_url": None, # Can't find a direct patch URL
242242
},
243243
# gitweb
244244
(
@@ -307,7 +307,6 @@ def build_generic_commit_url(purl):
307307
return template_url["commit_url"].format(
308308
namespace=namespace, name=name, version=version
309309
)
310-
return
311310

312311

313312
@patch_router.route("pkg:generic/.*")
@@ -328,8 +327,9 @@ def build_generic_patch_url(purl):
328327
if not re.match(pattern, namespace):
329328
continue
330329

331-
return template_url["patch_url"].format(namespace=namespace, name=name, version=version)
332-
return
330+
patch_template = template_url.get("patch_url")
331+
if patch_template:
332+
return patch_template.format(namespace=namespace, name=name, version=version)
333333

334334

335335
@commit_router.route("pkg:gitlab/.*", "pkg:bitbucket/.*", "pkg:github/.*")

tests/contrib/test_purl2url.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -186,16 +186,17 @@ def test_purl2url_get_patch_url():
186186
"pkg:generic/aomedia.googlesource.com/libavifinfo@43716e9c34d3389b4882fbd1a81c04543ed04fe3": "https://aomedia.googlesource.com/libavifinfo/+/43716e9c34d3389b4882fbd1a81c04543ed04fe3^!?format=TEXT",
187187
"pkg:generic/chromium.googlesource.com/infra/infra@9ad7ef740dc39834a88bf95c69f35f18b8f45543": "https://chromium.googlesource.com/infra/infra/+/9ad7ef740dc39834a88bf95c69f35f18b8f45543^!?format=TEXT",
188188
"pkg:generic/android.googlesource.com/device/generic/vulkan-cereal@240dedcb0fa917b3d2dcc4a9d4c332697c5e48a0": "https://android.googlesource.com/device/generic/vulkan-cereal/+/240dedcb0fa917b3d2dcc4a9d4c332697c5e48a0^!?format=TEXT",
189-
"pkg:generic/sourceforge.net/p/infrarecorder/code@8fab704119ff23691f075f6a281521b6c7d7e55f": "https://sourceforge.net/p/infrarecorder/code/ci/8fab704119ff23691f075f6a281521b6c7d7e55f",
190-
"pkg:generic/sourceforge.net/p/expat/code_git@f0bec73b018caa07d3e75ec8dd967f3785d71bde": "https://sourceforge.net/p/expat/code_git/ci/f0bec73b018caa07d3e75ec8dd967f3785d71bde",
191-
"pkg:generic/forge-allura.apache.org/p/allura/git@674e070e5ca7db7c75cf61d8efd2a3e3e49bd946": "https://forge-allura.apache.org/p/allura/git/ci/674e070e5ca7db7c75cf61d8efd2a3e3e49bd946",
189+
"pkg:generic/sourceforge.net/p/infrarecorder/code@8fab704119ff23691f075f6a281521b6c7d7e55f": None,
190+
"pkg:generic/sourceforge.net/p/expat/code_git@f0bec73b018caa07d3e75ec8dd967f3785d71bde": None,
191+
"pkg:generic/forge-allura.apache.org/p/allura/git@674e070e5ca7db7c75cf61d8efd2a3e3e49bd946": None,
192192
"pkg:generic/gcc.gnu.org/git/gcc@82cc94e5fb69d1c45a386f83798251de5bff9339": "https://gcc.gnu.org/git/?p=gcc.git;a=patch;h=82cc94e5fb69d1c45a386f83798251de5bff9339",
193-
"pkg:generic/git.postgresql.org/gitweb/p/infrarecorder/hamn@4f4fed18770ff15da3c7ab1e81854b75181ab5d0": "https://git.postgresql.org/gitweb/p/infrarecorder/?p=hamn.git;a=patch;h=4f4fed18770ff15da3c7ab1e81854b75181ab5d0"
193+
"pkg:generic/git.postgresql.org/gitweb/p/infrarecorder/hamn@4f4fed18770ff15da3c7ab1e81854b75181ab5d0": "https://git.postgresql.org/gitweb/p/infrarecorder/?p=hamn.git;a=patch;h=4f4fed18770ff15da3c7ab1e81854b75181ab5d0",
194194
}
195195

196196
for purl, url in purls_url.items():
197197
assert url == purl2url.get_patch_url(purl)
198198

199+
199200
def test_purl2url_get_commit_url():
200201
purls_url = {
201202
"pkg:github/aboutcode-org/vulnerablecode@98e516011d6e096e25247b82fc5f196bbeecff10": "https://github.com/aboutcode-org/vulnerablecode/commit/98e516011d6e096e25247b82fc5f196bbeecff10",
@@ -216,7 +217,7 @@ def test_purl2url_get_commit_url():
216217
"pkg:generic/sourceforge.net/p/expat/code_git@f0bec73b018caa07d3e75ec8dd967f3785d71bde": "https://sourceforge.net/p/expat/code_git/ci/f0bec73b018caa07d3e75ec8dd967f3785d71bde",
217218
"pkg:generic/forge-allura.apache.org/p/allura/git@674e070e5ca7db7c75cf61d8efd2a3e3e49bd946": "https://forge-allura.apache.org/p/allura/git/ci/674e070e5ca7db7c75cf61d8efd2a3e3e49bd946",
218219
"pkg:generic/gcc.gnu.org/git/gcc@82cc94e5fb69d1c45a386f83798251de5bff9339": "https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=82cc94e5fb69d1c45a386f83798251de5bff9339",
219-
"pkg:generic/git.postgresql.org/gitweb/p/infrarecorder/hamn@4f4fed18770ff15da3c7ab1e81854b75181ab5d0": "https://git.postgresql.org/gitweb/p/infrarecorder/?p=hamn.git;a=commit;h=4f4fed18770ff15da3c7ab1e81854b75181ab5d0"
220+
"pkg:generic/git.postgresql.org/gitweb/p/infrarecorder/hamn@4f4fed18770ff15da3c7ab1e81854b75181ab5d0": "https://git.postgresql.org/gitweb/p/infrarecorder/?p=hamn.git;a=commit;h=4f4fed18770ff15da3c7ab1e81854b75181ab5d0",
220221
}
221222

222223
for purl, url in purls_url.items():

0 commit comments

Comments
 (0)