-
Notifications
You must be signed in to change notification settings - Fork 34
add on demand package data collection for golang #596 #608
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
add on demand package data collection for golang #596 #608
Conversation
… golang Signed-off-by: Chin Yeung Li <tli@nexb.com>
… of test code that will need to be removed). Signed-off-by: Chin Yeung Li <tli@nexb.com>
``` pkg:golang/github.com/* pkg:golang/gitlab.com/* pkg:golang/bitbucket.org/* ``` Signed-off-by: Chin Yeung Li <tli@nexb.com>
Signed-off-by: Chin Yeung Li <tli@nexb.com>
* Collect metadata from API for the following "namespace" ``` pkg:golang/github.com/* pkg:golang/gitlab.com/* pkg:golang/bitbucket.org/* ``` * Add tests * Add "golang" in the "supported_ecosystems" list in the api.py Signed-off-by: Chin Yeung Li <tli@nexb.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chinyeungli I am looking at https://github.com/package-url/purl-spec/blob/main/PURL-SPECIFICATION.rst#rules-for-each-purl-component and I am not sure if we can add gitlab.com in the package namespace otherwise, the code looks good.
@@ -116,6 +116,9 @@ def map_fetchcode_supported_package(package_url, pipelines, priority=0): | |||
logger.error(error) | |||
return error | |||
|
|||
if from_go_lang: | |||
packages[0].type = "golang" | |||
packages[0].namespace = "github.com/" + packages[0].namespace |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chinyeungli could there be golang packages not from github?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Only golang packages from github use this map_fetchcode_supported_package
function.
Others will use map_golang_package()
version = "" | ||
if "@" in purl_str: | ||
version = purl_str.rpartition("@")[2] | ||
subset = purl_str.partition("pkg:golang/gitlab.com/")[2].partition("@")[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pombredanne https://github.com/package-url/purl-spec/blob/main/PURL-SPECIFICATION.rst#rules-for-each-purl-component
Does this mean we cannot have things like gitlab.com in the namespace field?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI, this is about getting the subset and version from a purl str that then pass to https://github.com/aboutcode-org/purldb/blob/596_add_on-demand_package_data_collection_for_golang/minecode/collectors/golang.py#L253
Signed-off-by: Chin Yeung Li <tli@nexb.com> Co-authored-by: Jono Yang <JonoYang@users.noreply.github.com>
No description provided.