-
Notifications
You must be signed in to change notification settings - Fork 186
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This change adds purl data to all packages listed Addresses #1206 Signed-off-by: Ivana Atanasova <iyovcheva@vmware.com>
- Loading branch information
Showing
5 changed files
with
46 additions
and
4 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# -*- coding: utf-8 -*- | ||
# | ||
# Copyright (c) 2017-2022 VMware, Inc. All Rights Reserved. | ||
# SPDX-License-Identifier: BSD-2-Clause | ||
|
||
import logging | ||
from packageurl import PackageURL | ||
|
||
from tern.utils import constants | ||
|
||
# global logger | ||
logger = logging.getLogger(constants.logger_name) | ||
|
||
def generate_purl_package_reference(package_name, package_version): | ||
return "pkg:" + package_name + "@" + package_version | ||
|
||
def add_purl(package_name, package_version): | ||
purl_package_reference = generate_purl_package_reference(package_name, package_version) | ||
purl = 'not_found' | ||
try: | ||
purl = PackageURL.from_string(purl_package_reference) | ||
except (ValueError): | ||
logger.debug("purl is missing required component for package %s", | ||
purl_package_reference) | ||
return purl |
This file contains 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