]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/depcache.cc
add a way to add packages to generate a dists style environment without
[apt.git] / apt-pkg / depcache.cc
index d893c42d7a658bffa7a16478edb276a9dbcec1d0..58e7ebf07f983efba6ec99784c2788490e9dc12e 100644 (file)
@@ -1192,6 +1192,16 @@ bool pkgDepCache::IsDeleteOk(PkgIterator const &Pkg,bool rPurge,
         std::clog << OutputInDepth(Depth) << "Hold prevents MarkDelete of " << Pkg << " FU=" << FromUser << std::endl;
       return false;
    }
+   else if (FromUser == false && Pkg->CurrentVer == 0)
+   {
+      StateCache &P = PkgState[Pkg->ID];
+      if (P.InstallVer != 0 && P.Status == 2 && (P.Flags & Flag::Auto) != Flag::Auto)
+      {
+        if (DebugMarker == true)
+           std::clog << OutputInDepth(Depth) << "Manual install request prevents MarkDelete of " << Pkg << std::endl;
+        return false;
+      }
+   }
    return true;
 }
                                                                        /*}}}*/
@@ -1434,8 +1444,11 @@ void pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst,
            VerIterator Ver(*this,*I);
            PkgIterator Pkg = Ver.ParentPkg();
 
-           
-              
+           /* The List includes all packages providing this dependency,
+              even providers which are not installed, so skip them. */
+           if (PkgState[Pkg->ID].InstallVer == 0)
+              continue;
+
            if (PkgState[Pkg->ID].CandidateVer != *I &&
                Start->Type == Dep::DpkgBreaks)
               MarkInstall(Pkg,true,Depth + 1, false, ForceImportantDeps);
@@ -1497,11 +1510,15 @@ void pkgDepCache::SetReInstall(PkgIterator const &Pkg,bool To)
 /* */
 void pkgDepCache::SetCandidateVersion(VerIterator TargetVer, bool const &Pseudo)
 {
-   ActionGroup group(*this);
 
    pkgCache::PkgIterator Pkg = TargetVer.ParentPkg();
    StateCache &P = PkgState[Pkg->ID];
 
+   if (P.CandidateVer == TargetVer)
+      return;
+
+   ActionGroup group(*this);
+
    RemoveSizes(Pkg);
    RemoveStates(Pkg);
 
@@ -1536,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)
 {
   StateCache &state = PkgState[Pkg->ID];