Преглед изворни кода

make the specify order of packages irrelevant (half-close #196021)

David Kalnischkies пре 16 година
родитељ
комит
6806db8ac0
2 измењених фајлова са 19 додато и 5 уклоњено
  1. 18 5
      cmdline/apt-get.cc
  2. 1 0
      debian/changelog

+ 18 - 5
cmdline/apt-get.cc

@@ -762,6 +762,7 @@ struct TryToInstall {
    pkgProblemResolver* Fix;
    pkgProblemResolver* Fix;
    bool FixBroken;
    bool FixBroken;
    unsigned long AutoMarkChanged;
    unsigned long AutoMarkChanged;
+   APT::PackageSet doAutoInstallLater;
 
 
    TryToInstall(pkgCacheFile &Cache, pkgProblemResolver &PM, bool const &FixBroken) : Cache(&Cache), Fix(&PM),
    TryToInstall(pkgCacheFile &Cache, pkgProblemResolver &PM, bool const &FixBroken) : Cache(&Cache), Fix(&PM),
 			FixBroken(FixBroken), AutoMarkChanged(0) {};
 			FixBroken(FixBroken), AutoMarkChanged(0) {};
@@ -769,8 +770,6 @@ struct TryToInstall {
    void operator() (pkgCache::VerIterator const &Ver) {
    void operator() (pkgCache::VerIterator const &Ver) {
       pkgCache::PkgIterator Pkg = Ver.ParentPkg();
       pkgCache::PkgIterator Pkg = Ver.ParentPkg();
 
 
-std::clog << "INSTALL " << Pkg << " VER " << Ver.VerStr() << std::endl;
-
       Cache->GetDepCache()->SetCandidateVersion(Ver);
       Cache->GetDepCache()->SetCandidateVersion(Ver);
       pkgDepCache::StateCache &State = (*Cache)[Pkg];
       pkgDepCache::StateCache &State = (*Cache)[Pkg];
 
 
@@ -801,8 +800,8 @@ std::clog << "INSTALL " << Pkg << " VER " << Ver.VerStr() << std::endl;
 
 
 	 // Install it with autoinstalling enabled (if we not respect the minial
 	 // Install it with autoinstalling enabled (if we not respect the minial
 	 // required deps or the policy)
 	 // required deps or the policy)
-	 if ((State.InstBroken() == true || State.InstPolicyBroken() == true) && FixBroken == false)
-	    Cache->GetDepCache()->MarkInstall(Pkg,true);
+	 if (FixBroken == false)
+	    doAutoInstallLater.insert(Pkg);
       }
       }
 
 
       // see if we need to fix the auto-mark flag
       // see if we need to fix the auto-mark flag
@@ -820,6 +819,17 @@ std::clog << "INSTALL " << Pkg << " VER " << Ver.VerStr() << std::endl;
 	 AutoMarkChanged++;
 	 AutoMarkChanged++;
       }
       }
    }
    }
+
+   void doAutoInstall() {
+      for (APT::PackageSet::const_iterator P = doAutoInstallLater.begin();
+	   P != doAutoInstallLater.end(); ++P) {
+	 pkgDepCache::StateCache &State = (*Cache)[P];
+	 if (State.InstBroken() == false && State.InstPolicyBroken() == false)
+	    continue;
+	 Cache->GetDepCache()->MarkInstall(P, true);
+      }
+      doAutoInstallLater.clear();
+   }
 };
 };
 									/*}}}*/
 									/*}}}*/
 // TryToRemove - Mark a package for removal				/*{{{*/
 // TryToRemove - Mark a package for removal				/*{{{*/
@@ -1336,6 +1346,7 @@ bool TryToInstallBuildDep(pkgCache::PkgIterator Pkg,pkgCacheFile &Cache,
    } else if (Cache[Pkg].CandidateVer != 0) {
    } else if (Cache[Pkg].CandidateVer != 0) {
       TryToInstall InstallAction(Cache, Fix, BrokenFix);
       TryToInstall InstallAction(Cache, Fix, BrokenFix);
       InstallAction(Cache[Pkg].CandidateVerIter(Cache));
       InstallAction(Cache[Pkg].CandidateVerIter(Cache));
+      InstallAction.doAutoInstall();
    } else
    } else
       return AllowFail;
       return AllowFail;
 
 
@@ -1743,8 +1754,10 @@ bool DoInstall(CommandLine &CmdL)
 
 
       for (unsigned short i = 0; order[i] != 0; ++i)
       for (unsigned short i = 0; order[i] != 0; ++i)
       {
       {
-	 if (order[i] == MOD_INSTALL)
+	 if (order[i] == MOD_INSTALL) {
 	    InstallAction = std::for_each(verset[MOD_INSTALL].begin(), verset[MOD_INSTALL].end(), InstallAction);
 	    InstallAction = std::for_each(verset[MOD_INSTALL].begin(), verset[MOD_INSTALL].end(), InstallAction);
+	    InstallAction.doAutoInstall();
+	 }
 	 else if (order[i] == MOD_REMOVE)
 	 else if (order[i] == MOD_REMOVE)
 	    RemoveAction = std::for_each(verset[MOD_REMOVE].begin(), verset[MOD_REMOVE].end(), RemoveAction);
 	    RemoveAction = std::for_each(verset[MOD_REMOVE].begin(), verset[MOD_REMOVE].end(), RemoveAction);
       }
       }

+ 1 - 0
debian/changelog

@@ -10,6 +10,7 @@ apt (0.7.26~exp8) UNRELEASED; urgency=low
     - check in Grouped* first without modifier interpretation
     - check in Grouped* first without modifier interpretation
   * cmdline/apt-get.cc:
   * cmdline/apt-get.cc:
     - use the cachsets in the install commands
     - use the cachsets in the install commands
+    - make the specify order of packages irrelevant (half-close #196021)
   * apt-pkg/orderlist.cc:
   * apt-pkg/orderlist.cc:
     - untouched packages are never missing
     - untouched packages are never missing
   * apt-pkg/packagemanager.cc:
   * apt-pkg/packagemanager.cc: