From 698f9e3f9877be2aa181d6e40d3dc5c41ea318b7 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Tue, 16 Jan 2018 16:53:46 +0100 Subject: Introduce inrelease-path option for sources.list Allow specifying an alternative path to the InRelease file, so you can have multiple versions of a repository, for example. Enabling this option disables fallback to Release and Release.gpg, so setting it to InRelease can be used to ensure that only that will be tried. We add two test cases: One for checking that it works, and another for checking that the fallback does not happen. Closes: #886745 --- test/integration/test-apt-by-hash-update | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'test') diff --git a/test/integration/test-apt-by-hash-update b/test/integration/test-apt-by-hash-update index 9701f97f9..f4794a84f 100755 --- a/test/integration/test-apt-by-hash-update +++ b/test/integration/test-apt-by-hash-update @@ -77,3 +77,31 @@ ensureitsbroken -o Acquire::By-Hash=0 sed -i "s#^\(deb\(-src\)\?\) \[by-hash=yes\] #\1 [by-hash=force] #" rootdir/etc/apt/sources.list.d/* ensureitworks #ensureitsbroken -o Acquire::By-Hash=0 + + + +msgmsg 'Test InRelease by-hash via' 'sources option' + +rm -rf aptarchive/dists +cp -a aptarchive/dists.bak aptarchive/dists +mkdir -p aptarchive/dists/unstable/by-hash/SHA256 +inrelease_hash=$(sha256sum aptarchive/dists/unstable/InRelease | awk '{print $1}') +mv aptarchive/dists/unstable/InRelease aptarchive/dists/unstable/by-hash/SHA256/$inrelease_hash +#ensureitworks -o Acquire::By-Hash=force +ensureitsbroken -o Acquire::By-Hash=1 +ensureitsbroken -o Acquire::By-Hash=0 + +sed -i "s#^\(deb\(-src\)\?\) \[by-hash=force\] #\1 [by-hash=force inrelease-path=by-hash/SHA256/$inrelease_hash] #" rootdir/etc/apt/sources.list.d/* +ensureitworks +#ensureitsbroken -o Acquire::By-Hash=0 + +msgmsg 'Test InRelease by-hash with' 'no fallback' + +rm -rf aptarchive/dists +cp -a aptarchive/dists.bak aptarchive/dists + +testfailureequal "Get:1 file:${TMPWORKINGDIRECTORY}/aptarchive unstable InRelease +Err:1 file:${TMPWORKINGDIRECTORY}/aptarchive unstable InRelease + File not found - ${TMPWORKINGDIRECTORY}/aptarchive/dists/unstable/by-hash/SHA256/${inrelease_hash} (2: No such file or directory) +Reading package lists... +E: Failed to fetch file://${TMPWORKINGDIRECTORY}/aptarchive/dists/unstable/InRelease File not found - ${TMPWORKINGDIRECTORY}/aptarchive/dists/unstable/by-hash/SHA256/${inrelease_hash} (2: No such file or directory)" aptget update -- cgit v1.2.3