Skip to content

Commit

Permalink
OSS: Exclude qualifiers for Conda packages (sonatype-nexus-community#145
Browse files Browse the repository at this point in the history
)


* As a possible approach to mitigate sonatype-nexus-community/ossindex-python#19
  • Loading branch information
riccardoporreca authored Nov 6, 2023
1 parent 4ffd06b commit b42072b
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions jake/command/oss.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,16 @@
from . import parser_selector



def _oss_component_purl(c: OssIndexComponent) -> PackageURL:
purl: PackageURL = c.purl
if purl.qualifiers and purl.type == "conda":
purl_dict = purl.to_dict()
purl_dict["qualifiers"] = None
purl = PackageURL(**purl_dict)
return purl


class OssCommand(BaseCommand):
_console: Console

Expand Down Expand Up @@ -81,9 +91,8 @@ def handle_args(self) -> int:
progress.update(task_query_ossi, completed=2, description='Cleared OSS Index local cache')

progress.update(task_query_ossi, completed=3, description='Querying OSS Index for details on your packages')

oss_index_results = oss.get_component_report(
packages=list(map(lambda c: c.purl, filter(lambda c: c.purl, parser.get_components())))
packages=list(map(_oss_component_purl, filter(lambda c: c.purl, parser.get_components())))
)

if self.arguments.oss_whitelist_json_file:
Expand Down Expand Up @@ -120,7 +129,7 @@ def handle_args(self) -> int:
for component in parser.get_components():
if component.purl:
oss_index_component: OssIndexComponent = list(filter(
lambda oic_: oic_.get_package_url().to_string() == cast(PackageURL, component.purl).to_string(),
lambda oic_: oic_.get_package_url().to_string() == cast(PackageURL, _oss_component_purl(component)).to_string(),
oss_index_results
)).pop()
else:
Expand Down

0 comments on commit b42072b

Please sign in to comment.