Skip to content

Commit

Permalink
Merge pull request Jguer#1115 from Morganamilo/ignoreignore
Browse files Browse the repository at this point in the history
Hide warnings for ignored packages
  • Loading branch information
Jguer authored Nov 11, 2019
2 parents 45da573 + ab956ea commit b08e505
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 4 deletions.
2 changes: 1 addition & 1 deletion install.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func install(parser *arguments) (err error) {

var srcinfos map[string]*gosrc.Srcinfo

warnings := &aurWarnings{}
warnings := makeWarnings()

if mode == modeAny || mode == modeRepo {
if config.CombinedUpgrade {
Expand Down
7 changes: 7 additions & 0 deletions pkg/stringset/stringset.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ func (set StringSet) Set(v string) {
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.
func (set StringSet) Get(v string) bool {
_, exists := set[v]
Expand Down
11 changes: 8 additions & 3 deletions query.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ type aurWarnings struct {
Orphans []string
OutOfDate []string
Missing []string
Ignore stringset.StringSet
}

func makeWarnings() *aurWarnings {
return &aurWarnings{Ignore: make(stringset.StringSet)}
}

// Query is a collection of Results
Expand Down Expand Up @@ -538,17 +543,17 @@ func aurInfo(names []string, warnings *aurWarnings) ([]*rpc.Pkg, error) {

for _, name := range names {
i, ok := seen[name]
if !ok {
if !ok && !warnings.Ignore.Get(name) {
warnings.Missing = append(warnings.Missing, name)
continue
}

pkg := info[i]

if pkg.Maintainer == "" {
if pkg.Maintainer == "" && !warnings.Ignore.Get(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)
}
}
Expand Down
6 changes: 6 additions & 0 deletions upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,12 @@ func upList(warnings *aurWarnings) (upSlice, upSlice, error) {

aurdata := make(map[string]*rpc.Pkg)

for _, pkg := range remote {
if pkg.ShouldIgnore() {
warnings.Ignore.Set(pkg.Name())
}
}

if mode == modeAny || mode == modeRepo {
fmt.Println(bold(cyan("::") + bold(" Searching databases for updates...")))
wg.Add(1)
Expand Down

0 comments on commit b08e505

Please sign in to comment.