mirror of
https://github.com/Jguer/yay
synced 2024-10-05 23:59:13 +00:00
Pass -Su
to pacman during sysupgrade
Previosly during `yay -Su` Yay would pass `pacman -S <packages that need upgrade>` to pacman. Instead pass `pacman -Su --ignore <number menu choices>` This allows yay to handle replaces and package downgrades `-Suu`
This commit is contained in:
parent
bb211fdbf7
commit
98ea801004
10
install.go
10
install.go
|
@ -64,27 +64,23 @@ func install(parser *arguments) error {
|
|||
|
||||
//create the arguments to pass for the repo install
|
||||
arguments := parser.copy()
|
||||
arguments.delArg("u", "sysupgrade")
|
||||
arguments.delArg("y", "refresh")
|
||||
arguments.op = "S"
|
||||
arguments.targets = make(stringSet)
|
||||
|
||||
if parser.existsArg("u", "sysupgrade") {
|
||||
repoUp, aurUp, err := upgradePkgs(dt)
|
||||
ignore, aurUp, err := upgradePkgs(dt)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
arguments.addParam("ignore", strings.Join(ignore.toSlice(), ","))
|
||||
fmt.Println()
|
||||
|
||||
for pkg := range aurUp {
|
||||
parser.addTarget(pkg)
|
||||
}
|
||||
|
||||
for pkg := range repoUp {
|
||||
arguments.addTarget(pkg)
|
||||
}
|
||||
|
||||
//discard stuff thats
|
||||
//not a target and
|
||||
//not an upgrade and
|
||||
|
@ -184,7 +180,7 @@ func install(parser *arguments) error {
|
|||
}
|
||||
}
|
||||
|
||||
if !parser.existsArg("gendb") && len(arguments.targets) > 0 {
|
||||
if !parser.existsArg("gendb") && (len(arguments.targets) > 0 || arguments.existsArg("u")) {
|
||||
err := passToPacman(arguments)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error installing repo packages")
|
||||
|
|
21
upgrade.go
21
upgrade.go
|
@ -281,14 +281,14 @@ func removeIntListFromList(src, target []int) []int {
|
|||
|
||||
// upgradePkgs handles updating the cache and installing updates.
|
||||
func upgradePkgs(dt *depTree) (stringSet, stringSet, error) {
|
||||
repoNames := make(stringSet)
|
||||
ignore := make(stringSet)
|
||||
aurNames := make(stringSet)
|
||||
|
||||
aurUp, repoUp, err := upList(dt)
|
||||
if err != nil {
|
||||
return repoNames, aurNames, err
|
||||
return ignore, aurNames, err
|
||||
} else if len(aurUp)+len(repoUp) == 0 {
|
||||
return repoNames, aurNames, err
|
||||
return ignore, aurNames, err
|
||||
}
|
||||
|
||||
sort.Sort(repoUp)
|
||||
|
@ -298,13 +298,10 @@ func upgradePkgs(dt *depTree) (stringSet, stringSet, error) {
|
|||
aurUp.Print(1)
|
||||
|
||||
if config.NoConfirm {
|
||||
for _, up := range repoUp {
|
||||
repoNames.set(up.Name)
|
||||
}
|
||||
for _, up := range aurUp {
|
||||
aurNames.set(up.Name)
|
||||
}
|
||||
return repoNames, aurNames, nil
|
||||
return ignore, aurNames, nil
|
||||
}
|
||||
|
||||
fmt.Println(bold(green(arrow + " Packages to not upgrade (eg: 1 2 3, 1-3, ^4 or repo name)")))
|
||||
|
@ -329,16 +326,18 @@ func upgradePkgs(dt *depTree) (stringSet, stringSet, error) {
|
|||
|
||||
for i, pkg := range repoUp {
|
||||
if isInclude && otherInclude.get(pkg.Repository) {
|
||||
continue
|
||||
ignore.set(pkg.Name)
|
||||
}
|
||||
|
||||
if isInclude && !include.get(len(repoUp)-i+len(aurUp)) {
|
||||
repoNames.set(pkg.Name)
|
||||
continue
|
||||
}
|
||||
|
||||
if !isInclude && (exclude.get(len(repoUp)-i+len(aurUp)) || otherExclude.get(pkg.Repository)) {
|
||||
repoNames.set(pkg.Name)
|
||||
continue
|
||||
}
|
||||
|
||||
ignore.set(pkg.Name)
|
||||
}
|
||||
|
||||
for i, pkg := range aurUp {
|
||||
|
@ -355,5 +354,5 @@ func upgradePkgs(dt *depTree) (stringSet, stringSet, error) {
|
|||
}
|
||||
}
|
||||
|
||||
return repoNames, aurNames, err
|
||||
return ignore, aurNames, err
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue