Split pkgbuild downloading and up to date checks

This commit is contained in:
morganamilo 2018-06-10 01:04:04 +01:00
parent 5775e3c0b7
commit 1b8d9317e4
No known key found for this signature in database
GPG Key ID: 6FE9E7996B0B082E
2 changed files with 11 additions and 4 deletions

View File

@ -155,7 +155,8 @@ func install(parser *arguments) error {
cleanBuilds(toClean)
oldHashes, err := downloadPkgBuilds(do.Aur, targets, do.Bases)
toSkip := pkgBuildsToSkip(do.Aur, targets)
oldHashes, err := downloadPkgBuilds(do.Aur, do.Bases, toSkip)
if err != nil {
return err
}
@ -593,9 +594,8 @@ func tryParsesrcinfosFile(pkgs []*rpc.Pkg, srcinfos map[string]*gopkg.PKGBUILD,
}
}
func downloadPkgBuilds(pkgs []*rpc.Pkg, targets stringSet, bases map[string][]*rpc.Pkg) (map[string]string, error) {
func pkgBuildsToSkip(pkgs []*rpc.Pkg, targets stringSet) stringSet {
toSkip := make(stringSet)
hashes := make(map[string]string)
for _, pkg := range pkgs {
if config.ReDownload == "no" || (config.ReDownload == "yes" && !targets.get(pkg.Name)) {
@ -614,6 +614,12 @@ func downloadPkgBuilds(pkgs []*rpc.Pkg, targets stringSet, bases map[string][]*r
}
}
return toSkip
}
func downloadPkgBuilds(pkgs []*rpc.Pkg, bases map[string][]*rpc.Pkg, toSkip stringSet) (map[string]string, error) {
hashes := make(map[string]string)
for k, pkg := range pkgs {
if shouldUseGit(filepath.Join(config.BuildDir, pkg.PackageBase)) {
hash, err := gitGetHash(config.BuildDir, pkg.PackageBase)

3
vcs.go
View File

@ -43,7 +43,8 @@ func createDevelDB() error {
bases := getBases(infoMap)
downloadPkgBuilds(info, sliceToStringSet(remoteNames), bases)
toSkip := pkgBuildsToSkip(info, sliceToStringSet(remoteNames))
downloadPkgBuilds(info, bases, toSkip)
tryParsesrcinfosFile(info, srcinfosStale, bases)
for _, pkg := range info {