]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/depcache.cc
merged lp:~mvo/apt/conflicts-on-virtuals to better deal with
[apt.git] / apt-pkg / depcache.cc
index bc663a8e954cfe811fea2efb92e1325b65719789..018b05e65a476da59ef8d9569ec7e36408e546b9 100644 (file)
@@ -227,7 +227,7 @@ bool pkgDepCache::writeStateFile(OpProgress *prog, bool InstalledOnly)      /*{{{*/
    // if it does not exist, create a empty one
    if(!FileExists(state)) 
    {
-      StateFile.Open(state, FileFd::WriteEmpty);
+      StateFile.Open(state, FileFd::WriteAtomic);
       StateFile.Close();
    }
 
@@ -1149,7 +1149,7 @@ void pkgDepCache::MarkDelete(PkgIterator const &Pkg, bool rPurge,
       return;
 
    if (DebugMarker == true)
-      std::clog << OutputInDepth(Depth) << "MarkDelete " << Pkg << " FU=" << FromUser << std::endl;
+      std::clog << OutputInDepth(Depth) << (rPurge ? "MarkPurge " : "MarkDelete ") << Pkg << " FU=" << FromUser << std::endl;
 
    RemoveSizes(Pkg);
    RemoveStates(Pkg);
@@ -1167,6 +1167,15 @@ void pkgDepCache::MarkDelete(PkgIterator const &Pkg, bool rPurge,
    // if we remove the pseudo package, we also need to remove the "real"
    if (Pkg->CurrentVer != 0 && Pkg.CurrentVer().Pseudo() == true)
       MarkDelete(Pkg.Group().FindPkg("all"), rPurge, Depth+1, FromUser);
+   else if (rPurge == true && Pkg->CurrentVer == 0 &&
+           Pkg->CurrentState != pkgCache::State::NotInstalled &&
+           strcmp(Pkg.Arch(), "all") != 0)
+   {
+      PkgIterator const allPkg = Pkg.Group().FindPkg("all");
+      if (allPkg.end() == false && allPkg->CurrentVer == 0 &&
+         allPkg->CurrentState != pkgCache::State::NotInstalled)
+        MarkDelete(allPkg, rPurge, Depth+1, FromUser);
+   }
 }
                                                                        /*}}}*/
 // DepCache::IsDeleteOk - check if it is ok to remove this package     /*{{{*/
@@ -1425,10 +1434,13 @@ void pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst,
            VerIterator Ver(*this,*I);
            PkgIterator Pkg = Ver.ParentPkg();
 
-           if (Start->Type != Dep::DpkgBreaks)
-              MarkDelete(Pkg,false,Depth + 1, false);
-           else if (PkgState[Pkg->ID].CandidateVer != *I)
+           
+              
+           if (PkgState[Pkg->ID].CandidateVer != *I &&
+               Start->Type == Dep::DpkgBreaks)
               MarkInstall(Pkg,true,Depth + 1, false, ForceImportantDeps);
+           else
+              MarkDelete(Pkg,false,Depth + 1, false);
         }
         continue;
       }