Merge pull request #642 from Morganamilo/needed

skip build when package is up to date and --needed
This commit is contained in:
Anna 2018-08-18 21:02:40 +01:00 committed by GitHub
commit 23ff1e79df
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -480,7 +480,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
}
@ -946,9 +946,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"}