ソースを参照

* support IsAutoInstallOk in the resolver too
* honor the dpkg hold state in IsAutoInstallOk (closes: #64141)

Michael Vogt 17 年 前
コミット
d6ebeb21dd
共有3 個のファイルを変更した25 個の追加9 個の削除を含む
  1. 20 8
      apt-pkg/algorithms.cc
  2. 1 1
      apt-pkg/depcache.cc
  3. 4 0
      debian/changelog

+ 20 - 8
apt-pkg/algorithms.cc

@@ -985,15 +985,27 @@ bool pkgProblemResolver::Resolve(bool BrokenFix)
 			// Consider other options
 			if (InOr == false)
 			{
-			   if (Debug == true)
-			      clog << "  Removing " << I.Name() << " rather than change " << Start.TargetPkg().Name() << endl;
-			   Cache.MarkDelete(I);
-			   if (Counter > 1)
+			   if (Cache.IsAutoInstallOk(I) == true)
 			   {
-			      if (Scores[Pkg->ID] > Scores[I->ID])
-				 Scores[I->ID] = Scores[Pkg->ID];
-			   }			   
-			}			
+			      if (Debug == true)
+			         clog << "  Removing " << I.Name() << " rather than change " << Start.TargetPkg().Name() << endl;
+			      Cache.MarkDelete(I);
+			      if (Counter > 1)
+			      {
+				 if (Scores[Pkg->ID] > Scores[I->ID])
+				    Scores[I->ID] = Scores[Pkg->ID];
+			      }
+			   } else {
+			      /* The dependency of the TargetPkg would be satisfiable with I but it is
+				 forbidden to install I automatical, so anything we can do is hold
+				 back the TargetPkg.
+			      */
+			      if (Debug == true)
+				 clog << "  Hold back " << Start.TargetPkg().Name() <<
+					" rather than change denied AutoInstall " << I.Name() << endl;
+			      Cache.MarkKeep(Start.TargetPkg());
+			   }
+			}
 		     }
 		  }
 		  		  

+ 1 - 1
apt-pkg/depcache.cc

@@ -1069,7 +1069,7 @@ void pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst,
    library can override this method to control the MarkInstall behaviour */
 bool pkgDepCache::IsAutoInstallOk(const PkgIterator &Pkg, unsigned long Depth)
 {
-   return true;
+   return (Pkg->SelectedState != pkgCache::State::Hold);
 }
 									/*}}}*/
 // DepCache::SetReInstall - Set the reinstallation flag			/*{{{*/

+ 4 - 0
debian/changelog

@@ -30,7 +30,11 @@ apt (0.7.22) UNRELEASED; urgency=low
     adjustable
   * do not write state file in simulate mode (closes: #433007)
   * add hook for auto-install (closes: #470035)
+  * support IsAutoInstallOk in the resolver too
 
+  [ Michael Vogt ]
+  * honor the dpkg hold state in IsAutoInstallOk (closes: #64141)
+  
   [ Julian Andres Klode ]
   * apt-pkg/contrib/configuration.cc: Fix a small memory leak in
     ReadConfigFile.