From c8b8f563ec2ff0f006a6d77469eaa656050f1fcc Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Thu, 13 Mar 2025 15:15:19 +0100 Subject: zstd: The compressor level should be -6, not -19 We created a very slow zstd, we don't default to high levels for other compressors... --- apt-pkg/aptconfiguration.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'apt-pkg') diff --git a/apt-pkg/aptconfiguration.cc b/apt-pkg/aptconfiguration.cc index f462b6eda..96ff8b285 100644 --- a/apt-pkg/aptconfiguration.cc +++ b/apt-pkg/aptconfiguration.cc @@ -368,7 +368,7 @@ const Configuration::getCompressors(bool const Cached) { { CompressorsDone.push_back(NAME); compressors.emplace_back(NAME, EXT, BINARY, ARG, DEARG, COST); } APT_ADD_COMPRESSOR(".", "", "", nullptr, nullptr, 0) if (_config->Exists("Dir::Bin::zstd") == false || FileExists(_config->Find("Dir::Bin::zstd")) == true) - APT_ADD_COMPRESSOR("zstd", ".zst", "zstd", "-19", "-d", 60) + APT_ADD_COMPRESSOR("zstd", ".zst", "zstd", "-6", "-d", 60) #ifdef HAVE_ZSTD else APT_ADD_COMPRESSOR("zstd", ".zst", "false", nullptr, nullptr, 60) -- cgit v1.2.3-70-g09d2 From 11917fa559c6c9bc5b0993b435f295de06bd161c Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Thu, 13 Mar 2025 15:15:58 +0100 Subject: edsp: Add functionality to only write relevant packages Add a variant of WriteLimitedScenario that does not take a pkgset, but creates one on the fly based on the transitive closure of installed packages, to be installed packages, and their dependencies and provides. This includes more packages than strictly necessary, i.e. we do not really need to include foo just because a package we want to install Conflicts with it, but oh well, this is easy to read. Trying to extend the filtering is hard as the dependencies being written are also filtered... --- apt-pkg/edsp.cc | 30 ++++++++++++++++++++++++++++++ apt-pkg/edsp.h | 16 ++++++++++++++++ 2 files changed, 46 insertions(+) (limited to 'apt-pkg') diff --git a/apt-pkg/edsp.cc b/apt-pkg/edsp.cc index 88569d3c4..2e6ef6271 100644 --- a/apt-pkg/edsp.cc +++ b/apt-pkg/edsp.cc @@ -327,6 +327,36 @@ bool EDSP::WriteLimitedScenario(pkgDepCache &Cache, FileFd &output, Progress->Done(); return Okay; } + +static void MarkPackage(std::vector &pkgset, pkgCache::PkgIterator pkg) +{ + if (pkgset[pkg->ID]) + return; + pkgset[pkg->ID] = true; + for (auto ver = pkg.VersionList(); not ver.end(); ++ver) + { + for (auto P = ver.ProvidesList(); not P.end(); ++P) + MarkPackage(pkgset, P.ParentPkg()); + for (auto D = ver.DependsList(); not D.end(); ++D) + { + std::unique_ptr targets(D.AllTargets()); + for (size_t i = 0; targets[i] != 0; ++i) + MarkPackage(pkgset, pkgCache::VerIterator(*ver.Cache(), targets[i]).ParentPkg()); + + MarkPackage(pkgset, D.TargetPkg()); + } + } +} + +bool EDSP::WriteLimitedScenario(pkgDepCache &Cache, FileFd &output, + OpProgress *Progress) +{ + std::vector pkgset(Cache.Head().PackageCount); + for (auto Pkg = Cache.PkgBegin(); not Pkg.end(); ++Pkg) + if (Cache[Pkg].Install() || Pkg->CurrentVer) + MarkPackage(pkgset, Pkg); + return WriteLimitedScenario(Cache, output, pkgset, Progress); +} /*}}}*/ // EDSP::WriteRequest - to the given file descriptor /*{{{*/ bool EDSP::WriteRequest(pkgDepCache &Cache, FileFd &output, diff --git a/apt-pkg/edsp.h b/apt-pkg/edsp.h index 0c37e231d..22767bd7b 100644 --- a/apt-pkg/edsp.h +++ b/apt-pkg/edsp.h @@ -91,6 +91,22 @@ namespace EDSP /*{{{*/ std::vector const &pkgset, OpProgress *Progress = NULL); + /** \brief creates a limited scenario representing the package universe + * + * This method works similar to #WriteScenario as it works in the same + * way but doesn't send the complete universe to the solver but only + * packages reachable from installed packages or packages marked for + * install. + * + * \param Cache is the known package universe + * \param output is written to this "file" + * \param Progress is an instance to report progress to + * + * \return true if universe was composed successfully, otherwise false + */ + APT_PUBLIC bool WriteLimitedScenario(pkgDepCache &Cache, FileFd &output, + OpProgress *Progress = NULL); + /** \brief waits and acts on the information returned from the solver * * This method takes care of interpreting whatever the solver sends -- cgit v1.2.3-70-g09d2 From 8ed6bea2083e055b50dfbd8bebf1355cce502f3f Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Thu, 13 Mar 2025 15:55:50 +0100 Subject: edsp: Dump minimized Dir::Log::Solver logs --- apt-pkg/edsp.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'apt-pkg') diff --git a/apt-pkg/edsp.cc b/apt-pkg/edsp.cc index 2e6ef6271..02e8d4ef4 100644 --- a/apt-pkg/edsp.cc +++ b/apt-pkg/edsp.cc @@ -816,7 +816,7 @@ bool EDSP::ResolveExternal(const char* const solver, pkgDepCache &Cache, FileFd output; bool Okay = CreateDumpFile("EDSP::Resolve", "solver", output); Okay &= EDSP::WriteRequest(Cache, output, flags, nullptr); - return Okay && EDSP::WriteScenario(Cache, output, nullptr); + return Okay && EDSP::WriteLimitedScenario(Cache, output, nullptr); } _error->PushToStack(); int solver_in, solver_out; -- cgit v1.2.3-70-g09d2