@@ -626,16 +626,21 @@ def main():
626
626
packages [matchname + matchver ] = packages .get (matchname + matchver , 0 ) + 1
627
627
628
628
kb_match = None
629
+ bd_proj = False
629
630
if package .external_references :
630
631
foundpurl = False
631
632
for ref in package .external_references :
632
- # There can be multiple extrefs; try to locate a purl .
633
- # If there are multiple purls , use the first one.
633
+ # There can be multiple extrefs; try to locate a pURL .
634
+ # If there are multiple pURLs , use the first one.
634
635
if (ref .reference_type == "purl" ):
635
636
foundpurl = True
636
637
kb_match = find_comp_in_kb (ref .locator )
637
638
extref = ref .locator
638
639
break
640
+ # Skip BD project/versions. These occur in BD-generated BOMs.
641
+ if (ref .reference_type == "BlackDuck-Version" ):
642
+ bd_proj = True
643
+ break
639
644
if not foundpurl :
640
645
nopurl += 1
641
646
print (f" No pURL provided for { package .name } { package .version } " )
@@ -648,14 +653,17 @@ def main():
648
653
else :
649
654
print (f" No KB match for { package .name } { package .version } " )
650
655
else :
656
+ # No external references field was provided
651
657
nopurl += 1
652
658
print (f" No pURL provided for { package .name } { package .version } " )
653
659
660
+ if bd_proj :
661
+ print (f" Skipping BD project/version in BOM: { package .name } { package .version } " )
662
+ continue
663
+
654
664
if find_comp_in_bom (matchname , matchver , version ):
655
665
bom_matches += 1
656
666
print (f" Found component in BOM: { matchname } { matchver } " )
657
- # It's in the BOM so we are happy
658
- # Everything else below is related to adding to the BOM
659
667
continue
660
668
661
669
# If we've gotten this far, the package is not in the BOM.
0 commit comments