]> git.saurik.com Git - apt.git/commitdiff
doesn't execute autoremove marker setting if an external solver is called
authorDavid Kalnischkies <kalnischkies@gmail.com>
Mon, 2 May 2011 15:06:47 +0000 (17:06 +0200)
committerDavid Kalnischkies <kalnischkies@gmail.com>
Mon, 2 May 2011 15:06:47 +0000 (17:06 +0200)
and instead rely on the Autoremove tagging to show us what could be done.

(apt-internal-solver doesn't support this currently as it doesn't load
 the auto-information into the cache)

apt-pkg/algorithms.cc
apt-pkg/depcache.cc
apt-pkg/edsp.cc

index 82b1d608dccff159e04473f962168ec68ae8381b..fea9e92e15d71958f1ad713d5e563a95b6d2ea1c 100644 (file)
@@ -756,6 +756,8 @@ bool pkgProblemResolver::Resolve(bool BrokenFix)
 
       if (EDSP::ReadResponse(solver_out, Cache) == false)
         return _error->Error("Reading solver response failed");
+
+      return true;
    }
    return ResolveInternal(BrokenFix);
 }
index ed9e2084c19f33c202e0bdb108bd3345b8ae7aaa..31410e2a69202596cd09021219e3fc5a589d6865 100644 (file)
@@ -1609,6 +1609,9 @@ bool pkgDepCache::MarkFollowsSuggests()
 // pkgDepCache::MarkRequired - the main mark algorithm                 /*{{{*/
 bool pkgDepCache::MarkRequired(InRootSetFunc &userFunc)
 {
+   if (_config->Find("APT::Solver::Name", "internal") != "internal")
+      return true;
+
    bool follow_recommends;
    bool follow_suggests;
    bool debug_autoremove = _config->FindB("Debug::pkgAutoRemove",false);
index c3e608d1730ace7d55c92d2f30f1a9f7898433b5..f35570c1275c09d577dd0fddc1b213ff908f24b5 100644 (file)
@@ -227,9 +227,12 @@ bool EDSP::ReadResponse(int const input, pkgDepCache &Cache) {
           would be too easy for a (buggy) solver to segfault APT… */
        unsigned long long const VersionCount = Cache.Head().VersionCount;
        unsigned long VerIdx[VersionCount];
-       for (pkgCache::PkgIterator P = Cache.PkgBegin(); P.end() == false; ++P)
+       for (pkgCache::PkgIterator P = Cache.PkgBegin(); P.end() == false; ++P) {
                for (pkgCache::VerIterator V = P.VersionList(); V.end() == false; ++V)
                        VerIdx[V->ID] = V.Index();
+               Cache[P].Marked = true;
+               Cache[P].Garbage = false;
+       }
 
        FileFd in;
        in.OpenDescriptor(input, FileFd::ReadOnly);
@@ -252,7 +255,9 @@ bool EDSP::ReadResponse(int const input, pkgDepCache &Cache) {
                        else
                                std::clog << msg << std::endl;
                        continue;
-               } else
+               } else if (section.Exists("Autoremove") == true)
+                       type = "Autoremove";
+               else
                        continue;
 
                size_t const id = section.FindULL(type.c_str(), VersionCount);
@@ -270,6 +275,10 @@ bool EDSP::ReadResponse(int const input, pkgDepCache &Cache) {
                        Cache.MarkInstall(Ver.ParentPkg(), false, false);
                else if (type == "Remove")
                        Cache.MarkDelete(Ver.ParentPkg(), false);
+               else if (type == "Autoremove") {
+                       Cache[Ver.ParentPkg()].Marked = false;
+                       Cache[Ver.ParentPkg()].Garbage = true;
+               }
        }
        return true;
 }
@@ -423,6 +432,13 @@ bool EDSP::WriteSolution(pkgDepCache &Cache, FILE* output)
         if (Debug == true)
            fprintf(output, "Package: %s\nVersion: %s\n", Pkg.FullName().c_str(), Cache.GetCandidateVer(Pkg).VerStr());
       }
+      else if (Cache[Pkg].Garbage == true)
+      {
+        fprintf(output, "Autoremove: %d\n", Pkg.CurrentVer()->ID);
+        if (Debug == true)
+           fprintf(output, "Package: %s\nVersion: %s\n", Pkg.FullName().c_str(), Pkg.CurrentVer().VerStr());
+           fprintf(stderr, "Autoremove: %s\nVersion: %s\n", Pkg.FullName().c_str(), Pkg.CurrentVer().VerStr());
+      }
       else
         continue;
       fprintf(output, "\n");