Skip to content

Commit

Permalink
feat: improved purl for productinfo (#4222)
Browse files Browse the repository at this point in the history
* feat: improved purl for productinfo

Signed-off-by: Meet Soni <[email protected]>

* fix: improved default parameter type

Signed-off-by: Meet Soni <[email protected]>

---------

Signed-off-by: Meet Soni <[email protected]>
  • Loading branch information
inosmeet authored Jun 26, 2024
1 parent 42e786f commit 20a5574
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cve_bin_tool/parsers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,13 @@ def find_vendor(self, product, version):
)
return vendorlist

def generate_purl(self, product, vendor="", qualifier={}, subpath=None):
def generate_purl(self, product, vendor="", version="", qualifier={}, subpath=None):
"""Generate purl string based on various components."""
purl = PackageURL(
type=self.purl_pkg_type,
namespace=vendor,
name=product,
version=version,
qualifiers=qualifier,
subpath=subpath,
)
Expand Down Expand Up @@ -132,8 +133,8 @@ def find_vendor_from_purl(self, purl, ver) -> tuple[list[ScanInfo], bool]:
else:
return vendorlist, False

purl_with_ver = f"{str(purl)}@{ver}"
for vendor, product in vendors:
purl_with_ver = self.generate_purl(product, vendor, ver)
vendorlist.append(
ScanInfo(
ProductInfo(
Expand Down Expand Up @@ -190,7 +191,6 @@ def deduplication(self, purl, vendorlist) -> list[ScanInfo]:
item.product_info.product,
item.product_info.version,
item.file_path,
item.product_info.purl,
),
item.file_path,
)
Expand Down

0 comments on commit 20a5574

Please sign in to comment.