mirror of
https://github.com/anchore/syft.git
synced 2026-11-03 07:56:36 +01:00
Add pacman (alpm) parser support (#943)
Co-authored-by: Christopher Phillips <christopher.phillips@anchore.com>
This commit is contained in:
co-authored by
Christopher Phillips
parent
f15d4a9984
commit
e72d68b0c6
+19
-6
@@ -1,7 +1,6 @@
|
||||
package pkg
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"regexp"
|
||||
"sort"
|
||||
"strings"
|
||||
@@ -86,12 +85,26 @@ func purlQualifiers(vars map[string]string, release *linux.Release) (q packageur
|
||||
})
|
||||
}
|
||||
|
||||
if release != nil && release.ID != "" && release.VersionID != "" {
|
||||
q = append(q, packageurl.Qualifier{
|
||||
Key: PURLQualifierDistro,
|
||||
Value: fmt.Sprintf("%s-%s", release.ID, release.VersionID),
|
||||
})
|
||||
distroQualifiers := []string{}
|
||||
|
||||
if release == nil {
|
||||
return q
|
||||
}
|
||||
|
||||
if release.ID != "" {
|
||||
distroQualifiers = append(distroQualifiers, release.ID)
|
||||
}
|
||||
|
||||
if release.VersionID != "" {
|
||||
distroQualifiers = append(distroQualifiers, release.VersionID)
|
||||
} else if release.BuildID != "" {
|
||||
distroQualifiers = append(distroQualifiers, release.BuildID)
|
||||
}
|
||||
|
||||
q = append(q, packageurl.Qualifier{
|
||||
Key: PURLQualifierDistro,
|
||||
Value: strings.Join(distroQualifiers, "-"),
|
||||
})
|
||||
|
||||
return q
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user