]>
Commit | Line | Data |
---|---|---|
c45233ea DK |
1 | #!/bin/sh |
2 | set -e | |
3 | ||
3abb6a6a DK |
4 | TESTDIR="$(readlink -f "$(dirname "$0")")" |
5 | . "$TESTDIR/framework" | |
c45233ea DK |
6 | setupenvironment |
7 | configarchitecture 'amd64' 'i386' | |
8 | ||
9 | buildsimplenativepackage 'testing' 'amd64,i386' '0.8.15' 'stable' | |
b2ea1a47 | 10 | setupaptarchive --no-update |
c45233ea DK |
11 | |
12 | changetocdrom 'Debian APT Testdisk 0.8.15' | |
13 | ||
14 | # -de is not in the Release file, but picked up anyway for compatibility | |
a0975c8d DK |
15 | cd rootdir/media/cdrom-unmounted/dists/stable/main/i18n |
16 | chmod +w . | |
c45233ea DK |
17 | sed -e '/^Description-en:/ d' -e '/^ / d' -e '/^$/ d' Translation-en > Translation-de |
18 | echo 'Description-de: automatisch generiertes Testpaket testing=0.8.15/stable | |
19 | Diese Pakete sind nur für das testen von APT gedacht, | |
20 | sie erfüllen keinen Zweck auf einem normalen System… | |
21 | ' >> Translation-de | |
276e51dd | 22 | compressfile Translation-de |
a0975c8d | 23 | rm -f Translation-en Translation-de |
b0314abb | 24 | chmod -R 555 . |
c45233ea DK |
25 | cd - > /dev/null |
26 | ||
1e071c30 DK |
27 | aptcdromlog() { |
28 | rm -f rootdir/tmp/apt-cdrom.log | |
a0975c8d DK |
29 | test ! -e rootdir/media/cdrom || echo "CD-ROM is mounted, but shouldn't be!" |
30 | test -e rootdir/media/cdrom-unmounted || echo "Unmounted CD-ROM doesn't exist, but it should!" | |
31 | aptcdrom "$@" -o quiet=1 >rootdir/tmp/apt-cdrom.log 2>&1 </dev/null | |
0343b48e JAK |
32 | sed -e '/gpgv\?:\s*Signature made/ d' \ |
33 | -e '/gpgv\?:\s*Good signature/ d' \ | |
34 | -e '/gpgv\?:\s*using RSA key/ d' \ | |
35 | -e '/gpgv\?:\s*issuer/ d' \ | |
36 | -e '/^Identifying/ d' \ | |
37 | -e '/Reading / d' rootdir/tmp/apt-cdrom.log | |
a0975c8d DK |
38 | test ! -e rootdir/media/cdrom || echo "CD-ROM is mounted, but shouldn't be!" |
39 | test -e rootdir/media/cdrom-unmounted || echo "Unmounted CD-ROM doesn't exist, but it should!" | |
1e071c30 | 40 | } |
d84da499 | 41 | aptautotest_aptcdromlog_add() { aptautotest_aptget_update "$@"; } |
1e071c30 | 42 | |
a0975c8d | 43 | CDROM_PRE="Using CD-ROM mount point $(readlink -f ./rootdir/media)/cdrom/ |
1166ea79 | 44 | Unmounting CD-ROM... |
a0975c8d | 45 | Waiting for disc... |
94171725 | 46 | Please insert a Disc in the drive and press [Enter] |
a0975c8d | 47 | Mounting CD-ROM... |
1166ea79 | 48 | Scanning disc for index files..." |
a0975c8d | 49 | CDROM_POST="This disc is called: |
c45233ea DK |
50 | 'Debian APT Testdisk 0.8.15' |
51 | Writing new source list | |
52 | Source list entries for this disc are: | |
53 | deb cdrom:[Debian APT Testdisk 0.8.15]/ stable main | |
54 | deb-src cdrom:[Debian APT Testdisk 0.8.15]/ stable main | |
a0975c8d DK |
55 | Unmounting CD-ROM... |
56 | Repeat this process for the rest of the CDs in your set." | |
57 | ||
25b86db1 | 58 | testsuccessequal "$CDROM_PRE |
1dd20368 | 59 | Found 3 package indexes, 1 source indexes, 1 translation indexes and 1 signatures |
a0975c8d DK |
60 | Found label 'Debian APT Testdisk 0.8.15' |
61 | $CDROM_POST" aptcdromlog add | |
62 | ||
25b86db1 | 63 | testsuccessequal "Using CD-ROM mount point $(readlink -f ./rootdir/media)/cdrom/ |
a0975c8d DK |
64 | Mounting CD-ROM... |
65 | Stored label: Debian APT Testdisk 0.8.15 | |
66 | Unmounting CD-ROM..." aptcdromlog ident | |
1e071c30 | 67 | |
a0975c8d DK |
68 | # apt-setup uses these commands (expect the tr in the id) to find id and label |
69 | ident="$(LC_ALL=C aptcdrom ident 2>&1 )" | |
70 | CD_ID="$(echo "$ident" | grep "^Identifying" | head -n1 | cut -d" " -f2 | tr --delete '[]')" | |
71 | CD_LABEL="$(echo "$ident" | grep "^Stored label:" | head -n1 | sed "s/^[^:]*: //")" | |
25b86db1 DK |
72 | testfileequal rootdir/var/lib/apt/cdroms.list "CD::${CD_ID} \"${CD_LABEL}\"; |
73 | CD::${CD_ID}::Label \"${CD_LABEL}\";" | |
c45233ea | 74 | |
5afcfe2a DK |
75 | testcdromusage() { |
76 | touch rootdir/var/lib/apt/extended_states | |
77 | ||
25b86db1 | 78 | testsuccessequal 'Reading package lists... |
c45233ea | 79 | Building dependency tree... |
5afcfe2a | 80 | Reading state information... |
c45233ea DK |
81 | The following NEW packages will be installed: |
82 | testing | |
83 | 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. | |
84 | Inst testing (0.8.15 stable [amd64]) | |
85 | Conf testing (0.8.15 stable [amd64])' aptget install testing -s | |
86 | ||
5afcfe2a DK |
87 | testdpkgnotinstalled testing |
88 | testsuccess aptget install testing -y | |
89 | testdpkginstalled testing | |
90 | testsuccess aptget purge testing -y | |
91 | testdpkgnotinstalled testing | |
92 | ||
25b86db1 | 93 | testsuccessequal 'Reading package lists... |
c45233ea | 94 | Building dependency tree... |
5afcfe2a | 95 | Reading state information... |
c45233ea DK |
96 | The following NEW packages will be installed: |
97 | testing:i386 | |
98 | 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. | |
99 | Inst testing:i386 (0.8.15 stable [i386]) | |
100 | Conf testing:i386 (0.8.15 stable [i386])' aptget install testing:i386 -s | |
101 | ||
5afcfe2a DK |
102 | testdpkgnotinstalled testing:i386 |
103 | testsuccess aptget install testing:i386 -y | |
104 | testdpkginstalled testing:i386 | |
105 | testsuccess aptget purge testing:i386 -y | |
106 | testdpkgnotinstalled testing:i386 | |
107 | ||
03aa0847 | 108 | cd downloaded |
5afcfe2a DK |
109 | rm -f testing_0.8.15_amd64.deb |
110 | testsuccess aptget download testing | |
111 | testsuccess test -s testing_0.8.15_amd64.deb | |
112 | rm -f testing_0.8.15_amd64.deb | |
113 | ||
114 | rm -f testing_0.8.15.dsc | |
115 | testsuccess aptget source testing --dsc-only -d | |
116 | testsuccess test -s testing_0.8.15.dsc | |
117 | rm -f testing_0.8.15.dsc | |
03aa0847 | 118 | cd - >/dev/null |
5afcfe2a DK |
119 | } |
120 | testcdromusage | |
121 | ||
c45233ea | 122 | # check Idempotence of apt-cdrom (and disabling of Translation dropping) |
25b86db1 | 123 | testsuccessequal "$CDROM_PRE |
1dd20368 | 124 | Found 3 package indexes, 1 source indexes, 2 translation indexes and 1 signatures |
a0975c8d | 125 | $CDROM_POST" aptcdromlog add -o APT::CDROM::DropTranslation=0 |
c45233ea DK |
126 | |
127 | # take Translations from previous runs as needed | |
25b86db1 | 128 | testsuccessequal "$CDROM_PRE |
1dd20368 | 129 | Found 3 package indexes, 1 source indexes, 2 translation indexes and 1 signatures |
a0975c8d | 130 | $CDROM_POST" aptcdromlog add |
c45233ea DK |
131 | msgtest 'Test for the german description translation of' 'testing' |
132 | aptcache show testing -o Acquire::Languages=de | grep -q '^Description-de: ' && msgpass || msgfail | |
133 | rm -rf rootdir/var/lib/apt/lists | |
25b86db1 | 134 | testsuccessequal "$CDROM_PRE |
1dd20368 | 135 | Found 3 package indexes, 1 source indexes, 1 translation indexes and 1 signatures |
a0975c8d | 136 | $CDROM_POST" aptcdromlog add |
c45233ea DK |
137 | msgtest 'Test for the english description translation of' 'testing' |
138 | aptcache show testing -o Acquire::Languages=en | grep -q '^Description-en: ' && msgpass || msgfail | |
139 | ||
5afcfe2a DK |
140 | # ensure cdrom method isn't trying to mount the cdrom |
141 | mv rootdir/media/cdrom-unmounted rootdir/media/cdrom-ejected | |
d84da499 | 142 | msgmsg "ensure an update doesn't mess with cdrom sources" |
5afcfe2a | 143 | testsuccess aptget update |
1eb1836f | 144 | testfileequal rootdir/tmp/testsuccess.output 'Hit:1 cdrom://Debian APT Testdisk 0.8.15 stable InRelease |
ff86d7df | 145 | Reading package lists...' |
5afcfe2a DK |
146 | mv rootdir/media/cdrom-ejected rootdir/media/cdrom-unmounted |
147 | testcdromusage | |
148 | ||
d84da499 | 149 | msgmsg 'and again to check that it withstands the temptation even if it could mount' |
5afcfe2a | 150 | testsuccess aptget update |
1eb1836f | 151 | testfileequal rootdir/tmp/testsuccess.output 'Hit:1 cdrom://Debian APT Testdisk 0.8.15 stable InRelease |
ff86d7df | 152 | Reading package lists...' |
5afcfe2a | 153 | testcdromusage |
b0314abb DK |
154 | |
155 | msgmsg 'Check that nothing touched our' 'CD-ROM' | |
156 | for file in $(find rootdir/media/cdrom-unmounted/dists); do | |
4bb006d1 | 157 | testfilestats "$file" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:555" |
b0314abb | 158 | done |