@@ -19,8 +19,8 @@ type RepoReducer struct {
19
19
repoFiles []string
20
20
provides map [string ][]* api.Package
21
21
implicitRequires []string
22
- arch string
23
22
architectures []string
23
+ architecturesSet map [string ]bool
24
24
repos * bazeldnf.Repositories
25
25
cacheHelper * repo.CacheHelper
26
26
}
@@ -38,19 +38,19 @@ func (r *RepoReducer) Load() error {
38
38
return err
39
39
}
40
40
for i , p := range repoFile .Packages {
41
- if skip (p .Arch , r .architectures ) {
41
+ if skip (p .Arch , r .architecturesSet ) {
42
42
continue
43
43
}
44
44
r .packages = append (r .packages , repoFile .Packages [i ])
45
45
}
46
46
}
47
- repos , err := r .cacheHelper .CurrentPrimaries (r .repos , r .arch )
47
+ repos , err := r .cacheHelper .CurrentPrimaries (r .repos , r .architecturesSet )
48
48
if err != nil {
49
49
return err
50
50
}
51
51
for _ , rpmrepo := range repos {
52
52
for i , p := range rpmrepo .Packages {
53
- if skip (p .Arch , r .architectures ) {
53
+ if skip (p .Arch , r .architecturesSet ) {
54
54
continue
55
55
}
56
56
r .packages = append (r .packages , rpmrepo .Packages [i ])
@@ -204,28 +204,28 @@ func NewRepoReducer(repos *bazeldnf.Repositories, repoFiles []string, lang strin
204
204
if baseSystem != "" {
205
205
implicitRequires = append (implicitRequires , baseSystem )
206
206
}
207
+ architecturesSet := map [string ]bool {}
208
+ for _ , arch := range []string {"noarch" , arch } {
209
+ architecturesSet [arch ] = true
210
+ }
207
211
return & RepoReducer {
208
212
packages : nil ,
209
213
lang : lang ,
210
214
implicitRequires : implicitRequires ,
211
215
repoFiles : repoFiles ,
212
216
provides : map [string ][]* api.Package {},
213
217
architectures : []string {"noarch" , arch },
214
- arch : arch ,
218
+ architecturesSet : architecturesSet ,
215
219
repos : repos ,
216
220
cacheHelper : cacheHelper ,
217
221
}
218
222
}
219
223
220
- func skip (arch string , arches []string ) bool {
221
- skip := true
222
- for _ , a := range arches {
223
- if a == arch {
224
- skip = false
225
- break
226
- }
224
+ func skip (arch string , arches map [string ]bool ) bool {
225
+ if _ , ok := arches [arch ]; ok {
226
+ return false
227
227
}
228
- return skip
228
+ return true
229
229
}
230
230
231
231
// FixPackages contains hacks which should probably not have to exist
0 commit comments