From 907bf3a30e2dbce605b04cdcddea5a2e6d28aefd Mon Sep 17 00:00:00 2001 From: morganamilo Date: Sat, 18 Aug 2018 17:32:40 +0100 Subject: [PATCH 1/2] skip build when package is up to date and --needed Before --needed was left purerly to pacman. The problem with this is that if a package is not in the cache, it will end up being build just for pacman to skip over the install. Now Yay will handle this and skip the build and install if --needed is used. The inital clone and pkgver bumb is still donw. --- install.go | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/install.go b/install.go index 42063d06..2146b63a 100644 --- a/install.go +++ b/install.go @@ -931,9 +931,23 @@ func buildInstallPkgbuilds(dp *depPool, do *depOrder, srcinfos map[string]*gosrc built = false } + if cmdArgs.existsArg("needed") { + installed := true + for _, split := range base { + if alpmpkg, err := dp.LocalDb.PkgByName(split.Name); err != nil || alpmpkg.Version() != version { + installed = false + } + } + + if installed { + fmt.Println(cyan(pkg+"-"+version) + bold(" is up to date -- skipping")) + continue + } + } + if built { fmt.Println(bold(yellow(arrow)), - cyan(pkg+"-"+version)+bold(" Already made -- skipping build")) + cyan(pkg+"-"+version)+bold(" already made -- skipping build")) } else { args := []string{"-cf", "--noconfirm", "--noextract", "--noprepare", "--holdver"} From aca65e743af6cb4ede3ef7d4f5970d5f1ace0e08 Mon Sep 17 00:00:00 2001 From: morganamilo Date: Sat, 18 Aug 2018 17:54:20 +0100 Subject: [PATCH 2/2] parsePackageList: include pkgrel in version --- install.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.go b/install.go index 2146b63a..565218e6 100644 --- a/install.go +++ b/install.go @@ -478,7 +478,7 @@ func parsePackageList(dir string) (map[string]string, string, error) { // 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], "-") - version = strings.Join(split[len(split)-3:len(split)-2], "-") + version = strings.Join(split[len(split)-3:len(split)-1], "-") pkgdests[pkgname] = line }