Skip to content

Commit

Permalink
chore: fix after rebase
Browse files Browse the repository at this point in the history
Signed-off-by: Ben Selwyn-Smith <[email protected]>
  • Loading branch information
benmss committed Nov 28, 2024
1 parent a4028d9 commit 7c7cb7b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 12 deletions.
10 changes: 4 additions & 6 deletions src/macaron/repo_finder/repo_finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def find_source(purl_string: str, input_repo: str | None) -> bool:
found_repo = input_repo
if not input_repo:
logger.debug("Searching for repo of PURL: %s", purl)
found_repo = find_repo(purl)
found_repo, _ = find_repo(purl)

if not found_repo:
logger.error("Could not find repo for PURL: %s", purl)
Expand All @@ -174,7 +174,7 @@ def find_source(purl_string: str, input_repo: str | None) -> bool:
logger.debug("Preparing repo: %s", found_repo)
repo_dir = os.path.join(global_config.output_path, GIT_REPOS_DIR)
logging.getLogger("macaron.slsa_analyzer.git_url").disabled = True
git_obj = prepare_repo(
git_obj, _, digest = prepare_repo(
repo_dir,
found_repo,
purl=purl,
Expand All @@ -185,9 +185,7 @@ def find_source(purl_string: str, input_repo: str | None) -> bool:
logger.error("Could not resolve repository: %s", found_repo)
return False

try:
digest = git_obj.get_head().hash
except ValueError:
if not digest:
logger.debug("Could not retrieve commit hash from repository.")
return False
else:
Expand All @@ -196,7 +194,7 @@ def find_source(purl_string: str, input_repo: str | None) -> bool:
if not tags:
return False

matches = match_tags(list(tags.keys()), purl.name, purl.version)
matches, _ = match_tags(list(tags.keys()), purl.name, purl.version)

if not matches:
return False
Expand Down
5 changes: 0 additions & 5 deletions src/macaron/repo_finder/repo_finder_java.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,6 @@ def find_repo(self, purl: PackageURL) -> tuple[str, RepoFinderOutcome]:
last_outcome = RepoFinderOutcome.FOUND
check_parents = defaults.getboolean("repofinder.java", "find_parents")

if not version:
logger.info("Version missing for maven artifact: %s:%s", group, artifact)
# TODO add support for Java artifacts without a version
return ""

while group and artifact and version and limit > 0:
# Create the URLs for retrieving the artifact's POM.
group = group.replace(".", "/")
Expand Down
2 changes: 1 addition & 1 deletion src/macaron/repo_finder/repo_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ def prepare_repo(

# Find the digest and branch if a version has been specified
if not digest and purl and purl.version:
found_digest = find_commit(git_obj, purl)
found_digest, commit_finder_outcome = find_commit(git_obj, purl)
if not found_digest:
logger.error("Could not map the input purl string to a specific commit in the corresponding repository.")
return None, commit_finder_outcome, digest
Expand Down

0 comments on commit 7c7cb7b

Please sign in to comment.