浏览代码

Merge pull request #684 from Morganamilo/limitpkgbuilddownload

Fixup some download bugs
Anna 6 年之前
父节点
当前提交
98d27360f7
共有 3 个文件被更改,包括 23 次插入14 次删除
  1. 3 6
      depPool.go
  2. 5 0
      download.go
  3. 15 8
      install.go

+ 3 - 6
depPool.go

@@ -301,14 +301,12 @@ func (dp *depPool) resolveAURPackages(pkgs stringSet, explicit bool) error {
 			continue
 		}
 
-		//has satisfier installed: skip
-		_, isInstalled := dp.LocalDb.PkgCache().FindSatisfier(dep)
-		if isInstalled == nil {
+		_, isInstalled := dp.LocalDb.PkgCache().FindSatisfier(dep) //has satisfier installed: skip
+		repoPkg, inRepos := dp.SyncDb.FindSatisfier(dep)           //has satisfier in repo: fetch it
+		if isInstalled == nil && (config.ReBuild != "tree" || inRepos == nil) {
 			continue
 		}
 
-		//has satisfier in repo: fetch it
-		repoPkg, inRepos := dp.SyncDb.FindSatisfier(dep)
 		if inRepos == nil {
 			dp.ResolveRepoDependency(repoPkg)
 			continue
@@ -321,7 +319,6 @@ func (dp *depPool) resolveAURPackages(pkgs stringSet, explicit bool) error {
 	}
 
 	err = dp.resolveAURPackages(newAURPackages, false)
-
 	return err
 }
 

+ 5 - 0
download.go

@@ -286,9 +286,14 @@ func getPkgbuildsfromABS(pkgs []string, path string) (bool, error) {
 		mux.Unlock()
 	}
 
+	count := 0
 	for name, url := range names {
 		wg.Add(1)
 		go download(name, url)
+		count++
+		if count%25 == 0 {
+			wg.Wait()
+		}
 	}
 
 	wg.Wait()

+ 15 - 8
install.go

@@ -796,14 +796,16 @@ func pkgbuildsToSkip(bases []Base, targets stringSet) stringSet {
 			isTarget = isTarget || targets.get(pkg.Name)
 		}
 
-		if config.ReDownload == "no" || (config.ReDownload == "yes" && isTarget) {
-			dir := filepath.Join(config.BuildDir, base.Pkgbase(), ".SRCINFO")
-			pkgbuild, err := gosrc.ParseFile(dir)
+		if (config.ReDownload == "yes" && isTarget) || config.ReDownload == "all" {
+			continue
+		}
 
-			if err == nil {
-				if alpm.VerCmp(pkgbuild.Version(), base.Version()) >= 0 {
-					toSkip.set(base.Pkgbase())
-				}
+		dir := filepath.Join(config.BuildDir, base.Pkgbase(), ".SRCINFO")
+		pkgbuild, err := gosrc.ParseFile(dir)
+
+		if err == nil {
+			if alpm.VerCmp(pkgbuild.Version(), base.Version()) >= 0 {
+				toSkip.set(base.Pkgbase())
 			}
 		}
 	}
@@ -870,9 +872,14 @@ func downloadPkgbuilds(bases []Base, toSkip stringSet, buildDir string) (stringS
 		mux.Unlock()
 	}
 
+	count := 0
 	for k, base := range bases {
 		wg.Add(1)
 		go download(k, base)
+		count++
+		if count%25 == 0 {
+			wg.Wait()
+		}
 	}
 
 	wg.Wait()
@@ -928,7 +935,7 @@ func buildInstallPkgbuilds(dp *depPool, do *depOrder, srcinfos map[string]*gosrc
 		for _, b := range base {
 			isExplicit = isExplicit || dp.Explicit.get(b.Name)
 		}
-		if config.ReBuild == "no" || (config.ReBuild == "yes" && isExplicit) {
+		if config.ReBuild == "no" || (config.ReBuild == "yes" && !isExplicit) {
 			for _, split := range base {
 				pkgdest, ok := pkgdests[split.Name]
 				if !ok {