Merge pull request #348 from Morganamilo/fix#347

Don't mark repo upgrades as deps during sysupgrade
This commit is contained in:
Morgana 2018-04-11 05:36:52 +01:00 committed by GitHub
commit 53a31c2437
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 5 deletions

View File

@ -187,7 +187,7 @@ func editor() (string, []string) {
fallthrough fallthrough
default: default:
fmt.Println() fmt.Println()
fmt.Println(bold(red(arrow) + " Warning:"), cyan("$EDITOR"), "is not set") fmt.Println(bold(red(arrow)+" Warning:"), cyan("$EDITOR"), "is not set")
fmt.Println(bold(arrow) + " Please add " + cyan("$EDITOR") + " or " + cyan("$VISUAL") + " to your environment variables.") fmt.Println(bold(arrow) + " Please add " + cyan("$EDITOR") + " or " + cyan("$VISUAL") + " to your environment variables.")
for { for {

View File

@ -29,7 +29,7 @@ func install(parser *arguments) error {
srcinfos := make(map[string]*gopkg.PKGBUILD) srcinfos := make(map[string]*gopkg.PKGBUILD)
//remotenames: names of all non repo packages on the system //remotenames: names of all non repo packages on the system
_, _, _, remoteNames, err := filterPackages() _, _, localNames, remoteNames, err := filterPackages()
if err != nil { if err != nil {
return err return err
} }
@ -37,6 +37,7 @@ func install(parser *arguments) error {
//cache as a stringset. maybe make it return a string set in the first //cache as a stringset. maybe make it return a string set in the first
//place //place
remoteNamesCache := sliceToStringSet(remoteNames) remoteNamesCache := sliceToStringSet(remoteNames)
localNamesCache := sliceToStringSet(localNames)
//if we are doing -u also request all packages needing update //if we are doing -u also request all packages needing update
if parser.existsArg("u", "sysupgrade") { if parser.existsArg("u", "sysupgrade") {
@ -103,6 +104,7 @@ func install(parser *arguments) error {
for _, up := range repoUp { for _, up := range repoUp {
if !ignore.get(up.Name) { if !ignore.get(up.Name) {
requestTargets = append(requestTargets, up.Name) requestTargets = append(requestTargets, up.Name)
parser.addTarget(up.Name)
} }
} }
@ -209,7 +211,7 @@ func install(parser *arguments) error {
depArguments.addArg("D", "asdeps") depArguments.addArg("D", "asdeps")
for _, pkg := range dc.Repo { for _, pkg := range dc.Repo {
if !parser.targets.get(pkg.Name()) { if !parser.targets.get(pkg.Name()) && !localNamesCache.get(pkg.Name()) && !remoteNamesCache.get(pkg.Name()) {
depArguments.addTarget(pkg.Name()) depArguments.addTarget(pkg.Name())
} }
} }
@ -650,6 +652,17 @@ func buildInstallPkgBuilds(pkgs []*rpc.Pkg, srcinfos map[string]*gopkg.PKGBUILD,
depArguments := makeArguments() depArguments := makeArguments()
depArguments.addArg("D", "asdeps") depArguments.addArg("D", "asdeps")
//remotenames: names of all non repo packages on the system
_, _, localNames, remoteNames, err := filterPackages()
if err != nil {
return err
}
//cache as a stringset. maybe make it return a string set in the first
//place
remoteNamesCache := sliceToStringSet(remoteNames)
localNamesCache := sliceToStringSet(localNames)
for _, split := range bases[pkg.PackageBase] { for _, split := range bases[pkg.PackageBase] {
file, err := completeFileName(dir, split.Name+"-"+version.String()+"-"+arch+".pkg") file, err := completeFileName(dir, split.Name+"-"+version.String()+"-"+arch+".pkg")
if err != nil { if err != nil {
@ -668,14 +681,15 @@ func buildInstallPkgBuilds(pkgs []*rpc.Pkg, srcinfos map[string]*gopkg.PKGBUILD,
} }
arguments.addTarget(file) arguments.addTarget(file)
if !targets.get(split.Name) { //if !targets.get(split.Name) {
if !targets.get(split.Name) && !localNamesCache.get(split.Name) && !remoteNamesCache.get(split.Name) {
depArguments.addTarget(split.Name) depArguments.addTarget(split.Name)
} }
} }
oldConfirm := config.NoConfirm oldConfirm := config.NoConfirm
config.NoConfirm = true config.NoConfirm = true
err := passToPacman(arguments) err = passToPacman(arguments)
if err != nil { if err != nil {
return err return err
} }