| 1 | #!/bin/sh |
| 2 | set -e |
| 3 | |
| 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" |
| 5 | . "$TESTDIR/framework" |
| 6 | setupenvironment |
| 7 | configarchitecture 'amd64' |
| 8 | |
| 9 | insertpackage 'testing' 'foo' 'all' '1' |
| 10 | |
| 11 | getcodenamefromsuite() { echo -n 'stretch'; } |
| 12 | setupaptarchive --no-update |
| 13 | APTARCHIVE="$(readlink -f './aptarchive')" |
| 14 | ln -s "${APTARCHIVE}/dists/testing" "${APTARCHIVE}/dists/stretch" |
| 15 | ln -s "${APTARCHIVE}/dists/testing" "${APTARCHIVE}/dists/zurg" |
| 16 | |
| 17 | testfailure apt show foo |
| 18 | testsuccess apt update |
| 19 | testsuccess apt show foo |
| 20 | |
| 21 | rm -rf rootdir/var/lib/apt/lists |
| 22 | sed -i -e 's#testing#stretch#g' rootdir/etc/apt/sources.list.d/* |
| 23 | testsuccess apt update |
| 24 | testsuccess apt show foo |
| 25 | |
| 26 | rm -rf rootdir/var/lib/apt/lists |
| 27 | sed -i -e 's#stretch#zurg#g' rootdir/etc/apt/sources.list.d/* |
| 28 | testwarningmsg "W: Conflicting distribution: file:$APTARCHIVE zurg InRelease (expected zurg but got stretch)" apt update |
| 29 | testsuccess apt show foo |
| 30 | |
| 31 | # check that 'foo/bar' is rewritten to 'foo' while we are at it |
| 32 | rm -rf rootdir/var/lib/apt/lists |
| 33 | sed -i -e 's#zurg#stretch/updates#g' rootdir/etc/apt/sources.list.d/* |
| 34 | testfailure apt update |
| 35 | testfailure apt show foo |
| 36 | ln -s "${APTARCHIVE}/dists/testing" "${APTARCHIVE}/dists/stretch/updates" |
| 37 | testsuccess apt update |
| 38 | testsuccess apt show foo |
| 39 | |
| 40 | # … but only if needed |
| 41 | rm -rf rootdir/var/lib/apt/lists |
| 42 | sed -i -e 's#stretch#buster#g' rootdir/etc/apt/sources.list.d/* |
| 43 | sed -i -e 's#^Codename: stretch$#Codename: buster/updates#g' $(find ./aptarchive -name 'Release') |
| 44 | signreleasefiles |
| 45 | testfailure apt update |
| 46 | testfailure apt show foo |
| 47 | ln -s "${APTARCHIVE}/dists/testing" "${APTARCHIVE}/dists/buster" |
| 48 | testsuccess apt update |
| 49 | testsuccess apt show foo |
| 50 | |
| 51 | # changing codenames gets a warning, too |
| 52 | rm -rf rootdir/var/lib/apt/lists |
| 53 | sed -i -e 's#buster#testing#g' rootdir/etc/apt/sources.list.d/* |
| 54 | testsuccess apt update |
| 55 | testsuccess apt show foo |
| 56 | sed -i -e 's#^Codename: buster#Codename: zurg#g' $(find ./aptarchive -name 'Release') |
| 57 | signreleasefiles |
| 58 | testwarningmsg "W: Conflicting distribution: file:$APTARCHIVE testing/updates InRelease (expected buster/updates but got zurg/updates)" apt update |
| 59 | testsuccess apt show foo |
| 60 | testsuccess apt update |
| 61 | testsuccess apt show foo |