Merge branch 'updateIgnore'

This commit is contained in:
Jguer 2017-10-30 21:41:50 +09:00
commit 97bb7d0a9c

View File

@ -141,18 +141,18 @@ loop:
return return
} }
func isIgnored(pkg alpm.Package) bool { func isIgnored(name string, groups []string, oldVersion string, newVersion string) bool {
for _, p := range alpmConf.IgnorePkg { for _, p := range alpmConf.IgnorePkg {
if p == pkg.Name() { if p == name {
fmt.Printf("\x1b[33mwarning:\x1b[0m %s (ignored pkg) ignoring upgrade (%s)\n", pkg.Name(), pkg.Version()) fmt.Printf("\x1b[33mwarning:\x1b[0m %s (ignored pkg) ignoring upgrade (%s -> %s)\n", name, oldVersion, newVersion)
return true return true
} }
} }
for _, g := range alpmConf.IgnoreGroup { for _, g := range alpmConf.IgnoreGroup {
for _, pg := range pkg.Groups().Slice() { for _, pg := range groups {
if g == pg { if g == pg {
fmt.Printf("\x1b[33mwarning:\x1b[0m %s (ignored pkg) ignoring upgrade (%s)\n", pkg.Name(), pkg.Version()) fmt.Printf("\x1b[33mwarning:\x1b[0m %s (ignored pkg) ignoring upgrade (%s -> %s)\n", name, oldVersion, newVersion)
return true return true
} }
} }
@ -170,7 +170,7 @@ func upDevel(remoteNames []string, packageC chan upgrade, done chan bool) {
found = true found = true
} }
} }
if found { if found && !isIgnored(e.Package, nil, e.SHA[0:6], "git") {
packageC <- upgrade{e.Package, "devel", e.SHA[0:6], "git"} packageC <- upgrade{e.Package, "devel", e.SHA[0:6], "git"}
} else { } else {
removeVCSPackage([]string{e.Package}) removeVCSPackage([]string{e.Package})
@ -218,16 +218,15 @@ func upAUR(remote []alpm.Package, remoteNames []string) (toUpgrade upSlice, err
var missing, x int var missing, x int
for i := range local { for i := range local {
if isIgnored(local[i]) {
continue
}
x = i - missing x = i - missing
if x > max { if x > max {
break break
} else if qtemp[x].Name == local[i].Name() { } else if qtemp[x].Name == local[i].Name() {
if (config.TimeUpdate && (int64(qtemp[x].LastModified) > local[i].BuildDate().Unix())) || if (config.TimeUpdate && (int64(qtemp[x].LastModified) > local[i].BuildDate().Unix())) ||
(alpm.VerCmp(local[i].Version(), qtemp[x].Version) < 0) { (alpm.VerCmp(local[i].Version(), qtemp[x].Version) < 0) {
packageC <- upgrade{qtemp[x].Name, "aur", local[i].Version(), qtemp[x].Version} if !isIgnored(local[i].Name(), local[i].Groups().Slice(), local[i].Version(), qtemp[x].Version) {
packageC <- upgrade{qtemp[x].Name, "aur", local[i].Version(), qtemp[x].Version}
}
} }
continue continue
} else { } else {
@ -268,12 +267,9 @@ func upRepo(local []alpm.Package) (upSlice, error) {
slice := upSlice{} slice := upSlice{}
for _, pkg := range local { for _, pkg := range local {
if isIgnored(pkg) {
continue
}
newPkg := pkg.NewVersion(dbList) newPkg := pkg.NewVersion(dbList)
if newPkg != nil { if newPkg != nil && !isIgnored(pkg.Name(), pkg.Groups().Slice(), pkg.Version(), newPkg.Version()) {
slice = append(slice, upgrade{pkg.Name(), newPkg.DB().Name(), pkg.Version(), newPkg.Version()}) slice = append(slice, upgrade{pkg.Name(), newPkg.DB().Name(), pkg.Version(), newPkg.Version()})
} }
} }