summaryrefslogtreecommitdiff
path: root/apt-private
diff options
context:
space:
mode:
authorJulian Andres Klode <julian.klode@canonical.com>2023-09-20 09:46:51 +0200
committerJulian Andres Klode <julian.klode@canonical.com>2023-09-20 09:47:47 +0200
commit925ada57d999a502dc2342092f32232b803be254 (patch)
tree7ab02a2a85efb413bc0c567e31d638dab45ed16d /apt-private
parent4b6585f6107ecd68f9d90124f7ad11ae0e10baf1 (diff)
Downgrade unmerged-usr from error to two warnings
One warning will be issued before the Y/n prompt, the other will be issued at the end after package installs have been attempted or if there were other failures, such that the last line you see is warnings about unmerged-usr I do not anticipate this to be the final version either, but there we go. Closes: #1052058
Diffstat (limited to 'apt-private')
-rw-r--r--apt-private/private-install.cc49
1 files changed, 32 insertions, 17 deletions
diff --git a/apt-private/private-install.cc b/apt-private/private-install.cc
index a195df848..e366634ad 100644
--- a/apt-private/private-install.cc
+++ b/apt-private/private-install.cc
@@ -111,8 +111,39 @@ static void RemoveDownloadNeedingItemsFromFetcher(pkgAcquire &Fetcher, bool &Tra
I = Fetcher.ItemsBegin();
}
}
+#ifdef REQUIRE_MERGED_USR
+// \brief Issues a warning about usrmerge when destructed so we can call it after install finished or failed or whatever.
+struct WarnUsrMerge {
+ CacheFile &Cache;
+ WarnUsrMerge(CacheFile &Cache) : Cache(Cache) {
+
+ }
+ void warn() {
+ auto usrmergePkg = Cache->FindPkg("usrmerge");
+ if (not APT::Configuration::isChroot() && _config->FindDir("Dir") == std::string("/") &&
+ not usrmergePkg.end() && not usrmergePkg.VersionList().end() &&
+ not Cache[usrmergePkg].Install() && not APT::Configuration::checkUsrMerged())
+ {
+ _error->Warning(_("Unmerged usr is no longer supported, use usrmerge to convert to a merged-usr system."));
+ for (auto VF = usrmergePkg.VersionList().FileList(); not VF.end(); ++VF)
+ if (VF.File().Origin() != nullptr && VF.File().Origin() == std::string("Debian"))
+ {
+ // TRANSLATORS: %s is a url to a page describing merged-usr (bookworm release notes)
+ _error->Notice(_("See %s for more details."), "https://www.debian.org/releases/bookworm/amd64/release-notes/ch-information.en.html#a-merged-usr-is-now-required");
+ break;
+ }
+ }
+ }
+ ~WarnUsrMerge() {
+ warn();
+ }
+};
+#endif
bool InstallPackages(CacheFile &Cache, APT::PackageVector &HeldBackPackages, bool ShwKept, bool Ask, bool Safety, std::string const &Hook, CommandLine const &CmdL)
{
+#ifdef REQUIRE_MERGED_USR
+ WarnUsrMerge warnUsrMerge(Cache);
+#endif
if (not RunScripts("APT::Install::Pre-Invoke"))
return false;
if (_config->FindB("APT::Get::Purge", false) == true)
@@ -216,23 +247,7 @@ bool InstallPackages(CacheFile &Cache, APT::PackageVector &HeldBackPackages, boo
return _error->Error(_("Packages need to be removed but remove is disabled."));
#ifdef REQUIRE_MERGED_USR
- _error->PushToStack();
- auto usrmergePkg = Cache->FindPkg("usrmerge");
- if (not APT::Configuration::isChroot() && _config->FindDir("Dir") == std::string("/") &&
- not usrmergePkg.end() && not usrmergePkg.VersionList().end() &&
- not Cache[usrmergePkg].Install() && not APT::Configuration::checkUsrMerged())
- {
- _error->Error(_("Unmerged usr is no longer supported, install usrmerge to continue."));
- for (auto VF = usrmergePkg.VersionList().FileList(); not VF.end(); ++VF)
- if (VF.File().Origin() == std::string("Debian"))
- {
- // TRANSLATORS: %s is a url to a page describing merged-usr (bookworm release notes)
- _error->Notice(_("See %s for more details."), "https://www.debian.org/releases/bookworm/amd64/release-notes/ch-information.en.html#a-merged-usr-is-now-required");
- break;
- }
- return false;
- }
- _error->RevertToStack();
+ warnUsrMerge.warn();
#endif
// Fail safe check