From 907bf3a30e2dbce605b04cdcddea5a2e6d28aefd Mon Sep 17 00:00:00 2001 From: morganamilo Date: Sat, 18 Aug 2018 17:32:40 +0100 Subject: [PATCH] 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"}