Matching for a specific ecosystem and without matching itself - #905
Open
chinyeungli wants to merge 3 commits into
Open
Matching for a specific ecosystem and without matching itself#905chinyeungli wants to merge 3 commits into
chinyeungli wants to merge 3 commits into
Conversation
Signed-off-by: Chin Yeung Li <tli@nexb.com>
* Implement the ecosystems (only "maven" at the moment) and exclude_purls fields * Add tests Signed-off-by: Chin Yeung Li <tli@nexb.com>
Signed-off-by: Chin Yeung Li <tli@nexb.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reference: #632
As PurlDB is not a scanner itself, it should not support taking a PURL as input and then performing fetching, extracting, or scanning for matching. Instead, this PR will stick with the current design, where matching is run against the input of a scanned JSON file produced by ScanCode Toolkit or ScanCode.io.
This PR introduces two new fields: ecosystems and exclude_purls.

With the ecosystems field, matching takes place only within the defined ecosystem. This speeds up the process since it avoids matching against packages from other ecosystems.
With the exclude_purls field, users can specify packages to exclude from matching, preventing a package from being matched against itself.
Sample Inputs
Indexed:
pkg:maven/commons-io/commons-io@2.11.0andpkg:github/nexb/aboutcode-toolkit@v11.1.1Input: info scan of commons-io and aboutcode-toolkit (
commons-io-2.11.0.jar-extract-i.jsonandaboutcode_toolkit-11.1.1-i.json)Runs
Verify matching for maven
File:
commons-io-2.11.0.jar-extract-i.jsonFilters: No
Result:
Conclusion:
The match success.
Verify exclude purls filter
File:
commons-io-2.11.0.jar-extract-i.jsonFilters: exclude_purls_filter=
pkg:maven/commons-io/commons-io@2.11.0Result:
Conclusion:
There is no match result because the
pkg:maven/commons-io/commons-io@2.11.0is excluded from the matching.Verify matching for pypi
File:
aboutcode_toolkit-11.1.1-i.jsonFilters: No
Result:
Conclusion:
The match success.
Verify ecosystem filter
File:
aboutcode_toolkit-11.1.1-i.jsonFilters: ecosystems_filter=maven
Result:
Conclusion:
No match because it strictly limited matching to maven package only.