From 6d38011bb93451dd9da3294614d821c77ac91687 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 30 Mar 2011 17:23:43 +0200 Subject: add a first round of stuff needed for talking between APT and solvers based on a very early draft for EDSP by Stefano APT can now write a scenario as well as load most stuff from it. --- apt-pkg/depcache.cc | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'apt-pkg/depcache.cc') diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc index 07803d7bf..2790080a1 100644 --- a/apt-pkg/depcache.cc +++ b/apt-pkg/depcache.cc @@ -1578,6 +1578,12 @@ bool pkgDepCache::Policy::IsImportantDep(DepIterator const &Dep) return false; } /*}}}*/ +// Policy::GetPriority - Get the priority of the package pin /*{{{*/ +signed short pkgDepCache::Policy::GetPriority(pkgCache::PkgIterator const &Pkg) +{ return 0; }; +signed short pkgDepCache::Policy::GetPriority(pkgCache::PkgFileIterator const &File) +{ return 0; }; + /*}}}*/ pkgDepCache::InRootSetFunc *pkgDepCache::GetRootSetFunc() /*{{{*/ { DefaultRootSetFunc *f = new DefaultRootSetFunc; -- cgit v1.2.3-70-g09d2 From 3f248168dca69008fd8b7f8338dc76d767b47b43 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sat, 2 Apr 2011 15:54:39 +0200 Subject: disable automatical installation of dependencies in MarkInstall if we will not use the default internal resolver later on --- apt-pkg/depcache.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'apt-pkg/depcache.cc') diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc index 2790080a1..ed9e2084c 100644 --- a/apt-pkg/depcache.cc +++ b/apt-pkg/depcache.cc @@ -1056,7 +1056,7 @@ void pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst, Update(Pkg); AddSizes(Pkg); - if (AutoInst == false) + if (AutoInst == false || _config->Find("APT::Solver::Name", "internal") != "internal") return; if (DebugMarker == true) -- cgit v1.2.3-70-g09d2 From 76d4aab06d3c5edd60362fd14b38eb43416616f0 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 2 May 2011 17:06:47 +0200 Subject: doesn't execute autoremove marker setting if an external solver is called 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 | 2 ++ apt-pkg/depcache.cc | 3 +++ apt-pkg/edsp.cc | 20 ++++++++++++++++++-- 3 files changed, 23 insertions(+), 2 deletions(-) (limited to 'apt-pkg/depcache.cc') diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc index 82b1d608d..fea9e92e1 100644 --- a/apt-pkg/algorithms.cc +++ b/apt-pkg/algorithms.cc @@ -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); } diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc index ed9e2084c..31410e2a6 100644 --- a/apt-pkg/depcache.cc +++ b/apt-pkg/depcache.cc @@ -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); diff --git a/apt-pkg/edsp.cc b/apt-pkg/edsp.cc index c3e608d17..f35570c12 100644 --- a/apt-pkg/edsp.cc +++ b/apt-pkg/edsp.cc @@ -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"); -- cgit v1.2.3-70-g09d2