From 197d24e29549d96ea2a4804acdf8d70579d8934d Mon Sep 17 00:00:00 2001 From: Simon Quigley Date: Sat, 12 Apr 2025 21:00:38 -0500 Subject: [PATCH] [pkgselectprocess] Do not include uninstallable virtual packages in the CPBE output When we are creating the final list of packages to feed to "apt install," virtual packages which do not have a valid candidate are included in this list, causing the installation to fail. When creating this list, use FindGrp instead of FindPkg, and only add it to the list if there is a valid candidate. Additionally, add these items to an unordered set, to eliminate deduplication (LP: #2106773). A reliable testcase for this is the libreoffice-help-is package, at least in Plucky. --- .../pkgselectprocess/checkpackage-backend.cpp | 13 +++++++++++-- debian/changelog | 11 +++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/common/modules/pkgselectprocess/checkpackage-backend.cpp b/common/modules/pkgselectprocess/checkpackage-backend.cpp index 403e93d..454f2b0 100644 --- a/common/modules/pkgselectprocess/checkpackage-backend.cpp +++ b/common/modules/pkgselectprocess/checkpackage-backend.cpp @@ -1,5 +1,6 @@ #include #include +#include #include #include #include @@ -28,9 +29,17 @@ int main(int argc, char* argv[]) { std::vector package_names(argv + 1, argv + argc); if (package_names.empty()) return 0; + std::unordered_set seen_packages; for (std::string package_name : package_names) { - pkgCache::PkgIterator it = cache->GetPkgCache()->FindPkg(package_name); - if (!it.end()) std::cout << package_name << " "; + if (seen_packages.contains(package_name)) continue; + seen_packages.insert(package_name); + pkgCache::GrpIterator grp = cache->GetPkgCache()->FindGrp(package_name); + if (!grp.end()) { + pkgCache::PkgIterator it = grp.FindPreferredPkg(true); + if (!it.end() && !it.VersionList().end()) { + std::cout << package_name << " "; + } + } } std::cout << "\n"; diff --git a/debian/changelog b/debian/changelog index 24bb0f9..abbf370 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,14 @@ +calamares-settings-ubuntu (1:25.04.25) UNRELEASED; urgency=medium + + * [pkgselectprocess] When we are creating the final list of packages to feed + to "apt install," virtual packages which do not have a valid candidate are + included in this list, causing the installation to fail. When creating + this list, use FindGrp instead of FindPkg, and only add it to the list if + there is a valid candidate. Additionally, add these items to an unordered + set, to eliminate deduplication (LP: #2106773). + + -- Simon Quigley Sat, 12 Apr 2025 00:23:39 -0500 + calamares-settings-ubuntu (1:25.04.24) plucky; urgency=medium * Bump Standards-Version to 4.7.2, no changes needed.