5
5
package builder
6
6
7
7
import (
8
+ "fmt"
8
9
"github.com/spdx/tools-golang/builder/builder2v1"
9
10
"github.com/spdx/tools-golang/builder/builder2v2"
10
11
"github.com/spdx/tools-golang/spdx"
@@ -55,7 +56,7 @@ func Build2_1(packageName string, dirRoot string, config *Config2_1) (*spdx.Docu
55
56
return nil , err
56
57
}
57
58
58
- ci , err := builder2v1 .BuildCreationInfoSection2_1 (packageName , pkg . PackageVerificationCode , config . NamespacePrefix , config .CreatorType , config .Creator , config .TestValues )
59
+ ci , err := builder2v1 .BuildCreationInfoSection2_1 (config .CreatorType , config .Creator , config .TestValues )
59
60
if err != nil {
60
61
return nil , err
61
62
}
@@ -66,9 +67,14 @@ func Build2_1(packageName string, dirRoot string, config *Config2_1) (*spdx.Docu
66
67
}
67
68
68
69
doc := & spdx.Document2_1 {
69
- CreationInfo : ci ,
70
- Packages : map [spdx.ElementID ]* spdx.Package2_1 {pkg .PackageSPDXIdentifier : pkg },
71
- Relationships : []* spdx.Relationship2_1 {rln },
70
+ SPDXVersion : "SPDX-2.1" ,
71
+ DataLicense : "CC0-1.0" ,
72
+ SPDXIdentifier : spdx .ElementID ("DOCUMENT" ),
73
+ DocumentName : packageName ,
74
+ DocumentNamespace : fmt .Sprintf ("%s%s-%s" , config .NamespacePrefix , packageName , pkg .PackageVerificationCode ),
75
+ CreationInfo : ci ,
76
+ Packages : []* spdx.Package2_1 {pkg },
77
+ Relationships : []* spdx.Relationship2_1 {rln },
72
78
}
73
79
74
80
return doc , nil
@@ -119,7 +125,7 @@ func Build2_2(packageName string, dirRoot string, config *Config2_2) (*spdx.Docu
119
125
return nil , err
120
126
}
121
127
122
- ci , err := builder2v2 .BuildCreationInfoSection2_2 (packageName , pkg . PackageVerificationCode , config . NamespacePrefix , config .CreatorType , config .Creator , config .TestValues )
128
+ ci , err := builder2v2 .BuildCreationInfoSection2_2 (config .CreatorType , config .Creator , config .TestValues )
123
129
if err != nil {
124
130
return nil , err
125
131
}
@@ -130,9 +136,14 @@ func Build2_2(packageName string, dirRoot string, config *Config2_2) (*spdx.Docu
130
136
}
131
137
132
138
doc := & spdx.Document2_2 {
133
- CreationInfo : ci ,
134
- Packages : map [spdx.ElementID ]* spdx.Package2_2 {pkg .PackageSPDXIdentifier : pkg },
135
- Relationships : []* spdx.Relationship2_2 {rln },
139
+ SPDXVersion : "SPDX-2.2" ,
140
+ DataLicense : "CC0-1.0" ,
141
+ SPDXIdentifier : spdx .ElementID ("DOCUMENT" ),
142
+ DocumentName : packageName ,
143
+ DocumentNamespace : fmt .Sprintf ("%s%s-%s" , config .NamespacePrefix , packageName , pkg .PackageVerificationCode ),
144
+ CreationInfo : ci ,
145
+ Packages : []* spdx.Package2_2 {pkg },
146
+ Relationships : []* spdx.Relationship2_2 {rln },
136
147
}
137
148
138
149
return doc , nil
0 commit comments