Skip to content
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

feat: enable repo finder to support more languages via Open Source Insights #388

Merged
merged 31 commits into from
Sep 21, 2023

Conversation

benmss
Copy link
Member

@benmss benmss commented Jul 28, 2023

The repo finder is refactored to:

  • be usable from anywhere within Macaron
  • accept a PURL string as input
  • support more languages via Open Source Insights (deps.dev)

Added languages include: Python, NodeJS, .Net, Rust.
Note that these additions won't do anything until dependency analysers for these languages are added.

Use of Open Source Insights can be disabled via a configuration value.

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Jul 28, 2023
@benmss benmss changed the base branch from main to staging July 28, 2023 02:08
@benmss benmss changed the title Repo finder refactor feat: enable repo finder to support more languages via Open Source Insights Jul 28, 2023
@benmss benmss marked this pull request as ready for review July 28, 2023 02:58
@benmss benmss requested review from behnazh-w and tromai as code owners July 28, 2023 02:58
@behnazh-w behnazh-w requested a review from nicallen July 30, 2023 22:14
src/macaron/repo_finder/repo_finder_dd.py Outdated Show resolved Hide resolved
src/macaron/repo_finder/repo_finder_dd.py Outdated Show resolved Hide resolved
src/macaron/__main__.py Outdated Show resolved Hide resolved
src/macaron/__main__.py Outdated Show resolved Hide resolved
@benmss benmss linked an issue Aug 23, 2023 that may be closed by this pull request
@benmss benmss added the repository_finder The issues related to the repository finder label Aug 23, 2023
@benmss benmss force-pushed the repo-finder-refactor branch 3 times, most recently from f7fadaa to 57d13c9 Compare August 31, 2023 02:07
@benmss benmss requested a review from nathanwn August 31, 2023 06:36
src/macaron/dependency_analyzer/cyclonedx.py Outdated Show resolved Hide resolved
@@ -31,9 +29,13 @@ class DependencyTools(str, Enum):
class DependencyInfo(TypedDict):
"""The information of a resolved dependency."""

version: str
group: str
scheme: str
Copy link
Member

@behnazh-w behnazh-w Aug 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of duplicating the PURL spec here, wouldn't it be better to store the PURL string directly, which will be parsed using the packageurl module later before analyzing the dependency?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we store the PURL string as well as the old information (in their fields), we have duplicates. If we don't keep the old information, we have to create the PURL from the string every time we want to extract any information from it. Perhaps storing the actual PURL would make the most sense?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with the option of storing the actual PURL object.

Copy link
Member

@behnazh-w behnazh-w Sep 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Storing a PackageURL object sounds good to me.

Signed-off-by: Ben Selwyn-Smith <[email protected]>
- Moved dependency resolution functions to dependency_resolver.py
- Moved find_valid_url to repo_finder to avoid circular dependencies
- Added URL for deps.dev API documentation as comment

Signed-off-by: Ben Selwyn-Smith <[email protected]>
… use with Repo Finder.

Signed-off-by: Ben Selwyn-Smith <[email protected]>
Signed-off-by: Ben Selwyn-Smith <[email protected]>
Signed-off-by: Ben Selwyn-Smith <[email protected]>
… string replacement in java repo finder

Signed-off-by: Ben Selwyn-Smith <[email protected]>
Signed-off-by: Ben Selwyn-Smith <[email protected]>
Signed-off-by: Ben Selwyn-Smith <[email protected]>
Signed-off-by: Ben Selwyn-Smith <[email protected]>
Signed-off-by: Ben Selwyn-Smith <[email protected]>
Signed-off-by: Ben Selwyn-Smith <[email protected]>
@benmss benmss force-pushed the repo-finder-refactor branch from a8ccd34 to bca62d5 Compare September 21, 2023 04:38
Signed-off-by: Ben Selwyn-Smith <[email protected]>
@benmss benmss merged commit bf118b3 into staging Sep 21, 2023
9 checks passed
@tromai tromai deleted the repo-finder-refactor branch September 21, 2023 23:45
tromai added a commit that referenced this pull request Sep 23, 2023
These changes were to separate the resolving dependencies using SBOM generator and resolving dependencies
from SBOM files. These changes were necessary for this PR back when I first work on it (before the merging
of #388). However, after #388 is merged and further discussion, this change is no longer necessary.

Signed-off-by: Trong Nhan Mai <[email protected]>
art1f1c3R pushed a commit that referenced this pull request Nov 29, 2024
…sights (#388)

This feature modifies the Repo Finder, so that it can: be usable from anywhere within Macaron; accept PURL strings as input; and, support more languages via Google's Open Source Insights (deps.dev)

This enables Macaron to accept artifact PURLs as input, whereby the Repo Finder will be used to attempt to retrieve the related repository. 

Additional languages include those supported by deps.dev: Python, NodeJS, .Net, and Rust. Note that currently these will only work when specifying an artifact PURL as input, or providing an SBOM. Full support for these extra languages will require the addition of new dependency analyzers.

A new config option is also provided to disable API calls to Google's Open Source Insights, if desired.

Signed-off-by: Ben Selwyn-Smith <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OCA Verified All contributors have signed the Oracle Contributor Agreement. repository_finder The issues related to the repository finder
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Repo Finder Refactoring
5 participants