@@ -127,16 +127,17 @@ type packageData struct {
127
127
type packageCache = map [* packages_model.PackageFile ]* packageData
128
128
129
129
// BuildSpecificRepositoryFiles builds metadata files for the repository
130
- func BuildRepositoryFiles (ctx context.Context , ownerID int64 ) error {
130
+ func BuildRepositoryFiles (ctx context.Context , ownerID int64 , distribution string ) error {
131
131
pv , err := GetOrCreateRepositoryVersion (ownerID )
132
132
if err != nil {
133
133
return err
134
134
}
135
135
136
136
pfs , _ , err := packages_model .SearchFiles (ctx , & packages_model.PackageFileSearchOptions {
137
- OwnerID : ownerID ,
138
- PackageType : packages_model .TypeRpm ,
139
- Query : "%.rpm" ,
137
+ OwnerID : ownerID ,
138
+ PackageType : packages_model .TypeRpm ,
139
+ Query : "%.rpm" ,
140
+ CompositeKey : distribution ,
140
141
})
141
142
if err != nil {
142
143
return err
@@ -198,15 +199,15 @@ func BuildRepositoryFiles(ctx context.Context, ownerID int64) error {
198
199
cache [pf ] = pd
199
200
}
200
201
201
- primary , err := buildPrimary (pv , pfs , cache )
202
+ primary , err := buildPrimary (pv , pfs , cache , distribution )
202
203
if err != nil {
203
204
return err
204
205
}
205
- filelists , err := buildFilelists (pv , pfs , cache )
206
+ filelists , err := buildFilelists (pv , pfs , cache , distribution )
206
207
if err != nil {
207
208
return err
208
209
}
209
- other , err := buildOther (pv , pfs , cache )
210
+ other , err := buildOther (pv , pfs , cache , distribution )
210
211
if err != nil {
211
212
return err
212
213
}
@@ -219,11 +220,12 @@ func BuildRepositoryFiles(ctx context.Context, ownerID int64) error {
219
220
filelists ,
220
221
other ,
221
222
},
223
+ distribution ,
222
224
)
223
225
}
224
226
225
227
// https://docs.pulpproject.org/en/2.19/plugins/pulp_rpm/tech-reference/rpm.html#repomd-xml
226
- func buildRepomd (pv * packages_model.PackageVersion , ownerID int64 , data []* repoData ) error {
228
+ func buildRepomd (pv * packages_model.PackageVersion , ownerID int64 , data []* repoData , distribution string ) error {
227
229
type Repomd struct {
228
230
XMLName xml.Name `xml:"repomd"`
229
231
Xmlns string `xml:"xmlns,attr"`
@@ -274,7 +276,8 @@ func buildRepomd(pv *packages_model.PackageVersion, ownerID int64, data []*repoD
274
276
pv ,
275
277
& packages_service.PackageFileCreationInfo {
276
278
PackageFileInfo : packages_service.PackageFileInfo {
277
- Filename : file .Name ,
279
+ Filename : file .Name ,
280
+ CompositeKey : distribution ,
278
281
},
279
282
Creator : user_model .NewGhostUser (),
280
283
Data : file .Data ,
@@ -291,7 +294,7 @@ func buildRepomd(pv *packages_model.PackageVersion, ownerID int64, data []*repoD
291
294
}
292
295
293
296
// https://docs.pulpproject.org/en/2.19/plugins/pulp_rpm/tech-reference/rpm.html#primary-xml
294
- func buildPrimary (pv * packages_model.PackageVersion , pfs []* packages_model.PackageFile , c packageCache ) (* repoData , error ) {
297
+ func buildPrimary (pv * packages_model.PackageVersion , pfs []* packages_model.PackageFile , c packageCache , distribution string ) (* repoData , error ) {
295
298
type Version struct {
296
299
Epoch string `xml:"epoch,attr"`
297
300
Version string `xml:"ver,attr"`
@@ -430,11 +433,11 @@ func buildPrimary(pv *packages_model.PackageVersion, pfs []*packages_model.Packa
430
433
XmlnsRpm : "http://linux.duke.edu/metadata/rpm" ,
431
434
PackageCount : len (pfs ),
432
435
Packages : packages ,
433
- })
436
+ }, distribution )
434
437
}
435
438
436
439
// https://docs.pulpproject.org/en/2.19/plugins/pulp_rpm/tech-reference/rpm.html#filelists-xml
437
- func buildFilelists (pv * packages_model.PackageVersion , pfs []* packages_model.PackageFile , c packageCache ) (* repoData , error ) { //nolint:dupl
440
+ func buildFilelists (pv * packages_model.PackageVersion , pfs []* packages_model.PackageFile , c packageCache , distribution string ) (* repoData , error ) { //nolint:dupl
438
441
type Version struct {
439
442
Epoch string `xml:"epoch,attr"`
440
443
Version string `xml:"ver,attr"`
@@ -477,11 +480,12 @@ func buildFilelists(pv *packages_model.PackageVersion, pfs []*packages_model.Pac
477
480
Xmlns : "http://linux.duke.edu/metadata/other" ,
478
481
PackageCount : len (pfs ),
479
482
Packages : packages ,
480
- })
483
+ },
484
+ distribution )
481
485
}
482
486
483
487
// https://docs.pulpproject.org/en/2.19/plugins/pulp_rpm/tech-reference/rpm.html#other-xml
484
- func buildOther (pv * packages_model.PackageVersion , pfs []* packages_model.PackageFile , c packageCache ) (* repoData , error ) { //nolint:dupl
488
+ func buildOther (pv * packages_model.PackageVersion , pfs []* packages_model.PackageFile , c packageCache , distribution string ) (* repoData , error ) { //nolint:dupl
485
489
type Version struct {
486
490
Epoch string `xml:"epoch,attr"`
487
491
Version string `xml:"ver,attr"`
@@ -524,7 +528,7 @@ func buildOther(pv *packages_model.PackageVersion, pfs []*packages_model.Package
524
528
Xmlns : "http://linux.duke.edu/metadata/other" ,
525
529
PackageCount : len (pfs ),
526
530
Packages : packages ,
527
- })
531
+ }, distribution )
528
532
}
529
533
530
534
// writtenCounter counts all written bytes
@@ -544,7 +548,7 @@ func (wc *writtenCounter) Written() int64 {
544
548
return wc .written
545
549
}
546
550
547
- func addDataAsFileToRepo (pv * packages_model.PackageVersion , filetype string , obj any ) (* repoData , error ) {
551
+ func addDataAsFileToRepo (pv * packages_model.PackageVersion , filetype string , obj any , distribution string ) (* repoData , error ) {
548
552
content , _ := packages_module .NewHashedBuffer ()
549
553
gzw := gzip .NewWriter (content )
550
554
wc := & writtenCounter {}
@@ -567,7 +571,8 @@ func addDataAsFileToRepo(pv *packages_model.PackageVersion, filetype string, obj
567
571
pv ,
568
572
& packages_service.PackageFileCreationInfo {
569
573
PackageFileInfo : packages_service.PackageFileInfo {
570
- Filename : filename ,
574
+ Filename : filename ,
575
+ CompositeKey : distribution ,
571
576
},
572
577
Creator : user_model .NewGhostUser (),
573
578
Data : content ,
0 commit comments