summaryrefslogtreecommitdiffstats
path: root/apt-private
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-14 19:05:54 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-14 19:05:54 +0000
commit3fe0849ae10d09c68ddfa60e7007d84a3d2cb09a (patch)
tree576d93e852d51d18a2d69a62108bc7434c3c3f7d /apt-private
parentAdding debian version 2.9.0. (diff)
downloadapt-3fe0849ae10d09c68ddfa60e7007d84a3d2cb09a.tar.xz
apt-3fe0849ae10d09c68ddfa60e7007d84a3d2cb09a.zip
Merging upstream version 2.9.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'apt-private')
-rw-r--r--apt-private/private-install.cc71
-rw-r--r--apt-private/private-output.cc18
2 files changed, 78 insertions, 11 deletions
diff --git a/apt-private/private-install.cc b/apt-private/private-install.cc
index 3efae01..ecbd703 100644
--- a/apt-private/private-install.cc
+++ b/apt-private/private-install.cc
@@ -28,6 +28,8 @@
#include <map>
#include <set>
#include <vector>
+#include <langinfo.h>
+#include <sys/statvfs.h>
#include <apt-private/acqprogress.h>
#include <apt-private/private-cachefile.h>
@@ -322,7 +324,7 @@ bool InstallPackages(CacheFile &Cache, APT::PackageVector &HeldBackPackages, boo
if (DebBytes != FetchBytes)
//TRANSLATOR: The required space between number and unit is already included
// in the replacement strings, so %sB will be correctly translate in e.g. 1,5 MB
- ioprintf(c1out,outVer < 30 ? _("Need to get %sB/%sB of archives.\n") : _(" Download size: %sB/%sB\n"),
+ ioprintf(c1out,outVer < 30 ? _("Need to get %sB/%sB of archives.\n") : _(" Download size: %sB / %sB\n"),
SizeToStr(FetchBytes).c_str(),SizeToStr(DebBytes).c_str());
else if (DebBytes != 0)
//TRANSLATOR: The required space between number and unit is already included
@@ -333,10 +335,69 @@ bool InstallPackages(CacheFile &Cache, APT::PackageVector &HeldBackPackages, boo
// Size delta
if (Cache->UsrSize() >= 0)
+ {
//TRANSLATOR: The required space between number and unit is already included
// in the replacement string, so %sB will be correctly translate in e.g. 1,5 MB
- ioprintf(c1out,outVer < 30 ? _("After this operation, %sB of additional disk space will be used.\n") : _(" Installed size: %sB\n"),
- SizeToStr(Cache->UsrSize()).c_str());
+ if (outVer < 30)
+ ioprintf(c1out, _("After this operation, %sB of additional disk space will be used.\n"),
+ SizeToStr(Cache->UsrSize()).c_str());
+ else
+ {
+ struct statvfs st;
+ if (statvfs(_config->FindDir("Dir::Usr").c_str(), &st) == 0)
+ {
+ struct statvfs st_boot;
+ double BootSize = 0;
+ double InitrdSize = 0;
+ if (statvfs(_config->FindDir("Dir::Boot").c_str(), &st_boot) == 0 && st_boot.f_fsid != st.f_fsid)
+ BootSize = Cache->BootSize(false);
+ else
+ InitrdSize = Cache->BootSize(true); /* initrd only, adding to /usr space */
+
+ ioprintf(c1out, " ");
+ // TRANSLATOR: The required space between number and unit is already included
+ // in the replacement string, so %sB will be correctly translate in e.g. 1,5 MB
+ ioprintf(c1out, _("Space needed: %sB / %sB available\n"),
+ SizeToStr(Cache->UsrSize() + InitrdSize).c_str(), SizeToStr((st.f_bsize * st.f_bavail)).c_str());
+
+ if (Cache->UsrSize() > 0 && static_cast<unsigned long long>(Cache->UsrSize()) > (st.f_bsize * st.f_bavail))
+ {
+ // TRANSLATOR: The required space between number and unit is already included
+ // in the replacement string, so %sB will be correctly translate in e.g. 1,5 MB
+ _error->Warning(_("More space needed than available: %sB > %sB, installation may fail"),
+ SizeToStr(Cache->UsrSize()).c_str(),
+ SizeToStr((st.f_bsize * st.f_bavail)).c_str());
+ }
+ if (BootSize != 0)
+ {
+ bool Unicode = strcmp(nl_langinfo(CODESET), "UTF-8") == 0;
+ ioprintf(c1out, Unicode ? " └─ " : " - ");
+ // TRANSLATOR: The required space between number and unit is already included
+ // in the replacement string, so %sB will be correctly translate in e.g. 1,5 MB -
+ // The first %s is the location of the boot directory (determined from Dir::Boot),
+ // and it tells the space being needed there.
+ // (We have two spaces to align with parent "space needed:"for /boot)
+ ioprintf(c1out, _("in %s: %sB / %sB available\n"),
+ _config->FindFile("Dir::Boot").c_str(), SizeToStr(BootSize).c_str(), SizeToStr((st_boot.f_bsize * st_boot.f_bavail)).c_str());
+ if (BootSize > (st_boot.f_bsize * st_boot.f_bavail))
+ // TRANSLATOR: The required space between number and unit is already included
+ // in the replacement string, so %sB will be correctly translate in e.g. 1,5 MB
+ // The first %s is the location of the boot directory (determined from Dir::Boot)
+ _error->Warning(_("More space needed in %s than available: %sB > %sB, installation may fail"),
+ _config->FindFile("Dir::Boot").c_str(),
+ SizeToStr(BootSize).c_str(),
+ SizeToStr((st_boot.f_bsize * st_boot.f_bavail)).c_str());
+ }
+ }
+ else
+ {
+ // TRANSLATOR: The required space between number and unit is already included
+ // in the replacement string, so %sB will be correctly translate in e.g. 1,5 MB
+ ioprintf(c1out, " ");
+ ioprintf(c1out, _("Space needed: %sB\n"), SizeToStr(Cache->UsrSize()).c_str());
+ }
+ }
+ }
else
//TRANSLATOR: The required space between number and unit is already included
// in the replacement string, so %sB will be correctly translate in e.g. 1,5 MB
@@ -380,7 +441,9 @@ bool InstallPackages(CacheFile &Cache, APT::PackageVector &HeldBackPackages, boo
if (_config->FindI("quiet",0) < 2 &&
_config->FindB("APT::Get::Assume-Yes",false) == false)
{
- if (YnPrompt(outVer < 30 ? _("Do you want to continue?") : _("Continue?")) == false)
+ // YnPrompt shows all warnings before prompting, so ask stronger and default to N if we have any.
+ auto Default = outVer < 30 ? true : _error->empty();
+ if (not YnPrompt(outVer < 30 ? _("Do you want to continue?") : (Default ? _("Continue?") : _("Continue anyway?")), Default))
{
c2out << _("Abort.") << std::endl;
exit(1);
diff --git a/apt-private/private-output.cc b/apt-private/private-output.cc
index bbf5039..95dc740 100644
--- a/apt-private/private-output.cc
+++ b/apt-private/private-output.cc
@@ -642,14 +642,14 @@ bool ShowDowngraded(ostream &out,CacheFile &Cache)
},
&PrettyFullName,
CurrentToCandidateVersion(&Cache),
- "APT::Color::Green");
+ "APT::Color::Yellow");
}
/*}}}*/
// ShowHold - Show held but changed packages /*{{{*/
bool ShowHold(ostream &out,CacheFile &Cache)
{
SortedPackageUniverse Universe(Cache);
- auto title = _config->FindI("APT::Output-Version") < 30 ? _("The following held packages will be changed:") : _("Changing held packages:Changing held packages:");
+ auto title = _config->FindI("APT::Output-Version") < 30 ? _("The following held packages will be changed:") : _("Changing held packages:");
return ShowList(out, title, Universe,
[&Cache](pkgCache::PkgIterator const &Pkg)
{
@@ -758,9 +758,11 @@ void Stats(ostream &out, pkgDepCache &Dep, APT::PackageVector const &HeldBackPac
if (Dep[I].Delete() == false && (Dep[I].iFlags & pkgDepCache::ReInstall) == pkgDepCache::ReInstall)
ReInstall++;
}
- if (outVer >= 30)
- ioprintf(out, _("Summary:\n"));
- ioprintf(out,outVer < 30 ? _("%lu upgraded, %lu newly installed, ") : _(" Upgrading: %lu, Installing: %lu, "),
+ if (outVer >= 30) {
+ ioprintf(out, _("Summary:"));
+ ioprintf(out, "\n ");
+ }
+ ioprintf(out,outVer < 30 ? _("%lu upgraded, %lu newly installed, ") : _("Upgrading: %lu, Installing: %lu, "),
Upgrade,Install);
if (ReInstall != 0)
@@ -771,10 +773,12 @@ void Stats(ostream &out, pkgDepCache &Dep, APT::PackageVector const &HeldBackPac
ioprintf(out, outVer < 30 ? _("%lu to remove and %lu not upgraded.\n") : _("Removing: %lu, Not Upgrading: %lu\n"),
Dep.DelCount(), HeldBackPackages.size());
- // FIXME: outVer
- if (Dep.BadCount() != 0)
+ if (Dep.BadCount() != 0) {
+ if (outVer >= 30)
+ ioprintf(out, " ");
ioprintf(out,_("%lu not fully installed or removed.\n"),
Dep.BadCount());
+ }
}
/*}}}*/
// YnPrompt - Yes No Prompt. /*{{{*/