瀏覽代碼

handle Dir::Bin::Solvers as a list of directories and find the
solver in this list of directories

David Kalnischkies 15 年之前
父節點
當前提交
98d6aaa8fd
共有 2 個文件被更改,包括 14 次插入4 次删除
  1. 12 4
      apt-pkg/algorithms.cc
  2. 2 0
      apt-pkg/init.cc

+ 12 - 4
apt-pkg/algorithms.cc

@@ -743,10 +743,18 @@ bool pkgProblemResolver::Resolve(bool BrokenFix)
 
    if (solver != "internal")
    {
-//       std::string const file = _config->FindDir("Dir::Bin::Solvers") + solver;
-      std::string const file = solver;
-      if (RealFileExists(file.c_str()) == false)
-	 return _error->Error("Can't call external solver '%s' as it is not available: %s", solver.c_str(), file.c_str());
+      std::vector<std::string> const solverDirs = _config->FindVector("Dir::Bin::Solvers");
+      std::string file;
+      for (std::vector<std::string>::const_iterator dir = solverDirs.begin();
+	   dir != solverDirs.end(); ++dir) {
+	 file = flCombine(*dir, solver);
+	 if (RealFileExists(file.c_str()) == true)
+	    break;
+	 file.clear();
+      }
+
+      if (file.empty() == true)
+	 return _error->Error("Can't call external solver '%s' as it is not in a configured directory!", solver.c_str());
       int external[4] = {-1, -1, -1, -1};
       if (pipe(external) != 0 || pipe(external + 2) != 0)
 	 return _error->Errno("Resolve", "Can't create needed IPC pipes for EDSP");

+ 2 - 0
apt-pkg/init.cc

@@ -72,7 +72,9 @@ bool pkgInitConfig(Configuration &Cnf)
    Cnf.Set("Dir::Etc::preferencesparts","preferences.d");
    Cnf.Set("Dir::Etc::trusted", "trusted.gpg");
    Cnf.Set("Dir::Etc::trustedparts","trusted.gpg.d");
+
    Cnf.Set("Dir::Bin::methods","/usr/lib/apt/methods");
+   Cnf.Set("Dir::Bin::solvers::","/usr/lib/apt/solvers");
    Cnf.Set("Dir::Media::MountPath","/media/apt");
 
    // State