List of architectures now includes optionally "source" virtual arch.

This commit is contained in:
Andrey Smirnov
2014-02-16 21:36:25 +04:00
parent 5e8b6da1db
commit ce793c6dae
4 changed files with 19 additions and 12 deletions
+5 -3
View File
@@ -158,11 +158,13 @@ func (l *PackageList) Remove(p *Package) {
}
}
// Architectures returns list of architectures present in packages
func (l *PackageList) Architectures() (result []string) {
// Architectures returns list of architectures present in packages and flag if source packages are present.
//
// If includeSource is true, meta-architecture "source" would be present in the list
func (l *PackageList) Architectures(includeSource bool) (result []string) {
result = make([]string, 0, 10)
for _, pkg := range l.packages {
if pkg.Architecture != "all" && !utils.StrSliceHasItem(result, pkg.Architecture) {
if pkg.Architecture != "all" && (pkg.Architecture != "source" || includeSource) && !utils.StrSliceHasItem(result, pkg.Architecture) {
result = append(result, pkg.Architecture)
}
}