X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/24e8f24e1e94ec3816b0bfc7a05d1c4e3f73248e..29636cc759c6fbb92c6c462c90611eefb67cbbd4:/test/integration/test-apt-by-hash-update diff --git a/test/integration/test-apt-by-hash-update b/test/integration/test-apt-by-hash-update index c00ab497b..9701f97f9 100755 --- a/test/integration/test-apt-by-hash-update +++ b/test/integration/test-apt-by-hash-update @@ -1,8 +1,8 @@ #!/bin/sh set -e -TESTDIR=$(readlink -f $(dirname $0)) -. $TESTDIR/framework +TESTDIR="$(readlink -f "$(dirname "$0")")" +. "$TESTDIR/framework" setupenvironment configarchitecture 'i386' @@ -10,20 +10,21 @@ confighashes 'SHA512' configcompression '.' 'gz' insertpackage 'unstable' 'foo' 'all' '1.0' +insertpackage 'unstable' 'bar' 'i386' '1.0' setupaptarchive --no-update # make Packages *only* accessible by-hash for this test -mkdir -p aptarchive/dists/unstable/main/binary-i386/by-hash/SHA512 -(cd aptarchive/dists/unstable/main/binary-i386/by-hash/SHA512 && - mv ../../Packages* . && - ln -s Packages.gz $(sha512sum Packages.gz|cut -f1 -d' ') ) - -# add sources -mkdir -p aptarchive/dists/unstable/main/source/by-hash/SHA512 -(cd aptarchive/dists/unstable/main/source/by-hash/SHA512 && - ln -s ../../Sources.gz $(sha512sum ../../Sources.gz|cut -f1 -d' ') -) +makebyhashonly() { + local NORMAL="$(readlink -f "./aptarchive/dists/unstable/main/${1}")" + local BYHASH="${NORMAL}/by-hash/SHA512" + mkdir -p "${BYHASH}" + find "${NORMAL}/" -maxdepth 1 -name "${2}*" -exec mv '{}' "$BYHASH" \; + ln -s "${BYHASH}/${2}.gz" "${BYHASH}/$(sha512sum "${BYHASH}/${2}.gz" | cut -f1 -d' ')" +} +makebyhashonly 'binary-i386' 'Packages' +makebyhashonly 'binary-all' 'Packages' +makebyhashonly 'source' 'Sources' ensureitsbroken() { rm -rf rootdir/var/lib/apt/lists @@ -39,9 +40,16 @@ ensureitsbroken -o Acquire::By-Hash=1 ensureitworks() { rm -rf rootdir/var/lib/apt/lists - testsuccess aptget update -o Acquire::Languages=none "$@" + testsuccess aptget update "$@" -o Acquire::Languages=none + testfailure grep '^Ign' rootdir/tmp/testsuccess.output + rm -rf rootdir/var/lib/apt/lists + testsuccess aptget update "$@" + cp -f rootdir/tmp/testsuccess.output rootdir/tmp/aptupdate.output + testsuccess grep '^Ign' rootdir/tmp/aptupdate.output testsuccessequal "Inst foo (1.0 unstable [all]) Conf foo (1.0 unstable [all])" aptget install -qq -s foo + testsuccessequal "Inst bar (1.0 unstable [i386]) +Conf bar (1.0 unstable [i386])" aptget install -qq -s bar } msgmsg 'Test by-hash via' 'config option' ensureitworks -o Acquire::By-Hash=force