summaryrefslogtreecommitdiff
path: root/apt-private/private-install.cc
diff options
context:
space:
mode:
Diffstat (limited to 'apt-private/private-install.cc')
-rw-r--r--apt-private/private-install.cc72
1 files changed, 38 insertions, 34 deletions
diff --git a/apt-private/private-install.cc b/apt-private/private-install.cc
index 73a03a828..aafe5542d 100644
--- a/apt-private/private-install.cc
+++ b/apt-private/private-install.cc
@@ -1,41 +1,40 @@
// Include Files /*{{{*/
#include <config.h>
-#include <apt-pkg/acquire.h>
#include <apt-pkg/acquire-item.h>
+#include <apt-pkg/acquire.h>
#include <apt-pkg/algorithms.h>
#include <apt-pkg/cachefile.h>
#include <apt-pkg/cacheset.h>
#include <apt-pkg/cmndline.h>
+#include <apt-pkg/configuration.h>
#include <apt-pkg/depcache.h>
#include <apt-pkg/error.h>
#include <apt-pkg/fileutl.h>
+#include <apt-pkg/install-progress.h>
+#include <apt-pkg/macros.h>
+#include <apt-pkg/packagemanager.h>
+#include <apt-pkg/pkgcache.h>
#include <apt-pkg/pkgrecords.h>
#include <apt-pkg/pkgsystem.h>
+#include <apt-pkg/prettyprinters.h>
#include <apt-pkg/sptr.h>
#include <apt-pkg/strutl.h>
-#include <apt-pkg/cacheiterators.h>
-#include <apt-pkg/configuration.h>
-#include <apt-pkg/macros.h>
-#include <apt-pkg/packagemanager.h>
-#include <apt-pkg/pkgcache.h>
#include <apt-pkg/upgrade.h>
-#include <apt-pkg/install-progress.h>
-#include <apt-pkg/prettyprinters.h>
-#include <stdlib.h>
-#include <string.h>
#include <algorithm>
#include <iostream>
+#include <map>
#include <set>
#include <vector>
-#include <map>
+#include <stdlib.h>
+#include <string.h>
#include <apt-private/acqprogress.h>
-#include <apt-private/private-install.h>
#include <apt-private/private-cachefile.h>
#include <apt-private/private-cacheset.h>
#include <apt-private/private-download.h>
+#include <apt-private/private-install.h>
#include <apt-private/private-output.h>
#include <apti18n.h>
@@ -109,6 +108,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 +136,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 +218,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 +255,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 +366,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);
}