From e3674d91d27a7290d2b01e14eb2540e10be9d883 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 30 Mar 2011 22:15:40 +0200 Subject: be able to write solutions, too --- apt-pkg/edsp/edspwriter.cc | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'apt-pkg/edsp/edspwriter.cc') diff --git a/apt-pkg/edsp/edspwriter.cc b/apt-pkg/edsp/edspwriter.cc index 38d0d82c5..ea46065c2 100644 --- a/apt-pkg/edsp/edspwriter.cc +++ b/apt-pkg/edsp/edspwriter.cc @@ -125,6 +125,26 @@ bool edspWriter::WriteRequest(pkgDepCache &Cache, FILE* output) if (upgrade.empty() == false) fprintf(output, "Upgrade: %s\n", upgrade.c_str()+2); + return true; +} + /*}}}*/ +// edspWriter::WriteSolution - to the given file descriptor /*{{{*/ +bool edspWriter::WriteSolution(pkgDepCache &Cache, FILE* output) +{ + bool const Debug = _config->FindB("Debug::EDSPWriter::WriteSolution", false); + for (pkgCache::PkgIterator Pkg = Cache.PkgBegin(); Pkg.end() == false; ++Pkg) + { + if (Cache[Pkg].Delete() == true) + fprintf(output, "Remove: %d\n", Cache.GetCandidateVer(Pkg)->ID); + else if (Cache[Pkg].NewInstall() == true || Cache[Pkg].Upgrade() == true) + fprintf(output, "Install: %d\n", Cache.GetCandidateVer(Pkg)->ID); + else + continue; + if (Debug == true) + fprintf(output, "Package: %s\nVersion: %s\n", Pkg.FullName().c_str(), Cache.GetCandidateVer(Pkg).VerStr()); + fprintf(output, "\n"); + } + return true; } /*}}}*/ -- cgit v1.2.3