summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2017-01-19 02:53:35 +0100
committerJulian Andres Klode <jak@debian.org>2017-02-22 16:53:46 +0100
commit4d7e1a2d0225c7a8bde300b7e86265e283db0e42 (patch)
treef7afef1a2b0a0259afbffc4356ddc0c8945de807
parent2e5726edcac4fc9228c6b16281365c3ade189b8b (diff)
fix 'install --no-download' mode
The mode wasn't working at all if not used together with --fix-missing which while likely to come in pairs its legal to use standalone. Regression-in: eb1f04dda07c2b69549ad9fd793cca0e91841b3e (cherry picked from commit 3313eaf97c83177433478505c05815ab02f9782b)
-rw-r--r--apt-private/private-install.cc13
-rwxr-xr-xtest/integration/test-apt-keep-downloaded-pkgs13
2 files changed, 20 insertions, 6 deletions
diff --git a/apt-private/private-install.cc b/apt-private/private-install.cc
index 62f4136af..700b779e9 100644
--- a/apt-private/private-install.cc
+++ b/apt-private/private-install.cc
@@ -136,16 +136,19 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask, bool Safety)
_error->PendingError() == true)
return false;
- if (_config->FindB("APT::Get::Fix-Missing",false) == true &&
- _config->FindB("APT::Get::Download",true) == false)
+ if (_config->FindB("APT::Get::Download",true) == false)
{
bool Missing = false;
RemoveDownloadNeedingItemsFromFetcher(Fetcher, Missing);
if (Missing)
- PM->FixMissing();
+ {
+ if (_config->FindB("APT::Get::Fix-Missing",false))
+ PM->FixMissing();
+ else
+ return _error->Error(_("Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?"));
+ }
Fetcher.Shutdown();
- if (PM->GetArchives(&Fetcher,List,&Recs) == false ||
- _error->PendingError() == true)
+ if (_error->PendingError() == true)
return false;
}
diff --git a/test/integration/test-apt-keep-downloaded-pkgs b/test/integration/test-apt-keep-downloaded-pkgs
index 4cc7fbb04..c5f62954c 100755
--- a/test/integration/test-apt-keep-downloaded-pkgs
+++ b/test/integration/test-apt-keep-downloaded-pkgs
@@ -15,14 +15,25 @@ buildsimplenativepackage 'pkg4' 'all' '1.0' 'stable'
# local (file) installs
setupaptarchive
+# a file:// "download" is not a real download and hence passes
+testsuccess aptget install pkg1 --no-download --download-only -y
+testfailure test -f rootdir/var/cache/apt/archives/pkg1_1.0_all.deb
+testsuccess test -f aptarchive/pool/pkg1_1.0_all.deb
+
# ensure that install from local sources does not remove debs
testsuccess aptget install pkg1 -o APT::Keep-Downloaded-Packages=false
testsuccess test -f aptarchive/pool/pkg1_1.0_all.deb
+testfailure test -f rootdir/var/cache/apt/archives/pkg1_1.0_all.deb
# now switch to http and downloading debs
changetowebserver
testsuccess aptget update
+# see if no-download really doesn't download the package
+testfailuremsg 'E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?' aptget install pkg2 --no-download -y
+testsuccess test -f aptarchive/pool/pkg2_1.0_all.deb
+testfailure test -f rootdir/var/cache/apt/archives/pkg2_1.0_all.deb
+
# ensure that the downloaded pkg is kept with "keep=true"
testsuccess aptget install pkg2 -o APT::Keep-Downloaded-Packages=true
testsuccess test -f aptarchive/pool/pkg2_1.0_all.deb
@@ -40,4 +51,4 @@ testfailure test -f rootdir/var/cache/apt/archives/pkg3_1.0_all.deb
# ensure that install from the download dir does not delete packages
mv aptarchive/pool/pkg4_1.0_all.deb rootdir/var/cache/apt/archives
testsuccess aptget install $(pwd)/rootdir/var/cache/apt/archives/pkg4_1.0_all.deb -o APT::Keep-Downloaded-Packages=false
-testsuccess test -f $(pwd)/rootdir/var/cache/apt/archives/pkg4_1.0_all.deb \ No newline at end of file
+testsuccess test -f $(pwd)/rootdir/var/cache/apt/archives/pkg4_1.0_all.deb