Explorar o código

Fix check for missing dependencies

We dont check the dependencies of things already installed becuase,
well, they're already installed. But we should check the dependencies of
targets even if they are installed because they get reinstalled.
morganamilo %!s(int64=7) %!d(string=hai) anos
pai
achega
7b558ba47c
Modificáronse 1 ficheiros con 10 adicións e 5 borrados
  1. 10 5
      depCheck.go

+ 10 - 5
depCheck.go

@@ -183,11 +183,6 @@ type missing struct {
 }
 
 func (dp *depPool) _checkMissing(dep string, stack []string, missing *missing) {
-	if _, err := dp.LocalDb.PkgCache().FindSatisfier(dep); err == nil {
-		missing.Good.set(dep)
-		return
-	}
-
 	if missing.Good.get(dep) {
 		return
 	}
@@ -207,6 +202,11 @@ func (dp *depPool) _checkMissing(dep string, stack []string, missing *missing) {
 		missing.Good.set(dep)
 		for _, deps := range [3][]string{aurPkg.Depends, aurPkg.MakeDepends, aurPkg.CheckDepends} {
 			for _, aurDep := range deps {
+				if _, err := dp.LocalDb.PkgCache().FindSatisfier(aurDep); err == nil {
+					missing.Good.set(aurDep)
+					continue
+				}
+
 				dp._checkMissing(aurDep, append(stack, aurPkg.Name), missing)
 			}
 		}
@@ -218,6 +218,11 @@ func (dp *depPool) _checkMissing(dep string, stack []string, missing *missing) {
 	if repoPkg != nil {
 		missing.Good.set(dep)
 		repoPkg.Depends().ForEach(func(repoDep alpm.Depend) error {
+			if _, err := dp.LocalDb.PkgCache().FindSatisfier(repoDep.String()); err == nil {
+				missing.Good.set(repoDep.String())
+				return nil
+			}
+
 			dp._checkMissing(repoDep.String(), append(stack, repoPkg.Name()), missing)
 			return nil
 		})