@@ -11,7 +11,7 @@ import (
11
11
"github.com/future-architect/vuls/models"
12
12
)
13
13
14
- func osPkgToPURL (osFamily , osVersion , packName , packVersion , packRelease , packArch , packRepository string ) * packageurl.PackageURL {
14
+ func osPkgToPURL (osFamily , osVersion string , pkg models. Package ) * packageurl.PackageURL {
15
15
var pType string
16
16
switch osFamily {
17
17
case constant .Alma , constant .Amazon , constant .CentOS , constant .Fedora , constant .OpenSUSE , constant .OpenSUSELeap , constant .Oracle , constant .RedHat , constant .Rocky , constant .SUSEEnterpriseDesktop , constant .SUSEEnterpriseServer :
@@ -30,9 +30,9 @@ func osPkgToPURL(osFamily, osVersion, packName, packVersion, packRelease, packAr
30
30
pType = "unknown"
31
31
}
32
32
33
- version := packVersion
34
- if packRelease != "" {
35
- version = fmt .Sprintf ("%s-%s" , packVersion , packRelease )
33
+ version := pkg . Version
34
+ if pkg . Release != "" {
35
+ version = fmt .Sprintf ("%s-%s" , pkg . Version , pkg . Release )
36
36
}
37
37
38
38
var qualifiers packageurl.Qualifiers
@@ -42,20 +42,20 @@ func osPkgToPURL(osFamily, osVersion, packName, packVersion, packRelease, packAr
42
42
Value : osVersion ,
43
43
})
44
44
}
45
- if packArch != "" {
45
+ if pkg . Arch != "" {
46
46
qualifiers = append (qualifiers , packageurl.Qualifier {
47
47
Key : "arch" ,
48
- Value : packArch ,
48
+ Value : pkg . Arch ,
49
49
})
50
50
}
51
- if packRepository != "" {
51
+ if pkg . Repository != "" {
52
52
qualifiers = append (qualifiers , packageurl.Qualifier {
53
53
Key : "repo" ,
54
- Value : packRepository ,
54
+ Value : pkg . Repository ,
55
55
})
56
56
}
57
57
58
- return packageurl .NewPackageURL (pType , osFamily , packName , version , qualifiers , "" )
58
+ return packageurl .NewPackageURL (pType , osFamily , pkg . Name , version , qualifiers , "" )
59
59
}
60
60
61
61
func libPkgToPURL (libScanner models.LibraryScanner , lib models.Library ) * packageurl.PackageURL {
0 commit comments