summaryrefslogtreecommitdiffstats
path: root/test/integration/test-bug-841874-warning-for-mismatching-distribution
blob: 7502eefc38e959c55bf21f51cc32f35aecdbdcf3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/sh
set -e

TESTDIR="$(readlink -f "$(dirname "$0")")"
. "$TESTDIR/framework"
setupenvironment
configarchitecture 'amd64'

insertpackage 'testing' 'foo' 'all' '1'

getcodenamefromsuite() { echo -n 'stretch'; }
setupaptarchive --no-update
APTARCHIVE="$(readlink -f './aptarchive')"
ln -s "${APTARCHIVE}/dists/testing" "${APTARCHIVE}/dists/stretch"
ln -s "${APTARCHIVE}/dists/testing" "${APTARCHIVE}/dists/zurg"

testfailure apt show foo
testsuccess apt update
testsuccess apt show foo

rm -rf rootdir/var/lib/apt/lists
sed -i -e 's#testing#stretch#g' rootdir/etc/apt/sources.list.d/*
testsuccess apt update
testsuccess apt show foo

rm -rf rootdir/var/lib/apt/lists
sed -i -e 's#stretch#zurg#g' rootdir/etc/apt/sources.list.d/*
testwarningmsg "W: Conflicting distribution: file:$APTARCHIVE zurg InRelease (expected zurg but got stretch)" apt update
testsuccess apt show foo

# check that 'foo/bar' is rewritten to 'foo' while we are at it
rm -rf rootdir/var/lib/apt/lists
sed -i -e 's#zurg#stretch/updates#g' rootdir/etc/apt/sources.list.d/*
testfailure apt update
testfailure apt show foo
ln -s "${APTARCHIVE}/dists/testing" "${APTARCHIVE}/dists/stretch/updates"
testsuccess apt update
testsuccess apt show foo

# … but only if needed
rm -rf rootdir/var/lib/apt/lists
sed -i -e 's#stretch#buster#g' rootdir/etc/apt/sources.list.d/*
sed -i -e 's#^Codename: stretch$#Codename: buster/updates#g' $(find ./aptarchive -name 'Release')
signreleasefiles
testfailure apt update
testfailure apt show foo
ln -s "${APTARCHIVE}/dists/testing" "${APTARCHIVE}/dists/buster"
testsuccess apt update
testsuccess apt show foo