Skip to content

Commit

Permalink
only allow mirrors with architectures set
Browse files Browse the repository at this point in the history
  • Loading branch information
neolynx committed Nov 8, 2024
1 parent d7835eb commit f696399
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 20 deletions.
4 changes: 2 additions & 2 deletions deb/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,9 +317,9 @@ func (l *PackageList) VerifyDependencies(options int, architectures []string, so
progress.InitBar(int64(l.Len())*int64(len(architectures)), false, aptly.BarGeneralVerifyDependencies)
}

if len(architectures) == 0 {
if len(architectures) == 0 {
return nil, fmt.Errorf("no architectures defined, cannot verify dependencies")
}
}
for _, arch := range architectures {
cache := make(map[string]bool, 2048)

Expand Down
33 changes: 15 additions & 18 deletions deb/remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -350,27 +350,24 @@ ok:
return err
}

var architectures []string
if len(stanza["Architectures"]) > 0 {
architectures = strings.Split(stanza["Architectures"], " ")
} else if len(stanza["Architecture"]) > 0 {
architectures = strings.Split(stanza["Architecture"], " ")
}
if len(architectures) == 0 {
fmt.Printf("stanza arch: %s\n", stanza["Architecture"])
architectures = strings.Split(stanza["Architecture"], " ")
architectures := strings.Split(stanza["Architectures"], " ")
sort.Strings(architectures)
// "source" architecture is never present, despite Release file claims
architectures = utils.StrSlicesSubstract(architectures, []string{ArchitectureSource})
if len(repo.Architectures) == 0 {
repo.Architectures = architectures
} else if !repo.SkipArchitectureCheck {
err = utils.StringsIsSubset(repo.Architectures, architectures,
fmt.Sprintf("architecture %%s not available in repo %s, use -force-architectures to override", repo))
if err != nil {
return err
}
}
}
sort.Strings(architectures)
// "source" architecture is never present, despite Release file claims
architectures = utils.StrSlicesSubstract(architectures, []string{ArchitectureSource})

if len(repo.Architectures) == 0 {
repo.Architectures = architectures
} else if !repo.SkipArchitectureCheck {
err = utils.StringsIsSubset(repo.Architectures, architectures,
fmt.Sprintf("architecture %%s not available in repo %s, use -force-architectures to override", repo))
if err != nil {
return err
}
return fmt.Errorf("no architectures found, please specify")
}

if !repo.IsFlat() {
Expand Down

0 comments on commit f696399

Please sign in to comment.