2017-08-02 17:24:03 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"os"
|
|
|
|
"os/exec"
|
2018-03-28 14:52:20 +00:00
|
|
|
"path/filepath"
|
2018-02-16 21:45:19 +00:00
|
|
|
"strconv"
|
2018-02-21 08:41:25 +00:00
|
|
|
"strings"
|
2018-08-02 15:49:30 +00:00
|
|
|
"sync"
|
2017-08-02 17:24:03 +00:00
|
|
|
|
2019-04-23 15:53:20 +00:00
|
|
|
alpm "github.com/Jguer/go-alpm"
|
2019-10-05 01:02:30 +00:00
|
|
|
"github.com/Jguer/yay/v9/pkg/completion"
|
2019-10-16 21:36:08 +00:00
|
|
|
"github.com/Jguer/yay/v9/pkg/intrange"
|
2019-10-16 21:38:54 +00:00
|
|
|
"github.com/Jguer/yay/v9/pkg/multierror"
|
2019-10-16 21:25:40 +00:00
|
|
|
"github.com/Jguer/yay/v9/pkg/stringset"
|
2019-06-11 13:54:24 +00:00
|
|
|
gosrc "github.com/Morganamilo/go-srcinfo"
|
2017-08-02 17:24:03 +00:00
|
|
|
)
|
|
|
|
|
2019-10-10 14:55:43 +00:00
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2018-01-20 22:37:10 +00:00
|
|
|
// Install handles package installs
|
2019-06-11 13:54:24 +00:00
|
|
|
func install(parser *arguments) (err error) {
|
2019-10-16 21:25:40 +00:00
|
|
|
var incompatible stringset.StringSet
|
2019-01-15 18:41:38 +00:00
|
|
|
var do *depOrder
|
2018-03-21 00:26:56 +00:00
|
|
|
|
2018-03-29 02:42:11 +00:00
|
|
|
var aurUp upSlice
|
|
|
|
var repoUp upSlice
|
|
|
|
|
2018-08-11 04:00:46 +00:00
|
|
|
var srcinfos map[string]*gosrc.Srcinfo
|
2018-04-11 03:43:51 +00:00
|
|
|
|
2019-11-11 07:15:04 +00:00
|
|
|
warnings := makeWarnings()
|
2018-03-29 02:42:11 +00:00
|
|
|
|
2018-09-14 19:18:59 +00:00
|
|
|
if mode == modeAny || mode == modeRepo {
|
2018-06-22 13:44:38 +00:00
|
|
|
if config.CombinedUpgrade {
|
|
|
|
if parser.existsArg("y", "refresh") {
|
2018-07-19 18:53:17 +00:00
|
|
|
err = earlyRefresh(parser)
|
2018-06-22 13:44:38 +00:00
|
|
|
if err != nil {
|
2018-07-19 18:53:17 +00:00
|
|
|
return fmt.Errorf("Error refreshing databases")
|
2018-06-22 13:44:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if parser.existsArg("y", "refresh") || parser.existsArg("u", "sysupgrade") || len(parser.targets) > 0 {
|
2018-07-19 18:53:17 +00:00
|
|
|
err = earlyPacmanCall(parser)
|
2018-06-22 13:44:38 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2018-07-19 18:53:17 +00:00
|
|
|
}
|
|
|
|
}
|
2018-06-22 13:44:38 +00:00
|
|
|
|
2018-07-19 18:53:17 +00:00
|
|
|
//we may have done -Sy, our handle now has an old
|
|
|
|
//database.
|
|
|
|
err = initAlpmHandle()
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2018-06-22 13:44:38 +00:00
|
|
|
|
2018-07-19 18:53:17 +00:00
|
|
|
_, _, localNames, remoteNames, err := filterPackages()
|
|
|
|
if err != nil {
|
|
|
|
return err
|
2018-06-22 13:44:38 +00:00
|
|
|
}
|
|
|
|
|
2019-10-16 21:58:55 +00:00
|
|
|
remoteNamesCache := stringset.FromSlice(remoteNames)
|
|
|
|
localNamesCache := stringset.FromSlice(localNames)
|
2018-07-19 18:53:17 +00:00
|
|
|
|
2018-06-22 13:44:38 +00:00
|
|
|
requestTargets := parser.copy().targets
|
|
|
|
|
2018-02-18 23:46:25 +00:00
|
|
|
//create the arguments to pass for the repo install
|
2018-01-04 08:13:47 +00:00
|
|
|
arguments := parser.copy()
|
2018-05-29 21:35:58 +00:00
|
|
|
arguments.delArg("asdeps", "asdep")
|
|
|
|
arguments.delArg("asexplicit", "asexp")
|
2018-01-21 11:48:09 +00:00
|
|
|
arguments.op = "S"
|
2018-06-02 14:01:39 +00:00
|
|
|
arguments.clearTargets()
|
2018-02-21 08:41:25 +00:00
|
|
|
|
2018-09-14 19:18:59 +00:00
|
|
|
if mode == modeAUR {
|
2018-05-31 15:23:15 +00:00
|
|
|
arguments.delArg("u", "sysupgrade")
|
|
|
|
}
|
|
|
|
|
2018-05-30 02:21:17 +00:00
|
|
|
//if we are doing -u also request all packages needing update
|
2018-02-18 23:46:25 +00:00
|
|
|
if parser.existsArg("u", "sysupgrade") {
|
2018-05-30 02:21:17 +00:00
|
|
|
aurUp, repoUp, err = upList(warnings)
|
2018-01-04 00:59:57 +00:00
|
|
|
if err != nil {
|
2018-02-18 23:46:25 +00:00
|
|
|
return err
|
2018-01-04 00:59:57 +00:00
|
|
|
}
|
2018-01-20 22:37:10 +00:00
|
|
|
|
2018-05-30 02:21:17 +00:00
|
|
|
warnings.print()
|
|
|
|
|
|
|
|
ignore, aurUp, err := upgradePkgs(aurUp, repoUp)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2018-04-04 20:51:57 +00:00
|
|
|
|
|
|
|
for _, up := range repoUp {
|
2019-10-05 17:39:31 +00:00
|
|
|
if !ignore.Get(up.Name) {
|
2018-04-04 20:51:57 +00:00
|
|
|
requestTargets = append(requestTargets, up.Name)
|
2018-04-11 03:53:33 +00:00
|
|
|
parser.addTarget(up.Name)
|
2018-04-04 20:51:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for up := range aurUp {
|
2018-08-09 21:28:27 +00:00
|
|
|
requestTargets = append(requestTargets, "aur/"+up)
|
2018-08-03 22:15:01 +00:00
|
|
|
parser.addTarget("aur/" + up)
|
2018-04-04 20:51:57 +00:00
|
|
|
}
|
|
|
|
|
2018-05-11 23:12:33 +00:00
|
|
|
value, _, exists := cmdArgs.getArg("ignore")
|
2018-05-11 23:24:47 +00:00
|
|
|
|
|
|
|
if len(ignore) > 0 {
|
2019-10-05 17:39:31 +00:00
|
|
|
ignoreStr := strings.Join(ignore.ToSlice(), ",")
|
2018-05-11 23:24:47 +00:00
|
|
|
if exists {
|
|
|
|
ignoreStr += "," + value
|
|
|
|
}
|
|
|
|
arguments.options["ignore"] = ignoreStr
|
2018-05-11 23:12:33 +00:00
|
|
|
}
|
2018-02-18 23:46:25 +00:00
|
|
|
}
|
|
|
|
|
2019-10-16 21:58:55 +00:00
|
|
|
targets := stringset.FromSlice(parser.targets)
|
2018-06-02 14:01:39 +00:00
|
|
|
|
2019-01-15 18:41:38 +00:00
|
|
|
dp, err := getDepPool(requestTargets, warnings)
|
2018-05-10 13:36:38 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2019-01-15 18:41:38 +00:00
|
|
|
err = dp.CheckMissing()
|
2018-05-10 13:36:38 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2018-06-11 18:48:20 +00:00
|
|
|
|
2019-01-15 18:41:38 +00:00
|
|
|
if len(dp.Aur) == 0 {
|
2018-07-03 12:42:13 +00:00
|
|
|
if !config.CombinedUpgrade {
|
2018-07-23 23:13:34 +00:00
|
|
|
if parser.existsArg("u", "sysupgrade") {
|
|
|
|
fmt.Println(" there is nothing to do")
|
|
|
|
}
|
2018-07-03 12:42:13 +00:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2018-06-11 17:49:35 +00:00
|
|
|
parser.op = "S"
|
2018-06-10 23:26:36 +00:00
|
|
|
parser.delArg("y", "refresh")
|
2018-06-11 17:49:35 +00:00
|
|
|
parser.options["ignore"] = arguments.options["ignore"]
|
2018-07-19 17:37:28 +00:00
|
|
|
return show(passToPacman(parser))
|
2018-06-10 23:26:36 +00:00
|
|
|
}
|
|
|
|
|
2019-03-07 20:02:44 +00:00
|
|
|
if len(dp.Aur) > 0 && os.Geteuid() == 0 {
|
2018-06-10 23:26:36 +00:00
|
|
|
return fmt.Errorf(bold(red(arrow)) + " Refusing to install AUR Packages as root, Aborting.")
|
|
|
|
}
|
2018-05-10 13:36:38 +00:00
|
|
|
|
2019-01-15 18:41:38 +00:00
|
|
|
conflicts, err := dp.CheckConflicts()
|
2018-05-10 13:36:38 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2019-01-15 18:41:38 +00:00
|
|
|
do = getDepOrder(dp)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
for _, pkg := range do.Repo {
|
2018-03-16 01:14:34 +00:00
|
|
|
arguments.addTarget(pkg.DB().Name() + "/" + pkg.Name())
|
2018-02-19 19:38:34 +00:00
|
|
|
}
|
2018-01-20 22:37:10 +00:00
|
|
|
|
2019-01-15 18:41:38 +00:00
|
|
|
for _, pkg := range dp.Groups {
|
2018-03-16 19:30:14 +00:00
|
|
|
arguments.addTarget(pkg)
|
2018-03-16 01:14:34 +00:00
|
|
|
}
|
2018-01-17 21:48:23 +00:00
|
|
|
|
2019-01-15 18:41:38 +00:00
|
|
|
if len(do.Aur) == 0 && len(arguments.targets) == 0 && (!parser.existsArg("u", "sysupgrade") || mode == modeAUR) {
|
2018-07-19 21:36:06 +00:00
|
|
|
fmt.Println(" there is nothing to do")
|
2018-02-20 01:23:16 +00:00
|
|
|
return nil
|
|
|
|
}
|
2018-02-16 17:18:59 +00:00
|
|
|
|
2019-01-15 18:41:38 +00:00
|
|
|
do.Print()
|
2018-06-10 23:26:36 +00:00
|
|
|
fmt.Println()
|
2018-02-16 21:45:19 +00:00
|
|
|
|
2019-06-11 13:54:24 +00:00
|
|
|
if config.CleanAfter {
|
|
|
|
defer cleanAfter(do.Aur)
|
|
|
|
}
|
|
|
|
|
2019-01-15 18:41:38 +00:00
|
|
|
if do.HasMake() {
|
2019-03-07 20:02:44 +00:00
|
|
|
switch config.RemoveMake {
|
|
|
|
case "yes":
|
2019-10-13 11:15:51 +00:00
|
|
|
defer func() {
|
|
|
|
err = removeMake(do)
|
|
|
|
}()
|
|
|
|
|
2019-03-07 20:02:44 +00:00
|
|
|
case "no":
|
2019-06-11 13:54:24 +00:00
|
|
|
break
|
2019-03-07 20:02:44 +00:00
|
|
|
default:
|
2019-06-11 13:54:24 +00:00
|
|
|
if continueTask("Remove make dependencies after install?", false) {
|
2019-10-13 11:15:51 +00:00
|
|
|
defer func() {
|
|
|
|
err = removeMake(do)
|
|
|
|
}()
|
2019-06-11 13:54:24 +00:00
|
|
|
}
|
2018-06-10 23:26:36 +00:00
|
|
|
}
|
|
|
|
}
|
2018-04-11 03:43:51 +00:00
|
|
|
|
2018-06-10 23:26:36 +00:00
|
|
|
if config.CleanMenu {
|
2019-01-15 18:41:38 +00:00
|
|
|
if anyExistInCache(do.Aur) {
|
|
|
|
askClean := pkgbuildNumberMenu(do.Aur, remoteNamesCache)
|
|
|
|
toClean, err := cleanNumberMenu(do.Aur, remoteNamesCache, askClean)
|
2018-08-18 19:50:20 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2018-01-20 22:37:10 +00:00
|
|
|
|
2018-08-18 19:50:20 +00:00
|
|
|
cleanBuilds(toClean)
|
|
|
|
}
|
2018-06-10 23:26:36 +00:00
|
|
|
}
|
2018-04-11 15:47:00 +00:00
|
|
|
|
2019-01-15 18:41:38 +00:00
|
|
|
toSkip := pkgbuildsToSkip(do.Aur, targets)
|
|
|
|
cloned, err := downloadPkgbuilds(do.Aur, toSkip, config.BuildDir)
|
2018-06-10 23:26:36 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2018-08-10 03:40:27 +00:00
|
|
|
var toDiff []Base
|
|
|
|
var toEdit []Base
|
2018-02-15 20:51:18 +00:00
|
|
|
|
2018-06-10 23:26:36 +00:00
|
|
|
if config.DiffMenu {
|
2019-01-15 18:41:38 +00:00
|
|
|
pkgbuildNumberMenu(do.Aur, remoteNamesCache)
|
|
|
|
toDiff, err = diffNumberMenu(do.Aur, remoteNamesCache)
|
2018-02-16 15:33:17 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2018-06-10 01:02:24 +00:00
|
|
|
|
2018-06-10 23:26:36 +00:00
|
|
|
if len(toDiff) > 0 {
|
2018-08-11 03:51:10 +00:00
|
|
|
err = showPkgbuildDiffs(toDiff, cloned)
|
2018-06-10 14:56:57 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2018-06-10 23:26:36 +00:00
|
|
|
}
|
|
|
|
}
|
2018-06-10 14:56:57 +00:00
|
|
|
|
2018-06-12 20:06:21 +00:00
|
|
|
if len(toDiff) > 0 {
|
|
|
|
oldValue := config.NoConfirm
|
|
|
|
config.NoConfirm = false
|
|
|
|
fmt.Println()
|
2018-07-21 23:46:55 +00:00
|
|
|
if !continueTask(bold(green("Proceed with install?")), true) {
|
2018-06-12 20:06:21 +00:00
|
|
|
return fmt.Errorf("Aborting due to user")
|
|
|
|
}
|
2019-10-13 11:15:51 +00:00
|
|
|
err = updatePkgbuildSeenRef(toDiff, cloned)
|
|
|
|
if err != nil {
|
2019-10-13 22:23:55 +00:00
|
|
|
fmt.Fprintln(os.Stderr, err.Error())
|
2019-10-13 11:15:51 +00:00
|
|
|
}
|
|
|
|
|
2018-06-12 20:06:21 +00:00
|
|
|
config.NoConfirm = oldValue
|
|
|
|
}
|
|
|
|
|
2019-01-15 18:41:38 +00:00
|
|
|
err = mergePkgbuilds(do.Aur)
|
2018-06-12 20:06:21 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2019-01-15 18:41:38 +00:00
|
|
|
srcinfos, err = parseSrcinfoFiles(do.Aur, true)
|
2018-07-19 21:19:24 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2018-06-10 23:26:36 +00:00
|
|
|
if config.EditMenu {
|
2019-01-15 18:41:38 +00:00
|
|
|
pkgbuildNumberMenu(do.Aur, remoteNamesCache)
|
|
|
|
toEdit, err = editNumberMenu(do.Aur, remoteNamesCache)
|
2018-06-10 23:26:36 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
2018-06-10 14:56:57 +00:00
|
|
|
}
|
|
|
|
|
2018-06-10 23:26:36 +00:00
|
|
|
if len(toEdit) > 0 {
|
2018-08-11 04:00:46 +00:00
|
|
|
err = editPkgbuilds(toEdit, srcinfos)
|
2018-03-09 22:11:30 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2018-06-10 14:56:57 +00:00
|
|
|
}
|
2018-06-10 23:26:36 +00:00
|
|
|
}
|
2018-06-10 14:56:57 +00:00
|
|
|
|
2018-06-12 20:06:21 +00:00
|
|
|
if len(toEdit) > 0 {
|
2018-06-10 23:26:36 +00:00
|
|
|
oldValue := config.NoConfirm
|
|
|
|
config.NoConfirm = false
|
|
|
|
fmt.Println()
|
2018-07-21 23:46:55 +00:00
|
|
|
if !continueTask(bold(green("Proceed with install?")), true) {
|
2018-06-10 23:26:36 +00:00
|
|
|
return fmt.Errorf("Aborting due to user")
|
2018-02-16 15:33:17 +00:00
|
|
|
}
|
2018-06-10 23:26:36 +00:00
|
|
|
config.NoConfirm = oldValue
|
|
|
|
}
|
2018-02-16 17:18:59 +00:00
|
|
|
|
2019-01-15 18:41:38 +00:00
|
|
|
incompatible, err = getIncompatible(do.Aur, srcinfos)
|
2018-06-10 23:26:36 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2018-03-19 16:51:11 +00:00
|
|
|
|
2018-06-10 23:26:36 +00:00
|
|
|
if config.PGPFetch {
|
2019-01-15 18:41:38 +00:00
|
|
|
err = checkPgpKeys(do.Aur, srcinfos)
|
2018-01-17 21:48:23 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2018-03-21 00:26:56 +00:00
|
|
|
}
|
|
|
|
|
2018-07-03 12:42:13 +00:00
|
|
|
if !config.CombinedUpgrade {
|
|
|
|
arguments.delArg("u", "sysupgrade")
|
|
|
|
}
|
|
|
|
|
2018-03-22 18:23:20 +00:00
|
|
|
if len(arguments.targets) > 0 || arguments.existsArg("u") {
|
2018-07-19 17:37:28 +00:00
|
|
|
err := show(passToPacman(arguments))
|
2018-03-21 00:26:56 +00:00
|
|
|
if err != nil {
|
|
|
|
return fmt.Errorf("Error installing repo packages")
|
|
|
|
}
|
|
|
|
|
2019-10-10 14:55:43 +00:00
|
|
|
deps := make([]string, 0)
|
|
|
|
exp := make([]string, 0)
|
2018-03-21 00:26:56 +00:00
|
|
|
|
2019-10-04 18:33:54 +00:00
|
|
|
for _, pkg := range do.Repo {
|
2019-10-05 17:39:31 +00:00
|
|
|
if !dp.Explicit.Get(pkg.Name()) && !localNamesCache.Get(pkg.Name()) && !remoteNamesCache.Get(pkg.Name()) {
|
2019-10-10 14:55:43 +00:00
|
|
|
deps = append(deps, pkg.Name())
|
2018-05-29 21:35:58 +00:00
|
|
|
continue
|
|
|
|
}
|
|
|
|
|
2019-10-05 17:39:31 +00:00
|
|
|
if parser.existsArg("asdeps", "asdep") && dp.Explicit.Get(pkg.Name()) {
|
2019-10-10 14:55:43 +00:00
|
|
|
deps = append(deps, pkg.Name())
|
2019-10-05 17:39:31 +00:00
|
|
|
} else if parser.existsArg("asexp", "asexplicit") && dp.Explicit.Get(pkg.Name()) {
|
2019-10-10 14:55:43 +00:00
|
|
|
exp = append(exp, pkg.Name())
|
2018-03-22 15:22:05 +00:00
|
|
|
}
|
2018-03-21 00:26:56 +00:00
|
|
|
}
|
|
|
|
|
2019-10-10 14:55:43 +00:00
|
|
|
if err = asdeps(parser, deps); err != nil {
|
|
|
|
return err
|
2018-03-21 00:26:56 +00:00
|
|
|
}
|
2019-10-10 14:55:43 +00:00
|
|
|
if err = asexp(parser, exp); err != nil {
|
|
|
|
return err
|
2018-05-29 21:35:58 +00:00
|
|
|
}
|
2018-03-21 00:26:56 +00:00
|
|
|
}
|
|
|
|
|
2019-10-13 11:15:51 +00:00
|
|
|
go exitOnError(completion.Update(alpmHandle, config.AURURL, cacheHome, config.CompletionInterval, false))
|
2018-07-24 13:16:12 +00:00
|
|
|
|
2019-01-15 18:41:38 +00:00
|
|
|
err = downloadPkgbuildsSources(do.Aur, incompatible)
|
2018-06-10 23:26:36 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2018-01-20 22:37:10 +00:00
|
|
|
|
2019-01-15 18:41:38 +00:00
|
|
|
err = buildInstallPkgbuilds(dp, do, srcinfos, parser, incompatible, conflicts)
|
2018-06-10 23:26:36 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2018-01-17 21:48:23 +00:00
|
|
|
|
2019-06-11 13:54:24 +00:00
|
|
|
return nil
|
|
|
|
}
|
2018-06-10 23:26:36 +00:00
|
|
|
|
2019-10-13 11:15:51 +00:00
|
|
|
func removeMake(do *depOrder) error {
|
2019-06-11 13:54:24 +00:00
|
|
|
removeArguments := makeArguments()
|
2019-10-13 11:15:51 +00:00
|
|
|
err := removeArguments.addArg("R", "u")
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2018-02-15 21:23:34 +00:00
|
|
|
|
2019-06-11 13:54:24 +00:00
|
|
|
for _, pkg := range do.getMake() {
|
|
|
|
removeArguments.addTarget(pkg)
|
2017-08-02 17:24:03 +00:00
|
|
|
}
|
2018-01-17 21:48:23 +00:00
|
|
|
|
2019-06-11 13:54:24 +00:00
|
|
|
oldValue := config.NoConfirm
|
|
|
|
config.NoConfirm = true
|
2019-10-13 11:15:51 +00:00
|
|
|
err = show(passToPacman(removeArguments))
|
2019-06-11 13:54:24 +00:00
|
|
|
config.NoConfirm = oldValue
|
2019-10-13 11:15:51 +00:00
|
|
|
|
|
|
|
return err
|
2017-08-02 17:24:03 +00:00
|
|
|
}
|
|
|
|
|
2019-02-04 16:56:02 +00:00
|
|
|
func inRepos(syncDB alpm.DBList, pkg string) bool {
|
2018-07-19 18:53:17 +00:00
|
|
|
target := toTarget(pkg)
|
|
|
|
|
2019-02-04 16:56:02 +00:00
|
|
|
if target.DB == "aur" {
|
2018-07-19 18:53:17 +00:00
|
|
|
return false
|
2019-02-04 16:56:02 +00:00
|
|
|
} else if target.DB != "" {
|
2018-07-19 18:53:17 +00:00
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
2018-10-15 23:56:19 +00:00
|
|
|
previousHideMenus := hideMenus
|
|
|
|
hideMenus = false
|
2019-02-04 16:56:02 +00:00
|
|
|
_, err := syncDB.FindSatisfier(target.DepString())
|
2018-10-15 23:56:19 +00:00
|
|
|
hideMenus = previousHideMenus
|
2018-07-19 18:53:17 +00:00
|
|
|
if err == nil {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
2019-02-14 20:44:39 +00:00
|
|
|
return !syncDB.FindGroupPkgs(target.Name).Empty()
|
2018-07-19 18:53:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func earlyPacmanCall(parser *arguments) error {
|
|
|
|
arguments := parser.copy()
|
|
|
|
arguments.op = "S"
|
|
|
|
targets := parser.targets
|
|
|
|
parser.clearTargets()
|
|
|
|
arguments.clearTargets()
|
|
|
|
|
2019-02-04 16:56:02 +00:00
|
|
|
syncDB, err := alpmHandle.SyncDBs()
|
2018-07-19 18:53:17 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2018-09-14 19:18:59 +00:00
|
|
|
if mode == modeRepo {
|
2018-07-19 18:53:17 +00:00
|
|
|
arguments.targets = targets
|
|
|
|
} else {
|
2018-10-02 20:30:18 +00:00
|
|
|
//separate aur and repo targets
|
2018-07-19 18:53:17 +00:00
|
|
|
for _, target := range targets {
|
2019-02-04 16:56:02 +00:00
|
|
|
if inRepos(syncDB, target) {
|
2018-07-19 18:53:17 +00:00
|
|
|
arguments.addTarget(target)
|
|
|
|
} else {
|
|
|
|
parser.addTarget(target)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if parser.existsArg("y", "refresh") || parser.existsArg("u", "sysupgrade") || len(arguments.targets) > 0 {
|
|
|
|
err = show(passToPacman(arguments))
|
|
|
|
if err != nil {
|
|
|
|
return fmt.Errorf("Error installing repo packages")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func earlyRefresh(parser *arguments) error {
|
|
|
|
arguments := parser.copy()
|
|
|
|
parser.delArg("y", "refresh")
|
|
|
|
arguments.delArg("u", "sysupgrade")
|
|
|
|
arguments.delArg("s", "search")
|
|
|
|
arguments.delArg("i", "info")
|
|
|
|
arguments.delArg("l", "list")
|
|
|
|
arguments.clearTargets()
|
|
|
|
return show(passToPacman(arguments))
|
|
|
|
}
|
|
|
|
|
2019-10-16 21:25:40 +00:00
|
|
|
func getIncompatible(bases []Base, srcinfos map[string]*gosrc.Srcinfo) (stringset.StringSet, error) {
|
|
|
|
incompatible := make(stringset.StringSet)
|
2018-08-11 04:21:06 +00:00
|
|
|
basesMap := make(map[string]Base)
|
2018-03-19 16:51:11 +00:00
|
|
|
alpmArch, err := alpmHandle.Arch()
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
2018-03-21 00:26:56 +00:00
|
|
|
nextpkg:
|
2018-08-10 03:40:27 +00:00
|
|
|
for _, base := range bases {
|
|
|
|
for _, arch := range srcinfos[base.Pkgbase()].Arch {
|
2018-03-19 16:51:11 +00:00
|
|
|
if arch == "any" || arch == alpmArch {
|
|
|
|
continue nextpkg
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-10-05 17:39:31 +00:00
|
|
|
incompatible.Set(base.Pkgbase())
|
2018-08-11 04:21:06 +00:00
|
|
|
basesMap[base.Pkgbase()] = base
|
2018-03-19 16:51:11 +00:00
|
|
|
}
|
|
|
|
|
2018-04-01 17:54:33 +00:00
|
|
|
if len(incompatible) > 0 {
|
2018-04-10 23:45:58 +00:00
|
|
|
fmt.Println()
|
2018-12-01 14:58:40 +00:00
|
|
|
fmt.Print(bold(yellow(arrow)) + " The following packages are not compatible with your architecture:")
|
2018-04-01 17:54:33 +00:00
|
|
|
for pkg := range incompatible {
|
2018-12-01 14:58:40 +00:00
|
|
|
fmt.Print(" " + cyan(basesMap[pkg].String()))
|
2018-03-19 16:51:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fmt.Println()
|
|
|
|
|
2018-07-21 23:46:55 +00:00
|
|
|
if !continueTask("Try to build them anyway?", true) {
|
2018-03-19 16:51:11 +00:00
|
|
|
return nil, fmt.Errorf("Aborting due to user")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-04-01 17:54:33 +00:00
|
|
|
return incompatible, nil
|
2018-03-19 16:51:11 +00:00
|
|
|
}
|
|
|
|
|
2018-06-05 13:47:55 +00:00
|
|
|
func parsePackageList(dir string) (map[string]string, string, error) {
|
2018-07-19 17:37:28 +00:00
|
|
|
stdout, stderr, err := capture(passToMakepkg(dir, "--packagelist"))
|
2018-04-12 15:39:01 +00:00
|
|
|
|
|
|
|
if err != nil {
|
2018-06-05 13:47:55 +00:00
|
|
|
return nil, "", fmt.Errorf("%s%s", stderr, err)
|
2018-04-12 15:39:01 +00:00
|
|
|
}
|
|
|
|
|
2018-06-05 13:47:55 +00:00
|
|
|
var version string
|
2018-05-31 03:37:08 +00:00
|
|
|
lines := strings.Split(stdout, "\n")
|
|
|
|
pkgdests := make(map[string]string)
|
2018-04-12 15:39:01 +00:00
|
|
|
|
2018-05-31 03:37:08 +00:00
|
|
|
for _, line := range lines {
|
|
|
|
if line == "" {
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
|
|
|
|
fileName := filepath.Base(line)
|
|
|
|
split := strings.Split(fileName, "-")
|
|
|
|
|
|
|
|
if len(split) < 4 {
|
2018-06-05 13:47:55 +00:00
|
|
|
return nil, "", fmt.Errorf("Can not find package name : %s", split)
|
2018-05-31 03:37:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// pkgname-pkgver-pkgrel-arch.pkgext
|
|
|
|
// This assumes 3 dashes after the pkgname, Will cause an error
|
|
|
|
// if the PKGEXT contains a dash. Please no one do that.
|
|
|
|
pkgname := strings.Join(split[:len(split)-3], "-")
|
2018-08-18 16:54:20 +00:00
|
|
|
version = strings.Join(split[len(split)-3:len(split)-1], "-")
|
2018-05-31 03:37:08 +00:00
|
|
|
pkgdests[pkgname] = line
|
2018-04-12 15:39:01 +00:00
|
|
|
}
|
2018-05-31 03:37:08 +00:00
|
|
|
|
2018-06-05 13:47:55 +00:00
|
|
|
return pkgdests, version, nil
|
2018-04-12 15:39:01 +00:00
|
|
|
}
|
|
|
|
|
2018-08-18 19:50:20 +00:00
|
|
|
func anyExistInCache(bases []Base) bool {
|
|
|
|
for _, base := range bases {
|
|
|
|
pkg := base.Pkgbase()
|
|
|
|
dir := filepath.Join(config.BuildDir, pkg)
|
|
|
|
|
|
|
|
if _, err := os.Stat(dir); !os.IsNotExist(err) {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
2019-10-16 21:25:40 +00:00
|
|
|
func pkgbuildNumberMenu(bases []Base, installed stringset.StringSet) bool {
|
2018-03-09 22:11:30 +00:00
|
|
|
toPrint := ""
|
|
|
|
askClean := false
|
|
|
|
|
2018-08-10 03:40:27 +00:00
|
|
|
for n, base := range bases {
|
|
|
|
pkg := base.Pkgbase()
|
|
|
|
dir := filepath.Join(config.BuildDir, pkg)
|
2018-03-09 22:11:30 +00:00
|
|
|
|
2018-08-10 03:40:27 +00:00
|
|
|
toPrint += fmt.Sprintf(magenta("%3d")+" %-40s", len(bases)-n,
|
2018-08-11 04:39:24 +00:00
|
|
|
bold(base.String()))
|
2018-08-10 03:40:27 +00:00
|
|
|
|
|
|
|
anyInstalled := false
|
|
|
|
for _, b := range base {
|
2019-10-05 17:39:31 +00:00
|
|
|
anyInstalled = anyInstalled || installed.Get(b.Name)
|
2018-08-10 03:40:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if anyInstalled {
|
2018-03-09 22:11:30 +00:00
|
|
|
toPrint += bold(green(" (Installed)"))
|
|
|
|
}
|
|
|
|
|
|
|
|
if _, err := os.Stat(dir); !os.IsNotExist(err) {
|
|
|
|
toPrint += bold(green(" (Build Files Exist)"))
|
|
|
|
askClean = true
|
|
|
|
}
|
|
|
|
|
|
|
|
toPrint += "\n"
|
|
|
|
}
|
|
|
|
|
|
|
|
fmt.Print(toPrint)
|
|
|
|
|
2018-06-10 14:56:57 +00:00
|
|
|
return askClean
|
|
|
|
}
|
2018-03-09 22:11:30 +00:00
|
|
|
|
2019-10-16 21:25:40 +00:00
|
|
|
func cleanNumberMenu(bases []Base, installed stringset.StringSet, hasClean bool) ([]Base, error) {
|
2018-08-10 03:40:27 +00:00
|
|
|
toClean := make([]Base, 0)
|
2018-03-09 22:11:30 +00:00
|
|
|
|
2018-06-10 14:56:57 +00:00
|
|
|
if !hasClean {
|
|
|
|
return toClean, nil
|
|
|
|
}
|
2018-03-09 22:11:30 +00:00
|
|
|
|
2018-06-10 14:56:57 +00:00
|
|
|
fmt.Println(bold(green(arrow + " Packages to cleanBuild?")))
|
|
|
|
fmt.Println(bold(green(arrow) + cyan(" [N]one ") + "[A]ll [Ab]ort [I]nstalled [No]tInstalled or (1 2 3, 1-3, ^4)"))
|
|
|
|
fmt.Print(bold(green(arrow + " ")))
|
|
|
|
cleanInput, err := getInput(config.AnswerClean)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
2018-03-09 22:11:30 +00:00
|
|
|
|
2019-10-16 21:36:08 +00:00
|
|
|
cInclude, cExclude, cOtherInclude, cOtherExclude := intrange.ParseNumberMenu(cleanInput)
|
2018-06-10 14:56:57 +00:00
|
|
|
cIsInclude := len(cExclude) == 0 && len(cOtherExclude) == 0
|
2018-03-09 22:11:30 +00:00
|
|
|
|
2019-10-05 17:39:31 +00:00
|
|
|
if cOtherInclude.Get("abort") || cOtherInclude.Get("ab") {
|
2018-06-10 14:56:57 +00:00
|
|
|
return nil, fmt.Errorf("Aborting due to user")
|
|
|
|
}
|
2018-03-09 22:11:30 +00:00
|
|
|
|
2019-10-05 17:39:31 +00:00
|
|
|
if !cOtherInclude.Get("n") && !cOtherInclude.Get("none") {
|
2018-08-10 03:40:27 +00:00
|
|
|
for i, base := range bases {
|
|
|
|
pkg := base.Pkgbase()
|
|
|
|
anyInstalled := false
|
|
|
|
for _, b := range base {
|
2019-10-05 17:39:31 +00:00
|
|
|
anyInstalled = anyInstalled || installed.Get(b.Name)
|
2018-08-10 03:40:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
dir := filepath.Join(config.BuildDir, pkg)
|
2018-06-10 14:56:57 +00:00
|
|
|
if _, err := os.Stat(dir); os.IsNotExist(err) {
|
|
|
|
continue
|
|
|
|
}
|
2018-03-09 22:11:30 +00:00
|
|
|
|
2019-10-05 18:23:13 +00:00
|
|
|
if !cIsInclude && cExclude.Get(len(bases)-i) {
|
2018-06-10 14:56:57 +00:00
|
|
|
continue
|
|
|
|
}
|
2018-03-09 22:11:30 +00:00
|
|
|
|
2019-10-05 17:39:31 +00:00
|
|
|
if anyInstalled && (cOtherInclude.Get("i") || cOtherInclude.Get("installed")) {
|
2018-08-10 03:40:27 +00:00
|
|
|
toClean = append(toClean, base)
|
2018-06-10 14:56:57 +00:00
|
|
|
continue
|
|
|
|
}
|
2018-03-09 22:11:30 +00:00
|
|
|
|
2019-10-05 17:39:31 +00:00
|
|
|
if !anyInstalled && (cOtherInclude.Get("no") || cOtherInclude.Get("notinstalled")) {
|
2018-08-10 03:40:27 +00:00
|
|
|
toClean = append(toClean, base)
|
2018-06-10 14:56:57 +00:00
|
|
|
continue
|
|
|
|
}
|
|
|
|
|
2019-10-05 17:39:31 +00:00
|
|
|
if cOtherInclude.Get("a") || cOtherInclude.Get("all") {
|
2018-08-10 03:40:27 +00:00
|
|
|
toClean = append(toClean, base)
|
2018-06-10 14:56:57 +00:00
|
|
|
continue
|
|
|
|
}
|
|
|
|
|
2019-10-05 18:23:13 +00:00
|
|
|
if cIsInclude && (cInclude.Get(len(bases)-i) || cOtherInclude.Get(pkg)) {
|
2018-08-10 03:40:27 +00:00
|
|
|
toClean = append(toClean, base)
|
2018-06-10 14:56:57 +00:00
|
|
|
continue
|
|
|
|
}
|
|
|
|
|
2019-10-05 18:23:13 +00:00
|
|
|
if !cIsInclude && (!cExclude.Get(len(bases)-i) && !cOtherExclude.Get(pkg)) {
|
2018-08-10 03:40:27 +00:00
|
|
|
toClean = append(toClean, base)
|
2018-06-10 14:56:57 +00:00
|
|
|
continue
|
2018-03-09 22:11:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-06-10 14:56:57 +00:00
|
|
|
return toClean, nil
|
|
|
|
}
|
|
|
|
|
2019-10-16 21:25:40 +00:00
|
|
|
func editNumberMenu(bases []Base, installed stringset.StringSet) ([]Base, error) {
|
2018-08-10 03:40:27 +00:00
|
|
|
return editDiffNumberMenu(bases, installed, false)
|
2018-06-10 14:56:57 +00:00
|
|
|
}
|
|
|
|
|
2019-10-16 21:25:40 +00:00
|
|
|
func diffNumberMenu(bases []Base, installed stringset.StringSet) ([]Base, error) {
|
2018-08-10 03:40:27 +00:00
|
|
|
return editDiffNumberMenu(bases, installed, true)
|
2018-06-10 14:56:57 +00:00
|
|
|
}
|
|
|
|
|
2019-10-16 21:25:40 +00:00
|
|
|
func editDiffNumberMenu(bases []Base, installed stringset.StringSet, diff bool) ([]Base, error) {
|
2018-08-10 03:40:27 +00:00
|
|
|
toEdit := make([]Base, 0)
|
2018-06-11 18:13:40 +00:00
|
|
|
var editInput string
|
|
|
|
var err error
|
|
|
|
|
2018-06-10 14:56:57 +00:00
|
|
|
if diff {
|
2018-05-31 19:31:45 +00:00
|
|
|
fmt.Println(bold(green(arrow + " Diffs to show?")))
|
2019-03-29 22:05:04 +00:00
|
|
|
fmt.Println(bold(green(arrow) + cyan(" [N]one ") + "[A]ll [Ab]ort [I]nstalled [No]tInstalled or (1 2 3, 1-3, ^4)"))
|
2018-06-11 18:13:40 +00:00
|
|
|
fmt.Print(bold(green(arrow + " ")))
|
|
|
|
editInput, err = getInput(config.AnswerDiff)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
2018-05-31 19:31:45 +00:00
|
|
|
} else {
|
|
|
|
fmt.Println(bold(green(arrow + " PKGBUILDs to edit?")))
|
2019-03-29 22:05:04 +00:00
|
|
|
fmt.Println(bold(green(arrow) + cyan(" [N]one ") + "[A]ll [Ab]ort [I]nstalled [No]tInstalled or (1 2 3, 1-3, ^4)"))
|
2018-06-11 18:13:40 +00:00
|
|
|
fmt.Print(bold(green(arrow + " ")))
|
|
|
|
editInput, err = getInput(config.AnswerEdit)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
2018-03-09 22:11:30 +00:00
|
|
|
}
|
|
|
|
|
2019-10-16 21:36:08 +00:00
|
|
|
eInclude, eExclude, eOtherInclude, eOtherExclude := intrange.ParseNumberMenu(editInput)
|
2018-03-09 22:11:30 +00:00
|
|
|
eIsInclude := len(eExclude) == 0 && len(eOtherExclude) == 0
|
|
|
|
|
2019-10-05 17:39:31 +00:00
|
|
|
if eOtherInclude.Get("abort") || eOtherInclude.Get("ab") {
|
2018-06-10 14:56:57 +00:00
|
|
|
return nil, fmt.Errorf("Aborting due to user")
|
2018-03-09 22:11:30 +00:00
|
|
|
}
|
|
|
|
|
2019-10-05 17:39:31 +00:00
|
|
|
if !eOtherInclude.Get("n") && !eOtherInclude.Get("none") {
|
2018-08-10 03:40:27 +00:00
|
|
|
for i, base := range bases {
|
|
|
|
pkg := base.Pkgbase()
|
|
|
|
anyInstalled := false
|
|
|
|
for _, b := range base {
|
2019-10-05 17:39:31 +00:00
|
|
|
anyInstalled = anyInstalled || installed.Get(b.Name)
|
2018-08-10 03:40:27 +00:00
|
|
|
}
|
|
|
|
|
2019-10-05 18:23:13 +00:00
|
|
|
if !eIsInclude && eExclude.Get(len(bases)-i) {
|
2018-03-09 22:11:30 +00:00
|
|
|
continue
|
|
|
|
}
|
|
|
|
|
2019-10-05 17:39:31 +00:00
|
|
|
if anyInstalled && (eOtherInclude.Get("i") || eOtherInclude.Get("installed")) {
|
2018-08-10 03:40:27 +00:00
|
|
|
toEdit = append(toEdit, base)
|
2018-03-09 22:11:30 +00:00
|
|
|
continue
|
|
|
|
}
|
|
|
|
|
2019-10-05 17:39:31 +00:00
|
|
|
if !anyInstalled && (eOtherInclude.Get("no") || eOtherInclude.Get("notinstalled")) {
|
2018-08-10 03:40:27 +00:00
|
|
|
toEdit = append(toEdit, base)
|
2018-03-09 22:11:30 +00:00
|
|
|
continue
|
|
|
|
}
|
|
|
|
|
2019-10-05 17:39:31 +00:00
|
|
|
if eOtherInclude.Get("a") || eOtherInclude.Get("all") {
|
2018-08-10 03:40:27 +00:00
|
|
|
toEdit = append(toEdit, base)
|
2018-03-09 22:11:30 +00:00
|
|
|
continue
|
|
|
|
}
|
|
|
|
|
2019-10-05 18:23:13 +00:00
|
|
|
if eIsInclude && (eInclude.Get(len(bases)-i) || eOtherInclude.Get(pkg)) {
|
2018-08-10 03:40:27 +00:00
|
|
|
toEdit = append(toEdit, base)
|
2018-03-09 22:11:30 +00:00
|
|
|
}
|
|
|
|
|
2019-10-05 18:23:13 +00:00
|
|
|
if !eIsInclude && (!eExclude.Get(len(bases)-i) && !eOtherExclude.Get(pkg)) {
|
2018-08-10 03:40:27 +00:00
|
|
|
toEdit = append(toEdit, base)
|
2018-03-09 22:11:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-06-10 14:56:57 +00:00
|
|
|
return toEdit, nil
|
2018-03-09 22:11:30 +00:00
|
|
|
}
|
|
|
|
|
2019-10-16 21:25:40 +00:00
|
|
|
func updatePkgbuildSeenRef(bases []Base, cloned stringset.StringSet) error {
|
2019-10-16 21:38:54 +00:00
|
|
|
var errMulti multierror.MultiError
|
2019-10-07 10:24:19 +00:00
|
|
|
for _, base := range bases {
|
|
|
|
pkg := base.Pkgbase()
|
2019-11-04 04:20:50 +00:00
|
|
|
err := gitUpdateSeenRef(config.BuildDir, pkg)
|
|
|
|
if err != nil {
|
|
|
|
errMulti.Add(err)
|
2019-10-07 10:24:19 +00:00
|
|
|
}
|
|
|
|
}
|
2019-10-13 22:23:55 +00:00
|
|
|
return errMulti.Return()
|
2019-10-07 10:24:19 +00:00
|
|
|
}
|
|
|
|
|
2019-10-16 21:25:40 +00:00
|
|
|
func showPkgbuildDiffs(bases []Base, cloned stringset.StringSet) error {
|
2019-10-16 21:38:54 +00:00
|
|
|
var errMulti multierror.MultiError
|
2018-08-10 03:40:27 +00:00
|
|
|
for _, base := range bases {
|
|
|
|
pkg := base.Pkgbase()
|
|
|
|
dir := filepath.Join(config.BuildDir, pkg)
|
2019-11-04 04:20:50 +00:00
|
|
|
start, err := getLastSeenHash(config.BuildDir, pkg)
|
|
|
|
if err != nil {
|
|
|
|
errMulti.Add(err)
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
|
|
|
|
if cloned.Get(pkg) {
|
|
|
|
start = gitEmptyTree
|
|
|
|
} else {
|
|
|
|
hasDiff, err := gitHasDiff(config.BuildDir, pkg)
|
2019-10-07 10:24:19 +00:00
|
|
|
if err != nil {
|
2019-10-13 22:23:55 +00:00
|
|
|
errMulti.Add(err)
|
|
|
|
continue
|
2019-10-07 10:24:19 +00:00
|
|
|
}
|
2018-05-31 19:31:45 +00:00
|
|
|
|
2019-11-04 04:20:50 +00:00
|
|
|
if !hasDiff {
|
|
|
|
fmt.Printf("%s %s: %s\n", bold(yellow(arrow)), cyan(base.String()), bold("No changes -- skipping"))
|
|
|
|
continue
|
2018-05-31 19:31:45 +00:00
|
|
|
}
|
2019-11-04 04:20:50 +00:00
|
|
|
}
|
2018-05-31 19:31:45 +00:00
|
|
|
|
2019-11-04 04:20:50 +00:00
|
|
|
args := []string{"diff", start + "..HEAD@{upstream}", "--src-prefix", dir + "/", "--dst-prefix", dir + "/", "--", ".", ":(exclude).SRCINFO"}
|
|
|
|
if useColor {
|
|
|
|
args = append(args, "--color=always")
|
2018-05-31 19:31:45 +00:00
|
|
|
} else {
|
2019-11-04 04:20:50 +00:00
|
|
|
args = append(args, "--color=never")
|
2018-05-31 19:31:45 +00:00
|
|
|
}
|
2019-11-04 04:20:50 +00:00
|
|
|
_ = show(passToGit(dir, args...))
|
2018-05-31 19:31:45 +00:00
|
|
|
}
|
|
|
|
|
2019-10-13 22:23:55 +00:00
|
|
|
return errMulti.Return()
|
2018-05-31 19:31:45 +00:00
|
|
|
}
|
|
|
|
|
2018-08-11 03:51:10 +00:00
|
|
|
func editPkgbuilds(bases []Base, srcinfos map[string]*gosrc.Srcinfo) error {
|
2018-08-10 03:40:27 +00:00
|
|
|
pkgbuilds := make([]string, 0, len(bases))
|
|
|
|
for _, base := range bases {
|
|
|
|
pkg := base.Pkgbase()
|
|
|
|
dir := filepath.Join(config.BuildDir, pkg)
|
2018-04-17 00:32:31 +00:00
|
|
|
pkgbuilds = append(pkgbuilds, filepath.Join(dir, "PKGBUILD"))
|
2018-07-17 21:54:13 +00:00
|
|
|
|
2018-08-10 03:40:27 +00:00
|
|
|
for _, splitPkg := range srcinfos[pkg].SplitPackages() {
|
2018-07-17 21:54:13 +00:00
|
|
|
if splitPkg.Install != "" {
|
|
|
|
pkgbuilds = append(pkgbuilds, filepath.Join(dir, splitPkg.Install))
|
|
|
|
}
|
|
|
|
}
|
2018-03-09 22:11:30 +00:00
|
|
|
}
|
|
|
|
|
2018-05-31 19:31:45 +00:00
|
|
|
if len(pkgbuilds) > 0 {
|
|
|
|
editor, editorArgs := editor()
|
|
|
|
editorArgs = append(editorArgs, pkgbuilds...)
|
|
|
|
editcmd := exec.Command(editor, editorArgs...)
|
|
|
|
editcmd.Stdin, editcmd.Stdout, editcmd.Stderr = os.Stdin, os.Stdout, os.Stderr
|
|
|
|
err := editcmd.Run()
|
|
|
|
if err != nil {
|
|
|
|
return fmt.Errorf("Editor did not exit successfully, Aborting: %s", err)
|
|
|
|
}
|
2018-03-09 22:11:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2018-08-11 04:00:46 +00:00
|
|
|
func parseSrcinfoFiles(bases []Base, errIsFatal bool) (map[string]*gosrc.Srcinfo, error) {
|
|
|
|
srcinfos := make(map[string]*gosrc.Srcinfo)
|
2018-08-10 03:40:27 +00:00
|
|
|
for k, base := range bases {
|
|
|
|
pkg := base.Pkgbase()
|
|
|
|
dir := filepath.Join(config.BuildDir, pkg)
|
2018-02-16 17:18:59 +00:00
|
|
|
|
2018-03-02 04:03:09 +00:00
|
|
|
str := bold(cyan("::") + " Parsing SRCINFO (%d/%d): %s\n")
|
2018-08-11 04:39:24 +00:00
|
|
|
fmt.Printf(str, k+1, len(bases), cyan(base.String()))
|
2018-02-19 06:52:11 +00:00
|
|
|
|
2018-07-16 14:28:18 +00:00
|
|
|
pkgbuild, err := gosrc.ParseFile(filepath.Join(dir, ".SRCINFO"))
|
2018-02-19 06:52:11 +00:00
|
|
|
if err != nil {
|
2018-08-11 03:51:10 +00:00
|
|
|
if !errIsFatal {
|
2018-11-14 12:14:41 +00:00
|
|
|
fmt.Fprintf(os.Stderr, "failed to parse %s -- skipping: %s\n", base.String(), err)
|
2018-08-11 03:51:10 +00:00
|
|
|
continue
|
|
|
|
}
|
2018-08-11 04:39:24 +00:00
|
|
|
return nil, fmt.Errorf("failed to parse %s: %s", base.String(), err)
|
2018-02-19 06:52:11 +00:00
|
|
|
}
|
|
|
|
|
2018-08-10 03:40:27 +00:00
|
|
|
srcinfos[pkg] = pkgbuild
|
2018-02-19 06:52:11 +00:00
|
|
|
}
|
|
|
|
|
2018-08-11 04:00:46 +00:00
|
|
|
return srcinfos, nil
|
2018-02-19 06:52:11 +00:00
|
|
|
}
|
|
|
|
|
2019-10-16 21:25:40 +00:00
|
|
|
func pkgbuildsToSkip(bases []Base, targets stringset.StringSet) stringset.StringSet {
|
|
|
|
toSkip := make(stringset.StringSet)
|
2018-05-31 19:31:45 +00:00
|
|
|
|
2018-08-10 03:40:27 +00:00
|
|
|
for _, base := range bases {
|
|
|
|
isTarget := false
|
|
|
|
for _, pkg := range base {
|
2019-10-05 17:39:31 +00:00
|
|
|
isTarget = isTarget || targets.Get(pkg.Name)
|
2018-08-10 03:40:27 +00:00
|
|
|
}
|
|
|
|
|
2018-09-04 17:23:05 +00:00
|
|
|
if (config.ReDownload == "yes" && isTarget) || config.ReDownload == "all" {
|
|
|
|
continue
|
|
|
|
}
|
2018-03-06 03:42:26 +00:00
|
|
|
|
2018-09-04 17:23:05 +00:00
|
|
|
dir := filepath.Join(config.BuildDir, base.Pkgbase(), ".SRCINFO")
|
|
|
|
pkgbuild, err := gosrc.ParseFile(dir)
|
|
|
|
|
|
|
|
if err == nil {
|
|
|
|
if alpm.VerCmp(pkgbuild.Version(), base.Version()) >= 0 {
|
2019-10-05 17:39:31 +00:00
|
|
|
toSkip.Set(base.Pkgbase())
|
2018-03-06 03:42:26 +00:00
|
|
|
}
|
|
|
|
}
|
2018-05-31 19:31:45 +00:00
|
|
|
}
|
|
|
|
|
2018-06-10 00:04:04 +00:00
|
|
|
return toSkip
|
|
|
|
}
|
|
|
|
|
2018-08-11 03:51:10 +00:00
|
|
|
func mergePkgbuilds(bases []Base) error {
|
2018-08-10 03:40:27 +00:00
|
|
|
for _, base := range bases {
|
2019-11-04 04:20:50 +00:00
|
|
|
err := gitMerge(config.BuildDir, base.Pkgbase())
|
|
|
|
if err != nil {
|
|
|
|
return err
|
2018-06-10 00:29:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2019-10-16 21:25:40 +00:00
|
|
|
func downloadPkgbuilds(bases []Base, toSkip stringset.StringSet, buildDir string) (stringset.StringSet, error) {
|
|
|
|
cloned := make(stringset.StringSet)
|
2018-08-02 15:49:30 +00:00
|
|
|
downloaded := 0
|
|
|
|
var wg sync.WaitGroup
|
|
|
|
var mux sync.Mutex
|
2019-10-16 21:38:54 +00:00
|
|
|
var errs multierror.MultiError
|
2018-08-02 15:49:30 +00:00
|
|
|
|
2018-08-10 03:40:27 +00:00
|
|
|
download := func(k int, base Base) {
|
2018-08-02 15:49:30 +00:00
|
|
|
defer wg.Done()
|
2018-08-10 03:40:27 +00:00
|
|
|
pkg := base.Pkgbase()
|
2018-06-10 02:41:25 +00:00
|
|
|
|
2019-10-05 17:39:31 +00:00
|
|
|
if toSkip.Get(pkg) {
|
2018-08-02 15:49:30 +00:00
|
|
|
mux.Lock()
|
|
|
|
downloaded++
|
2018-05-31 19:31:45 +00:00
|
|
|
str := bold(cyan("::") + " PKGBUILD up to date, Skipping (%d/%d): %s\n")
|
2018-08-11 04:39:24 +00:00
|
|
|
fmt.Printf(str, downloaded, len(bases), cyan(base.String()))
|
2018-08-02 15:49:30 +00:00
|
|
|
mux.Unlock()
|
|
|
|
return
|
2018-05-31 19:31:45 +00:00
|
|
|
}
|
2018-03-06 03:42:26 +00:00
|
|
|
|
2019-11-04 04:20:50 +00:00
|
|
|
clone, err := gitDownload(config.AURURL+"/"+pkg+".git", buildDir, pkg)
|
|
|
|
if err != nil {
|
|
|
|
errs.Add(err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
if clone {
|
|
|
|
mux.Lock()
|
|
|
|
cloned.Set(pkg)
|
|
|
|
mux.Unlock()
|
2017-08-02 17:24:03 +00:00
|
|
|
}
|
2018-08-02 15:49:30 +00:00
|
|
|
|
|
|
|
mux.Lock()
|
|
|
|
downloaded++
|
|
|
|
str := bold(cyan("::") + " Downloaded PKGBUILD (%d/%d): %s\n")
|
2018-08-11 04:39:24 +00:00
|
|
|
fmt.Printf(str, downloaded, len(bases), cyan(base.String()))
|
2018-08-02 15:49:30 +00:00
|
|
|
mux.Unlock()
|
2017-08-02 17:24:03 +00:00
|
|
|
}
|
|
|
|
|
2018-09-04 17:28:36 +00:00
|
|
|
count := 0
|
2018-08-10 03:40:27 +00:00
|
|
|
for k, base := range bases {
|
2018-08-02 15:49:30 +00:00
|
|
|
wg.Add(1)
|
2018-08-10 03:40:27 +00:00
|
|
|
go download(k, base)
|
2018-09-04 17:28:36 +00:00
|
|
|
count++
|
|
|
|
if count%25 == 0 {
|
|
|
|
wg.Wait()
|
|
|
|
}
|
2018-08-02 15:49:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
wg.Wait()
|
|
|
|
|
|
|
|
return cloned, errs.Return()
|
2018-01-17 21:48:23 +00:00
|
|
|
}
|
|
|
|
|
2019-10-16 21:25:40 +00:00
|
|
|
func downloadPkgbuildsSources(bases []Base, incompatible stringset.StringSet) (err error) {
|
2018-08-10 03:40:27 +00:00
|
|
|
for _, base := range bases {
|
|
|
|
pkg := base.Pkgbase()
|
|
|
|
dir := filepath.Join(config.BuildDir, pkg)
|
2018-04-12 15:39:01 +00:00
|
|
|
args := []string{"--verifysource", "-Ccf"}
|
2018-03-19 16:51:11 +00:00
|
|
|
|
2019-10-05 17:39:31 +00:00
|
|
|
if incompatible.Get(pkg) {
|
2018-03-19 16:51:11 +00:00
|
|
|
args = append(args, "--ignorearch")
|
|
|
|
}
|
|
|
|
|
2018-07-19 17:37:28 +00:00
|
|
|
err = show(passToMakepkg(dir, args...))
|
2018-01-17 21:48:23 +00:00
|
|
|
if err != nil {
|
2018-08-11 04:39:24 +00:00
|
|
|
return fmt.Errorf("Error downloading sources: %s", cyan(base.String()))
|
2017-08-02 17:24:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-01-17 21:48:23 +00:00
|
|
|
return
|
|
|
|
}
|
2018-01-05 22:12:14 +00:00
|
|
|
|
2019-10-16 21:25:40 +00:00
|
|
|
func buildInstallPkgbuilds(dp *depPool, do *depOrder, srcinfos map[string]*gosrc.Srcinfo, parser *arguments, incompatible stringset.StringSet, conflicts stringset.MapStringSet) error {
|
2019-10-10 14:55:43 +00:00
|
|
|
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
|
|
|
|
|
|
|
|
//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
|
2019-10-16 21:58:55 +00:00
|
|
|
remoteNamesCache := stringset.FromSlice(remoteNames)
|
|
|
|
localNamesCache := stringset.FromSlice(localNames)
|
2019-10-10 14:55:43 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2019-01-15 18:41:38 +00:00
|
|
|
for _, base := range do.Aur {
|
2019-10-10 14:55:43 +00:00
|
|
|
var err error
|
2018-08-10 03:40:27 +00:00
|
|
|
pkg := base.Pkgbase()
|
|
|
|
dir := filepath.Join(config.BuildDir, pkg)
|
2018-02-15 21:23:34 +00:00
|
|
|
built := true
|
2018-02-15 19:43:16 +00:00
|
|
|
|
2019-10-10 14:55:43 +00:00
|
|
|
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\n", dep)
|
|
|
|
break all
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if !satisfied || !config.BatchInstall {
|
|
|
|
err = doInstall()
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-08-10 03:40:27 +00:00
|
|
|
srcinfo := srcinfos[pkg]
|
2018-04-12 15:39:01 +00:00
|
|
|
|
2018-06-02 13:16:00 +00:00
|
|
|
args := []string{"--nobuild", "-fC"}
|
2018-05-10 19:56:12 +00:00
|
|
|
|
2019-10-05 17:39:31 +00:00
|
|
|
if incompatible.Get(pkg) {
|
2018-05-10 19:56:12 +00:00
|
|
|
args = append(args, "--ignorearch")
|
|
|
|
}
|
|
|
|
|
2018-04-12 15:39:01 +00:00
|
|
|
//pkgver bump
|
2019-10-10 14:55:43 +00:00
|
|
|
err = show(passToMakepkg(dir, args...))
|
2018-04-12 15:39:01 +00:00
|
|
|
if err != nil {
|
2018-08-11 04:39:24 +00:00
|
|
|
return fmt.Errorf("Error making: %s", base.String())
|
2018-04-12 15:39:01 +00:00
|
|
|
}
|
|
|
|
|
2018-06-05 13:47:55 +00:00
|
|
|
pkgdests, version, err := parsePackageList(dir)
|
2018-04-12 15:39:01 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2018-02-15 19:43:16 +00:00
|
|
|
|
2018-08-10 03:40:27 +00:00
|
|
|
isExplicit := false
|
|
|
|
for _, b := range base {
|
2019-10-05 17:39:31 +00:00
|
|
|
isExplicit = isExplicit || dp.Explicit.Get(b.Name)
|
2018-08-10 03:40:27 +00:00
|
|
|
}
|
2018-09-04 19:01:49 +00:00
|
|
|
if config.ReBuild == "no" || (config.ReBuild == "yes" && !isExplicit) {
|
2018-08-10 03:40:27 +00:00
|
|
|
for _, split := range base {
|
2018-05-31 03:37:08 +00:00
|
|
|
pkgdest, ok := pkgdests[split.Name]
|
|
|
|
if !ok {
|
|
|
|
return fmt.Errorf("Could not find PKGDEST for: %s", split.Name)
|
2018-03-14 01:48:33 +00:00
|
|
|
}
|
2018-02-15 19:43:16 +00:00
|
|
|
|
2018-05-31 03:37:08 +00:00
|
|
|
_, err := os.Stat(pkgdest)
|
|
|
|
if os.IsNotExist(err) {
|
2018-03-14 01:48:33 +00:00
|
|
|
built = false
|
2018-05-31 03:37:08 +00:00
|
|
|
} else if err != nil {
|
|
|
|
return err
|
2018-03-14 01:48:33 +00:00
|
|
|
}
|
2018-02-15 19:43:16 +00:00
|
|
|
}
|
2018-03-14 01:48:33 +00:00
|
|
|
} else {
|
|
|
|
built = false
|
2018-02-15 21:23:34 +00:00
|
|
|
}
|
2018-02-15 19:43:16 +00:00
|
|
|
|
2018-08-18 16:32:40 +00:00
|
|
|
if cmdArgs.existsArg("needed") {
|
|
|
|
installed := true
|
|
|
|
for _, split := range base {
|
2019-02-14 20:44:39 +00:00
|
|
|
if alpmpkg := dp.LocalDB.Pkg(split.Name); alpmpkg == nil || alpmpkg.Version() != version {
|
2018-08-18 16:32:40 +00:00
|
|
|
installed = false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if installed {
|
2019-10-13 11:15:51 +00:00
|
|
|
err = show(passToMakepkg(dir, "-c", "--nobuild", "--noextract", "--ignorearch"))
|
|
|
|
if err != nil {
|
|
|
|
return fmt.Errorf("Error making: %s", err)
|
|
|
|
}
|
|
|
|
|
2018-08-18 16:32:40 +00:00
|
|
|
fmt.Println(cyan(pkg+"-"+version) + bold(" is up to date -- skipping"))
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-02-15 21:23:34 +00:00
|
|
|
if built {
|
2019-10-13 11:15:51 +00:00
|
|
|
err = show(passToMakepkg(dir, "-c", "--nobuild", "--noextract", "--ignorearch"))
|
|
|
|
if err != nil {
|
|
|
|
return fmt.Errorf("Error making: %s", err)
|
|
|
|
}
|
|
|
|
|
2018-04-10 23:45:58 +00:00
|
|
|
fmt.Println(bold(yellow(arrow)),
|
2018-08-18 16:32:40 +00:00
|
|
|
cyan(pkg+"-"+version)+bold(" already made -- skipping build"))
|
2018-02-15 21:23:34 +00:00
|
|
|
} else {
|
2018-06-02 13:16:00 +00:00
|
|
|
args := []string{"-cf", "--noconfirm", "--noextract", "--noprepare", "--holdver"}
|
2018-03-19 16:51:11 +00:00
|
|
|
|
2019-10-05 17:39:31 +00:00
|
|
|
if incompatible.Get(pkg) {
|
2018-03-19 16:51:11 +00:00
|
|
|
args = append(args, "--ignorearch")
|
|
|
|
}
|
|
|
|
|
2018-07-19 17:37:28 +00:00
|
|
|
err := show(passToMakepkg(dir, args...))
|
2018-02-15 21:23:34 +00:00
|
|
|
if err != nil {
|
2018-08-11 04:39:24 +00:00
|
|
|
return fmt.Errorf("Error making: %s", base.String())
|
2018-02-15 19:43:16 +00:00
|
|
|
}
|
2018-01-04 00:59:57 +00:00
|
|
|
}
|
2018-02-15 19:43:16 +00:00
|
|
|
|
2018-06-22 14:17:34 +00:00
|
|
|
//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 {
|
2018-08-10 03:40:27 +00:00
|
|
|
for _, split := range base {
|
2018-06-22 14:17:34 +00:00
|
|
|
if _, ok := conflicts[split.Name]; ok {
|
2019-10-10 14:55:43 +00:00
|
|
|
config.NoConfirm = false
|
|
|
|
break
|
2018-06-22 14:17:34 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-16 22:20:53 +00:00
|
|
|
doAddTarget := func(name string, optional bool) error {
|
|
|
|
pkgdest, ok := pkgdests[name]
|
2018-05-31 03:37:08 +00:00
|
|
|
if !ok {
|
2020-02-16 22:20:53 +00:00
|
|
|
if !optional {
|
|
|
|
return fmt.Errorf("Could not find PKGDEST for: %s", name)
|
|
|
|
} else {
|
|
|
|
return nil
|
|
|
|
}
|
2018-02-15 21:23:34 +00:00
|
|
|
}
|
2018-02-16 17:18:59 +00:00
|
|
|
|
2018-05-31 03:37:08 +00:00
|
|
|
arguments.addTarget(pkgdest)
|
2019-10-10 14:55:43 +00:00
|
|
|
if parser.existsArg("asdeps", "asdep") {
|
2020-02-16 22:20:53 +00:00
|
|
|
deps = append(deps, name)
|
2019-10-10 14:55:43 +00:00
|
|
|
} else if parser.existsArg("asexplicit", "asexp") {
|
2020-02-16 22:20:53 +00:00
|
|
|
exp = append(exp, name)
|
|
|
|
} else if !dp.Explicit.Get(name) && !localNamesCache.Get(name) && !remoteNamesCache.Get(name) {
|
|
|
|
deps = append(deps, name)
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
for _, split := range base {
|
|
|
|
var err error
|
|
|
|
|
|
|
|
err = doAddTarget(split.Name, false)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
err = doAddTarget(split.Name+"-debug", true)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
2018-05-29 21:35:58 +00:00
|
|
|
}
|
2018-02-15 21:23:34 +00:00
|
|
|
}
|
2018-02-15 19:43:16 +00:00
|
|
|
|
2018-08-02 22:30:48 +00:00
|
|
|
var mux sync.Mutex
|
|
|
|
var wg sync.WaitGroup
|
2018-08-10 03:40:27 +00:00
|
|
|
for _, pkg := range base {
|
2018-08-02 22:30:48 +00:00
|
|
|
wg.Add(1)
|
|
|
|
go updateVCSData(pkg.Name, srcinfo.Source, &mux, &wg)
|
2018-03-05 22:15:34 +00:00
|
|
|
}
|
|
|
|
|
2018-08-02 22:30:48 +00:00
|
|
|
wg.Wait()
|
2017-08-02 17:24:03 +00:00
|
|
|
}
|
|
|
|
|
2019-10-10 14:55:43 +00:00
|
|
|
err = doInstall()
|
|
|
|
config.NoConfirm = oldConfirm
|
|
|
|
return err
|
2018-02-15 19:43:16 +00:00
|
|
|
}
|