Revert "Merge pull request #778 from Morganamilo/group-transactions"

This reverts commit 6cd47dd83c, reversing
changes made to 16fddae8b6.

Signed-off-by: Jguer <me@jguer.space>
This commit is contained in:
Jguer 2019-10-04 19:33:54 +01:00
parent 99d1df6f1d
commit 2214bc0cb2
No known key found for this signature in database
GPG Key ID: 6D6CC9BEA8556B35
5 changed files with 76 additions and 143 deletions

View File

@ -45,7 +45,7 @@ func cleanRemove(pkgNames []string) (err error) {
return nil
}
arguments := cmdArgs.copyGlobal()
arguments := makeArguments()
arguments.addArg("R")
arguments.addTarget(pkgNames...)

2
cmd.go
View File

@ -350,7 +350,7 @@ func displayNumberMenu(pkgS []string) (err error) {
}
include, exclude, _, otherExclude := parseNumberMenu(string(numberBuf))
arguments := cmdArgs.copyGlobal()
arguments := makeArguments()
isInclude := len(exclude) == 0 && len(otherExclude) == 0

View File

@ -47,7 +47,6 @@ type Configuration struct {
TarBin string `json:"tarbin"`
ReDownload string `json:"redownload"`
ReBuild string `json:"rebuild"`
BatchInstall bool `json:"batchinstall"`
AnswerClean string `json:"answerclean"`
AnswerDiff string `json:"answerdiff"`
AnswerEdit string `json:"answeredit"`
@ -166,7 +165,6 @@ func defaultSettings() *Configuration {
RequestSplitN: 150,
ReDownload: "no",
ReBuild: "no",
BatchInstall: false,
AnswerClean: "",
AnswerDiff: "",
AnswerEdit: "",

View File

@ -13,38 +13,6 @@ import (
gosrc "github.com/Morganamilo/go-srcinfo"
)
func asdeps(parser *arguments, pkgs []string) error {
if len(pkgs) == 0 {
return nil
}
parser = parser.copyGlobal()
parser.addArg("D", "asdeps")
parser.addTarget(pkgs...)
_, stderr, err := capture(passToPacman(parser))
if err != nil {
return fmt.Errorf("%s%s", stderr, err)
}
return nil
}
func asexp(parser *arguments, pkgs []string) error {
if len(pkgs) == 0 {
return nil
}
parser = parser.copyGlobal()
parser.addArg("D", "asexplicit")
parser.addTarget(pkgs...)
_, stderr, err := capture(passToPacman(parser))
if err != nil {
return fmt.Errorf("%s%s", stderr, err)
}
return nil
}
// Install handles package installs
func install(parser *arguments) (err error) {
var incompatible stringSet
@ -314,27 +282,36 @@ func install(parser *arguments) (err error) {
return fmt.Errorf("Error installing repo packages")
}
deps := make([]string, 0)
exp := make([]string, 0)
depArguments := makeArguments()
depArguments.addArg("D", "asdeps")
expArguments := makeArguments()
expArguments.addArg("D", "asexplicit")
for _, pkg := range dp.Repo {
for _, pkg := range do.Repo {
if !dp.Explicit.get(pkg.Name()) && !localNamesCache.get(pkg.Name()) && !remoteNamesCache.get(pkg.Name()) {
deps = append(deps, pkg.Name())
depArguments.addTarget(pkg.Name())
continue
}
if parser.existsArg("asdeps", "asdep") && dp.Explicit.get(pkg.Name()) {
deps = append(deps, pkg.Name())
depArguments.addTarget(pkg.Name())
} else if parser.existsArg("asexp", "asexplicit") && dp.Explicit.get(pkg.Name()) {
exp = append(exp, pkg.Name())
expArguments.addTarget(pkg.Name())
}
}
if err = asdeps(parser, deps); err != nil {
return err
if len(depArguments.targets) > 0 {
_, stderr, err := capture(passToPacman(depArguments))
if err != nil {
return fmt.Errorf("%s%s", stderr, err)
}
}
if err = asexp(parser, exp); err != nil {
return err
if len(expArguments.targets) > 0 {
_, stderr, err := capture(passToPacman(expArguments))
if err != nil {
return fmt.Errorf("%s%s", stderr, err)
}
}
}
@ -916,81 +893,11 @@ func downloadPkgbuildsSources(bases []Base, incompatible stringSet) (err error)
}
func buildInstallPkgbuilds(dp *depPool, do *depOrder, srcinfos map[string]*gosrc.Srcinfo, parser *arguments, incompatible stringSet, conflicts mapStringSet) error {
arguments := parser.copy()
arguments.clearTargets()
arguments.op = "U"
arguments.delArg("confirm")
arguments.delArg("noconfirm")
arguments.delArg("c", "clean")
arguments.delArg("q", "quiet")
arguments.delArg("q", "quiet")
arguments.delArg("y", "refresh")
arguments.delArg("u", "sysupgrade")
arguments.delArg("w", "downloadonly")
deps := make([]string, 0)
exp := make([]string, 0)
oldConfirm := config.NoConfirm
config.NoConfirm = true
doInstall := func() error {
if len(arguments.targets) == 0 {
return nil
}
err := show(passToPacman(arguments))
if err != nil {
return err
}
err = saveVCSInfo()
if err != nil {
fmt.Fprintln(os.Stderr, err)
}
if err = asdeps(parser, deps); err != nil {
return err
}
if err = asexp(parser, exp); err != nil {
return err
}
config.NoConfirm = oldConfirm
arguments.clearTargets()
deps = make([]string, 0)
exp = make([]string, 0)
config.NoConfirm = true
return nil
}
for _, base := range do.Aur {
var err error
pkg := base.Pkgbase()
dir := filepath.Join(config.BuildDir, pkg)
built := true
satisfied := true
all:
for _, pkg := range base {
for _, deps := range [3][]string{pkg.Depends, pkg.MakeDepends, pkg.CheckDepends} {
for _, dep := range deps {
if _, err := dp.LocalDB.PkgCache().FindSatisfier(dep); err != nil {
satisfied = false
fmt.Printf("%s not satisfied, flushing install queue", dep)
break all
}
}
}
}
if !satisfied || !config.BatchInstall {
err = doInstall()
if err != nil {
return err
}
}
srcinfo := srcinfos[pkg]
args := []string{"--nobuild", "-fC"}
@ -1000,7 +907,7 @@ func buildInstallPkgbuilds(dp *depPool, do *depOrder, srcinfos map[string]*gosrc
}
//pkgver bump
err = show(passToMakepkg(dir, args...))
err := show(passToMakepkg(dir, args...))
if err != nil {
return fmt.Errorf("Error making: %s", base.String())
}
@ -1064,20 +971,43 @@ func buildInstallPkgbuilds(dp *depPool, do *depOrder, srcinfos map[string]*gosrc
}
}
arguments := parser.copy()
arguments.clearTargets()
arguments.op = "U"
arguments.delArg("confirm")
arguments.delArg("noconfirm")
arguments.delArg("c", "clean")
arguments.delArg("q", "quiet")
arguments.delArg("q", "quiet")
arguments.delArg("y", "refresh")
arguments.delArg("u", "sysupgrade")
arguments.delArg("w", "downloadonly")
oldConfirm := config.NoConfirm
//conflicts have been checked so answer y for them
if config.UseAsk {
ask, _ := strconv.Atoi(cmdArgs.globals["ask"])
uask := alpm.QuestionType(ask) | alpm.QuestionTypeConflictPkg
cmdArgs.globals["ask"] = fmt.Sprint(uask)
} else {
conflict := false
for _, split := range base {
if _, ok := conflicts[split.Name]; ok {
config.NoConfirm = false
break
conflict = true
}
}
if !conflict {
config.NoConfirm = true
}
}
depArguments := makeArguments()
depArguments.addArg("D", "asdeps")
expArguments := makeArguments()
expArguments.addArg("D", "asexplicit")
//remotenames: names of all non repo packages on the system
_, _, localNames, remoteNames, err := filterPackages()
if err != nil {
@ -1096,13 +1026,22 @@ func buildInstallPkgbuilds(dp *depPool, do *depOrder, srcinfos map[string]*gosrc
}
arguments.addTarget(pkgdest)
if parser.existsArg("asdeps", "asdep") {
deps = append(deps, split.Name)
} else if parser.existsArg("asexplicit", "asexp") {
exp = append(exp, split.Name)
} else if !dp.Explicit.get(split.Name) && !localNamesCache.get(split.Name) && !remoteNamesCache.get(split.Name) {
deps = append(deps, split.Name)
if !dp.Explicit.get(split.Name) && !localNamesCache.get(split.Name) && !remoteNamesCache.get(split.Name) {
depArguments.addTarget(split.Name)
}
if dp.Explicit.get(split.Name) {
if parser.existsArg("asdeps", "asdep") {
depArguments.addTarget(split.Name)
} else if parser.existsArg("asexplicit", "asexp") {
expArguments.addTarget(split.Name)
}
}
}
err = show(passToPacman(arguments))
if err != nil {
return err
}
var mux sync.Mutex
@ -1113,9 +1052,20 @@ func buildInstallPkgbuilds(dp *depPool, do *depOrder, srcinfos map[string]*gosrc
}
wg.Wait()
err = saveVCSInfo()
if err != nil {
fmt.Fprintln(os.Stderr, err)
}
if len(depArguments.targets) > 0 {
_, stderr, err := capture(passToPacman(depArguments))
if err != nil {
return fmt.Errorf("%s%s", stderr, err)
}
}
config.NoConfirm = oldConfirm
}
err := doInstall()
config.NoConfirm = oldConfirm
return err
return nil
}

View File

@ -88,15 +88,6 @@ func makeArguments() *arguments {
}
}
func (parser *arguments) copyGlobal() (cp *arguments) {
cp = makeArguments()
for k, v := range parser.globals {
cp.globals[k] = v
}
return
}
func (parser *arguments) copy() (cp *arguments) {
cp = makeArguments()
@ -449,8 +440,6 @@ func isArg(arg string) bool {
case "rebuildall":
case "rebuildtree":
case "norebuild":
case "batchinstall":
case "nobatchinstall":
case "answerclean":
case "noanswerclean":
case "answerdiff":
@ -557,10 +546,6 @@ func handleConfig(option, value string) bool {
config.ReBuild = "tree"
case "norebuild":
config.ReBuild = "no"
case "batchinstall":
config.BatchInstall = true
case "nobatchinstall":
config.BatchInstall = false
case "answerclean":
config.AnswerClean = value
case "noanswerclean":