fix: #953 Derive language from pURL - https://github.com/anchore/syft… (#957)

Signed-off-by: Christopher Phillips <christopher.phillips@anchore.com>
This commit is contained in:
Jon McEwen
2022-04-26 11:51:24 -04:00
committed by GitHub
parent c270ee2a02
commit 7304bbf8ee
5 changed files with 59 additions and 14 deletions
+7
View File
@@ -70,6 +70,13 @@ func Catalog(resolver source.FileResolver, release *linux.Release, catalogers ..
// generate PURL (note: this is excluded from package ID, so is safe to mutate)
p.PURL = pkg.URL(p, release)
// if we were not able to identify the language we have an opportunity
// to try and get this value from the PURL. Worst case we assert that
// we could not identify the language at either stage and set UnknownLanguage
if p.Language == "" {
p.Language = pkg.LanguageFromPURL(p.PURL)
}
// create file-to-package relationships for files owned by the package
owningRelationships, err := packageFileOwnershipRelationships(p, resolver)
if err != nil {