Quellcode durchsuchen

apply a very simple speed-up in case we try to set the candidate version
of a package to the version which is already the candidate
(apt-get does that for all packages it installs for simplicity)

David Kalnischkies vor 15 Jahren
Ursprung
Commit
08fa1cab61
1 geänderte Dateien mit 9 neuen und 2 gelöschten Zeilen
  1. 9 2
      apt-pkg/depcache.cc

+ 9 - 2
apt-pkg/depcache.cc

@@ -1510,11 +1510,15 @@ void pkgDepCache::SetReInstall(PkgIterator const &Pkg,bool To)
 /* */
 /* */
 void pkgDepCache::SetCandidateVersion(VerIterator TargetVer, bool const &Pseudo)
 void pkgDepCache::SetCandidateVersion(VerIterator TargetVer, bool const &Pseudo)
 {
 {
-   ActionGroup group(*this);
 
 
    pkgCache::PkgIterator Pkg = TargetVer.ParentPkg();
    pkgCache::PkgIterator Pkg = TargetVer.ParentPkg();
    StateCache &P = PkgState[Pkg->ID];
    StateCache &P = PkgState[Pkg->ID];
 
 
+   if (P.CandidateVer == TargetVer)
+      return;
+
+   ActionGroup group(*this);
+
    RemoveSizes(Pkg);
    RemoveSizes(Pkg);
    RemoveStates(Pkg);
    RemoveStates(Pkg);
 
 
@@ -1549,7 +1553,10 @@ void pkgDepCache::SetCandidateVersion(VerIterator TargetVer, bool const &Pseudo)
       }
       }
    }
    }
 }
 }
-
+									/*}}}*/
+// DepCache::MarkAuto - set the Auto flag for a package			/*{{{*/
+// ---------------------------------------------------------------------
+/* */
 void pkgDepCache::MarkAuto(const PkgIterator &Pkg, bool Auto)
 void pkgDepCache::MarkAuto(const PkgIterator &Pkg, bool Auto)
 {
 {
   StateCache &state = PkgState[Pkg->ID];
   StateCache &state = PkgState[Pkg->ID];