Skip to content

Commit

Permalink
Merge pull request #8 from blackducksoftware/dev-worklaptop
Browse files Browse the repository at this point in the history
v1.0.9 - Minor semver check fix & SBOM encoding
  • Loading branch information
matthewb66 authored Aug 30, 2024
2 parents 4c5778f + 354231f commit ae7bf64
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Synopsys Scan Yocto Script - bd_scan_yocto_via_sbom.py v1.0.8
# Synopsys Scan Yocto Script - bd_scan_yocto_via_sbom.py v1.0.9

# PROVISION OF THIS SCRIPT
This script is provided under the MIT license (see LICENSE file).
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "bd_scan_yocto_via_sbom"
version = "1.0.8"
version = "1.0.9"
authors = [
{ name="Matthew Brady", email="[email protected]" },
]
Expand Down
2 changes: 1 addition & 1 deletion yocto_import_sbom/ConfigClass.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def __init__(self):
else:
logging.basicConfig(level=loglevel)

logging.info("Black Duck Yocto scan via SBOM utility - v1.0.8")
logging.info("Black Duck Yocto scan via SBOM utility - v1.0.9")
logging.info("SUPPLIED ARGUMENTS:")
for arg in vars(args):
logging.info(f"--{arg}={getattr(args, arg)}")
Expand Down
11 changes: 6 additions & 5 deletions yocto_import_sbom/OEClass.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,6 @@ def compare_recipes(self, conf, recipe, oe_recipe, best_oe_recipe):

pref = False

ver = Recipe.filter_version_string(recipe.version)
oe_ver = Recipe.filter_version_string(oe_recipe['pv'])
if best_oe_recipe != {}:
best_oe_ver = Recipe.filter_version_string(best_oe_recipe['pv'])
Expand All @@ -271,17 +270,19 @@ def compare_recipes(self, conf, recipe, oe_recipe, best_oe_recipe):
if oe_ver == best_oe_ver:
oe_ver_equal = True

if ver != best_oe_ver:
if ver == oe_ver:
if recipe.version != best_oe_ver:
if recipe.version == oe_ver:
pref = True
else:
semver, rest = self.coerce_version(ver)
semver, rest = self.coerce_version(recipe.version)
oe_semver, oe_rest = self.coerce_version(oe_ver)
best_oe_semver, best_oe_rest = self.coerce_version(best_oe_ver)
if semver is not None and oe_semver is not None and oe_semver <= semver:
if self.check_semver_distance(conf, semver, oe_semver):
if best_oe_semver is not None:
if oe_semver == best_oe_semver:
if len(oe_ver) < len(best_oe_ver):
pref = True
oe_ver_equal = True
elif semver >= oe_semver > best_oe_semver:
if (semver.major - best_oe_semver.major) > (semver.major - oe_semver.major):
Expand Down Expand Up @@ -318,7 +319,7 @@ def compare_recipes(self, conf, recipe, oe_recipe, best_oe_recipe):
pref = True

if pref:
return True, (ver == oe_ver)
return True, (recipe.version == oe_ver)
except Exception as e:
logging.error(f"Error in compare_recipes(): {e}")
return False, False
Expand Down
8 changes: 4 additions & 4 deletions yocto_import_sbom/SBOMClass.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def output(self, output_file):

@staticmethod
def filter_special_chars(val):
return val
# newval = val.replace(':', '%3A')
# newval = newval.replace('+', '%2B')
# return newval
# return val
newval = val.replace(':', '%3A')
newval = newval.replace('+', '%2B')
return newval

0 comments on commit ae7bf64

Please sign in to comment.