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.
This commit is contained in:
morganamilo 2018-08-18 17:32:40 +01:00
parent 19bf8e773c
commit 907bf3a30e
No known key found for this signature in database
GPG Key ID: 6FE9E7996B0B082E

View File

@ -931,9 +931,23 @@ func buildInstallPkgbuilds(dp *depPool, do *depOrder, srcinfos map[string]*gosrc
built = false 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 { if built {
fmt.Println(bold(yellow(arrow)), fmt.Println(bold(yellow(arrow)),
cyan(pkg+"-"+version)+bold(" Already made -- skipping build")) cyan(pkg+"-"+version)+bold(" already made -- skipping build"))
} else { } else {
args := []string{"-cf", "--noconfirm", "--noextract", "--noprepare", "--holdver"} args := []string{"-cf", "--noconfirm", "--noextract", "--noprepare", "--holdver"}