Split pkgbuild downloading and merging

This commit is contained in:
morganamilo 2018-06-10 01:29:54 +01:00
parent 73bd713217
commit 43d2a6601a
No known key found for this signature in database
GPG Key ID: 6FE9E7996B0B082E

View File

@ -166,6 +166,11 @@ func install(parser *arguments) error {
return err
}
err = mergePkgBuilds(do.Aur)
if err != nil {
return err
}
if len(toEdit) > 0 {
if config.ShowDiffs {
err = showPkgBuildDiffs(toEdit, do.Bases, oldHashes)
@ -639,6 +644,20 @@ func getHashes(pkgs []*rpc.Pkg) (map[string]string, error) {
return hashes, nil
}
func mergePkgBuilds(pkgs []*rpc.Pkg) error {
for _, pkg := range pkgs {
if shouldUseGit(filepath.Join(config.BuildDir, pkg.PackageBase)) {
err := gitMerge(baseURL + "/" + pkg.PackageBase + ".git", config.BuildDir, pkg.PackageBase)
if err != nil {
return err
}
}
}
return nil
}
func downloadPkgBuilds(pkgs []*rpc.Pkg, bases map[string][]*rpc.Pkg, toSkip stringSet) error {
for k, pkg := range pkgs {
if toSkip.get(pkg.PackageBase) {
@ -656,12 +675,6 @@ func downloadPkgBuilds(pkgs []*rpc.Pkg, bases map[string][]*rpc.Pkg, toSkip stri
if err != nil {
return err
}
err = gitMerge(baseURL + "/" + pkg.PackageBase + ".git", config.BuildDir, pkg.PackageBase)
if err != nil {
return err
}
} else {
err := downloadAndUnpack(baseURL+pkg.URLPath, config.BuildDir)
if err != nil {