summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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);
}