Skip to content

Commit

Permalink
Merge pull request #240 from Morganamilo/ignore
Browse files Browse the repository at this point in the history
Respect --ignore and --ignoregroup flags
  • Loading branch information
Morganamilo authored Mar 12, 2018
2 parents e86e39a + 7419630 commit 7de404b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
11 changes: 11 additions & 0 deletions cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,17 @@ func initAlpm() (err error) {
alpmConf.Architecture = value
}

value, _, exists = cmdArgs.getArg("ignore")
if exists {
alpmConf.IgnorePkg = append(alpmConf.IgnorePkg, strings.Split(value, ",")...)
}

value, _, exists = cmdArgs.getArg("ignoregroup")
if exists {
alpmConf.IgnoreGroup = append(alpmConf.IgnoreGroup, strings.Split(value, ",")...)
}


//TODO
//current system does not allow duplicate arguments
//but pacman allows multiple cachdirs to be passed
Expand Down
6 changes: 4 additions & 2 deletions upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,9 @@ func upDevel(remote []alpm.Package, packageC chan upgrade, done chan bool) {
}
if found {
if pkg.ShouldIgnore() {
left, right := getVersionDiff(pkg.Version(), "latest-commit")
fmt.Print(magenta("Warning: "))
fmt.Printf("%s ignoring package upgrade (%s => %s)\n", cyan(pkg.Name()), pkg.Version(), "git")
fmt.Printf("%s ignoring package upgrade (%s => %s)\n", cyan(pkg.Name()), left, right)
} else {
packageC <- upgrade{pkg.Name(), "devel", pkg.Version(), "latest-commit"}
}
Expand Down Expand Up @@ -229,8 +230,9 @@ func upRepo(local []alpm.Package) (upSlice, error) {
newPkg := pkg.NewVersion(dbList)
if newPkg != nil {
if pkg.ShouldIgnore() {
left, right := getVersionDiff(pkg.Version(), newPkg.Version())
fmt.Print(magenta("Warning: "))
fmt.Printf("%s ignoring package upgrade (%s => %s)\n", pkg.Name(), pkg.Version(), newPkg.Version())
fmt.Printf("%s ignoring package upgrade (%s => %s)\n", cyan(pkg.Name()), left, right)
} else {
slice = append(slice, upgrade{pkg.Name(), newPkg.DB().Name(), pkg.Version(), newPkg.Version()})
}
Expand Down

0 comments on commit 7de404b

Please sign in to comment.