Hide warnings for ignored packages

This commit is contained in:
morganamilo 2019-11-11 07:15:04 +00:00
parent 0bd21ea29f
commit ab956ea3d2
No known key found for this signature in database
GPG Key ID: 6FE9E7996B0B082E
4 changed files with 22 additions and 4 deletions

View File

@ -59,7 +59,7 @@ func install(parser *arguments) (err error) {
var srcinfos map[string]*gosrc.Srcinfo var srcinfos map[string]*gosrc.Srcinfo
warnings := &aurWarnings{} warnings := makeWarnings()
if mode == modeAny || mode == modeRepo { if mode == modeAny || mode == modeRepo {
if config.CombinedUpgrade { if config.CombinedUpgrade {

View File

@ -27,6 +27,13 @@ func (set StringSet) Set(v string) {
set[v] = struct{}{} set[v] = struct{}{}
} }
// Extend sets multiple keys in StringSet.
func (set StringSet) Extend(s ...string) {
for _, v := range s {
set[v] = struct{}{}
}
}
// Get returns true if the key exists in the set. // Get returns true if the key exists in the set.
func (set StringSet) Get(v string) bool { func (set StringSet) Get(v string) bool {
_, exists := set[v] _, exists := set[v]

View File

@ -20,6 +20,11 @@ type aurWarnings struct {
Orphans []string Orphans []string
OutOfDate []string OutOfDate []string
Missing []string Missing []string
Ignore stringset.StringSet
}
func makeWarnings() *aurWarnings {
return &aurWarnings{Ignore: make(stringset.StringSet)}
} }
// Query is a collection of Results // Query is a collection of Results
@ -538,17 +543,17 @@ func aurInfo(names []string, warnings *aurWarnings) ([]*rpc.Pkg, error) {
for _, name := range names { for _, name := range names {
i, ok := seen[name] i, ok := seen[name]
if !ok { if !ok && !warnings.Ignore.Get(name) {
warnings.Missing = append(warnings.Missing, name) warnings.Missing = append(warnings.Missing, name)
continue continue
} }
pkg := info[i] pkg := info[i]
if pkg.Maintainer == "" { if pkg.Maintainer == "" && !warnings.Ignore.Get(name) {
warnings.Orphans = append(warnings.Orphans, name) warnings.Orphans = append(warnings.Orphans, name)
} }
if pkg.OutOfDate != 0 { if pkg.OutOfDate != 0 && !warnings.Ignore.Get(name) {
warnings.OutOfDate = append(warnings.OutOfDate, name) warnings.OutOfDate = append(warnings.OutOfDate, name)
} }
} }

View File

@ -128,6 +128,12 @@ func upList(warnings *aurWarnings) (upSlice, upSlice, error) {
aurdata := make(map[string]*rpc.Pkg) aurdata := make(map[string]*rpc.Pkg)
for _, pkg := range remote {
if pkg.ShouldIgnore() {
warnings.Ignore.Set(pkg.Name())
}
}
if mode == modeAny || mode == modeRepo { if mode == modeAny || mode == modeRepo {
fmt.Println(bold(cyan("::") + bold(" Searching databases for updates..."))) fmt.Println(bold(cyan("::") + bold(" Searching databases for updates...")))
wg.Add(1) wg.Add(1)