summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2014-10-15 18:32:14 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2014-10-15 18:32:14 +0200
commit0977f81757f42889a9edb761061529041afe0a06 (patch)
treeb8ccdbd39bce1a82de8afc587c9bbe5becfe2913
parent79e85ea6054c9f34572f06598f73782466b164a8 (diff)
parent5afcfe2a51a9e47e95023b99bcab065d1975e950 (diff)
Merge branch 'debian/sid' into debian/experimental
The acquire code changed completely, so this is more an import of the testcase and a new fix than the merge of an existent fix. Conflicts: apt-pkg/acquire-item.cc
-rw-r--r--apt-pkg/acquire-item.cc10
-rwxr-xr-xtest/integration/test-apt-cdrom49
2 files changed, 48 insertions, 11 deletions
diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc
index c63253447..5187738e9 100644
--- a/apt-pkg/acquire-item.cc
+++ b/apt-pkg/acquire-item.cc
@@ -1288,6 +1288,11 @@ void pkgAcqIndex::ReverifyAfterIMS()
// a reverify (as its uncompressed on disk already)
DestFile = GetPartialFileNameFromURI(RealURI);
+ // do not reverify cdrom sources as apt-cdrom may rewrite the Packages
+ // file when its doing the indexcopy
+ if (RealURI.substr(0,6) == "cdrom:")
+ return;
+
// adjust DestFile if its compressed on disk
if (_config->FindB("Acquire::GzipIndexes",false) == true)
DestFile += '.' + CurrentCompressionExtension;
@@ -1398,11 +1403,6 @@ void pkgAcqIndex::StageDownloadDone(string Message,
// on if-modfied-since hit to avoid a stale attack against us
if(StringToBool(LookupTag(Message,"IMS-Hit"),false) == true)
{
- // do not reverify cdrom sources as apt-cdrom may rewrite the Packages
- // file when its doing the indexcopy
- if (RealURI.substr(0,6) == "cdrom:")
- return;
-
// The files timestamp matches, reverify by copy into partial/
EraseFileName = "";
ReverifyAfterIMS();
diff --git a/test/integration/test-apt-cdrom b/test/integration/test-apt-cdrom
index 9fbc4288d..2220a290c 100755
--- a/test/integration/test-apt-cdrom
+++ b/test/integration/test-apt-cdrom
@@ -66,22 +66,51 @@ CD_LABEL="$(echo "$ident" | grep "^Stored label:" | head -n1 | sed "s/^[^:]*: //
testequal "CD::${CD_ID} \"${CD_LABEL}\";
CD::${CD_ID}::Label \"${CD_LABEL}\";" cat rootdir/var/lib/apt/cdroms.list
-testequal 'Reading package lists...
+testcdromusage() {
+ touch rootdir/var/lib/apt/extended_states
+
+ testequal 'Reading package lists...
Building dependency tree...
+Reading state information...
The following NEW packages will be installed:
testing
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Inst testing (0.8.15 stable [amd64])
Conf testing (0.8.15 stable [amd64])' aptget install testing -s
-testequal 'Reading package lists...
+ testdpkgnotinstalled testing
+ testsuccess aptget install testing -y
+ testdpkginstalled testing
+ testsuccess aptget purge testing -y
+ testdpkgnotinstalled testing
+
+ testequal 'Reading package lists...
Building dependency tree...
+Reading state information...
The following NEW packages will be installed:
testing:i386
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Inst testing:i386 (0.8.15 stable [i386])
Conf testing:i386 (0.8.15 stable [i386])' aptget install testing:i386 -s
+ testdpkgnotinstalled testing:i386
+ testsuccess aptget install testing:i386 -y
+ testdpkginstalled testing:i386
+ testsuccess aptget purge testing:i386 -y
+ testdpkgnotinstalled testing:i386
+
+ rm -f testing_0.8.15_amd64.deb
+ testsuccess aptget download testing
+ testsuccess test -s testing_0.8.15_amd64.deb
+ rm -f testing_0.8.15_amd64.deb
+
+ rm -f testing_0.8.15.dsc
+ testsuccess aptget source testing --dsc-only -d
+ testsuccess test -s testing_0.8.15.dsc
+ rm -f testing_0.8.15.dsc
+}
+testcdromusage
+
# check Idempotence of apt-cdrom (and disabling of Translation dropping)
testequal "$CDROM_PRE
Found 2 package indexes, 1 source indexes, 2 translation indexes and 1 signatures
@@ -101,7 +130,15 @@ $CDROM_POST" aptcdromlog add
msgtest 'Test for the english description translation of' 'testing'
aptcache show testing -o Acquire::Languages=en | grep -q '^Description-en: ' && msgpass || msgfail
-# check that we really can install from a 'cdrom'
-testdpkgnotinstalled testing
-testsuccess aptget install testing -y
-testdpkginstalled testing
+# ensure cdrom method isn't trying to mount the cdrom
+mv rootdir/media/cdrom-unmounted rootdir/media/cdrom-ejected
+# ensure an update doesn't mess with cdrom sources
+testsuccess aptget update
+testfileequal rootdir/tmp/testsuccess.output 'Reading package lists...'
+mv rootdir/media/cdrom-ejected rootdir/media/cdrom-unmounted
+testcdromusage
+
+# and again to check that it withstands the temptation even if it could mount
+testsuccess aptget update
+testfileequal rootdir/tmp/testsuccess.output 'Reading package lists...'
+testcdromusage