File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -172,6 +172,23 @@ def build_gitlab_repo_url(purl):
172172 return f"https://gitlab.com/{ namespace } /{ name } "
173173
174174
175+ @repo_router .route ("pkg:generic/.*" )
176+ def build_generic_repo_url (purl ):
177+ """
178+ Return a Generic repo URL from the `purl` string.
179+ """
180+ purl_data = PackageURL .from_string (purl )
181+ name = purl_data .name
182+ namespace = purl_data .namespace
183+ version = purl_data .version
184+ if namespace .startswith ("git.kernel.org" ):
185+ return f"https://{ namespace } /{ name } /commit/?id={ version } "
186+ if namespace .startswith ("android.googlesource.com" ):
187+ return f"https://{ namespace } /{ name } /+/{ version } "
188+ if namespace .startswith ("sourceforge.net" ):
189+ return f"https://{ namespace } /{ name } /ci/{ version } "
190+
191+
175192@repo_router .route ("pkg:(gem|rubygems)/.*" )
176193def build_rubygems_repo_url (purl ):
177194 """
Original file line number Diff line number Diff line change @@ -70,6 +70,10 @@ def test_purl2url_get_repo_url():
7070 "pkg:cocoapods/MapsIndoors@3.24.0" : "https://cocoapods.org/pods/MapsIndoors" ,
7171 "pkg:maven/org.apache.commons/commons-io@1.3.2" : "https://repo.maven.apache.org/maven2/org/apache/commons/commons-io/1.3.2" ,
7272 "pkg:maven/org.apache.commons/commons-io@1.3.2?repository_url=https://repo1.maven.org/maven2" : "https://repo1.maven.org/maven2/org/apache/commons/commons-io/1.3.2" ,
73+ "pkg:generic/git.kernel.org/pub/scm/libs/liba2i/liba2i.git@4fc8196d7811c26abefaf3a3ae6b5c67c4c9cbc9" : "https://git.kernel.org/pub/scm/libs/liba2i/liba2i.git/commit/?id=4fc8196d7811c26abefaf3a3ae6b5c67c4c9cbc9" ,
74+ "pkg:generic/git.kernel.org/pub/scm/linux/kernel/git/a.hindborg/configfs.git@bc3372351d0c8b2726b7d4229b878342e3e6b0e8" : "https://git.kernel.org/pub/scm/linux/kernel/git/a.hindborg/configfs.git/commit/?id=bc3372351d0c8b2726b7d4229b878342e3e6b0e8" ,
75+ "pkg:generic/android.googlesource.com/accessories/manifest@9ad7ef740dc39834a88bf95c69f35f18b8f45543" : "https://android.googlesource.com/accessories/manifest/+/9ad7ef740dc39834a88bf95c69f35f18b8f45543" ,
76+ "pkg:generic/sourceforge.net/p/infrarecorder/code@8fab704119ff23691f075f6a281521b6c7d7e55f" : "https://sourceforge.net/p/infrarecorder/code/ci/8fab704119ff23691f075f6a281521b6c7d7e55f" ,
7377 }
7478
7579 for purl , url in purls_url .items ():
You can’t perform that action at this time.
0 commit comments