summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2017-05-29 18:02:28 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2017-06-26 23:31:15 +0200
commit3243dc51579f42971b8c5a7a123a77352aecc6f7 (patch)
tree0a2a116a20454cf673d8ad8a630ebfd008d8122e
parentfc2055e1e08e4e3b662b0c5f67a0d0a57267acd3 (diff)
don't show incorrect 'How odd' errror in no-download mode
Showing messages related to downloading in a mode which can't download is pretty pointless, so instead of trying harder to make it so that these messages do not trigger just skip them entirely. That the message triggered here is an artifact of the implementation in which the download items are finished, while the code expects them to be still pending – even the in a previous run completely downloaded files. Closes: 863635
-rw-r--r--apt-private/private-install.cc49
1 files changed, 27 insertions, 22 deletions
diff --git a/apt-private/private-install.cc b/apt-private/private-install.cc
index 73a03a828..e37ff5390 100644
--- a/apt-private/private-install.cc
+++ b/apt-private/private-install.cc
@@ -109,6 +109,7 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask, bool Safety)
Cache->MarkDelete(I,true);
// Create the download object
+ auto const DownloadAllowed = _config->FindB("APT::Get::Download",true);
aptAcquireWithTextStatus Fetcher;
if (_config->FindB("APT::Get::Print-URIs", false) == true)
{
@@ -136,7 +137,7 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask, bool Safety)
_error->PendingError() == true)
return false;
- if (_config->FindB("APT::Get::Download",true) == false)
+ if (DownloadAllowed == false)
{
bool Missing = false;
RemoveDownloadNeedingItemsFromFetcher(Fetcher, Missing);
@@ -218,27 +219,30 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask, bool Safety)
return true;
}
- // Display statistics
- auto const FetchBytes = Fetcher.FetchNeeded();
- auto const FetchPBytes = Fetcher.PartialPresent();
- auto const DebBytes = Fetcher.TotalNeeded();
- if (DebBytes != Cache->DebSize())
+ auto const FetchBytes = DownloadAllowed ? Fetcher.FetchNeeded() : 0;
+ auto const FetchPBytes = DownloadAllowed ? Fetcher.PartialPresent() : 0;
+ if (DownloadAllowed)
{
- c0out << DebBytes << ',' << Cache->DebSize() << std::endl;
- c0out << _("How odd... The sizes didn't match, email apt@packages.debian.org") << std::endl;
- }
-
- // Number of bytes
- 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,_("Need to get %sB/%sB of archives.\n"),
+ // Display statistics
+ auto const DebBytes = Fetcher.TotalNeeded();
+ if (DebBytes != Cache->DebSize())
+ {
+ c0out << "E: " << DebBytes << ',' << Cache->DebSize() << std::endl;
+ c0out << "E: " << _("How odd... The sizes didn't match, email apt@packages.debian.org") << std::endl;
+ }
+
+ // Number of bytes
+ 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,_("Need to get %sB/%sB of archives.\n"),
SizeToStr(FetchBytes).c_str(),SizeToStr(DebBytes).c_str());
- else if (DebBytes != 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,_("Need to get %sB of archives.\n"),
+ else if (DebBytes != 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,_("Need to get %sB of archives.\n"),
SizeToStr(DebBytes).c_str());
+ }
// Size delta
if (Cache->UsrSize() >= 0)
@@ -252,8 +256,9 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask, bool Safety)
ioprintf(c1out,_("After this operation, %sB disk space will be freed.\n"),
SizeToStr(-1*Cache->UsrSize()).c_str());
- if (CheckFreeSpaceBeforeDownload(_config->FindDir("Dir::Cache::Archives"), (FetchBytes - FetchPBytes)) == false)
- return false;
+ if (DownloadAllowed)
+ if (CheckFreeSpaceBeforeDownload(_config->FindDir("Dir::Cache::Archives"), (FetchBytes - FetchPBytes)) == false)
+ return false;
if (_error->PendingError() == true)
return false;
@@ -362,7 +367,7 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask, bool Safety)
return false;
Failed = false;
- if (_config->FindB("APT::Get::Download",true) == false)
+ if (DownloadAllowed == false)
RemoveDownloadNeedingItemsFromFetcher(Fetcher, Failed);
}