]>
Commit | Line | Data |
---|---|---|
1 | #!/bin/sh | |
2 | set -e | |
3 | ||
4 | TESTDIR="$(readlink -f "$(dirname "$0")")" | |
5 | . "$TESTDIR/framework" | |
6 | setupenvironment | |
7 | configarchitecture 'amd64' 'i386' | |
8 | ||
9 | buildsimplenativepackage 'testing' 'amd64,i386' '0.8.15' 'stable' | |
10 | setupaptarchive --no-update | |
11 | ||
12 | changetocdrom 'Debian APT Testdisk 0.8.15' | |
13 | ||
14 | # -de is not in the Release file, but picked up anyway for compatibility | |
15 | cd rootdir/media/cdrom-unmounted/dists/stable/main/i18n | |
16 | chmod +w . | |
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 | |
22 | compressfile Translation-de | |
23 | rm -f Translation-en Translation-de | |
24 | chmod -R 555 . | |
25 | cd - > /dev/null | |
26 | ||
27 | aptcdromlog() { | |
28 | rm -f rootdir/tmp/apt-cdrom.log | |
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 | |
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 | |
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!" | |
40 | } | |
41 | aptautotest_aptcdromlog_add() { aptautotest_aptget_update "$@"; } | |
42 | ||
43 | CDROM_PRE="Using CD-ROM mount point $(readlink -f ./rootdir/media)/cdrom/ | |
44 | Unmounting CD-ROM... | |
45 | Waiting for disc... | |
46 | Please insert a Disc in the drive and press [Enter] | |
47 | Mounting CD-ROM... | |
48 | Scanning disc for index files..." | |
49 | CDROM_POST="This disc is called: | |
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 | |
55 | Unmounting CD-ROM... | |
56 | Repeat this process for the rest of the CDs in your set." | |
57 | ||
58 | testsuccessequal "$CDROM_PRE | |
59 | Found 3 package indexes, 1 source indexes, 1 translation indexes and 1 signatures | |
60 | Found label 'Debian APT Testdisk 0.8.15' | |
61 | $CDROM_POST" aptcdromlog add | |
62 | ||
63 | testsuccessequal "Using CD-ROM mount point $(readlink -f ./rootdir/media)/cdrom/ | |
64 | Mounting CD-ROM... | |
65 | Stored label: Debian APT Testdisk 0.8.15 | |
66 | Unmounting CD-ROM..." aptcdromlog ident | |
67 | ||
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/^[^:]*: //")" | |
72 | testfileequal rootdir/var/lib/apt/cdroms.list "CD::${CD_ID} \"${CD_LABEL}\"; | |
73 | CD::${CD_ID}::Label \"${CD_LABEL}\";" | |
74 | ||
75 | testcdromusage() { | |
76 | touch rootdir/var/lib/apt/extended_states | |
77 | ||
78 | testsuccessequal 'Reading package lists... | |
79 | Building dependency tree... | |
80 | Reading state information... | |
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 | ||
87 | testdpkgnotinstalled testing | |
88 | testsuccess aptget install testing -y | |
89 | testdpkginstalled testing | |
90 | testsuccess aptget purge testing -y | |
91 | testdpkgnotinstalled testing | |
92 | ||
93 | testsuccessequal 'Reading package lists... | |
94 | Building dependency tree... | |
95 | Reading state information... | |
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 | ||
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 | ||
108 | cd downloaded | |
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 | |
118 | cd - >/dev/null | |
119 | } | |
120 | testcdromusage | |
121 | ||
122 | # check Idempotence of apt-cdrom (and disabling of Translation dropping) | |
123 | testsuccessequal "$CDROM_PRE | |
124 | Found 3 package indexes, 1 source indexes, 2 translation indexes and 1 signatures | |
125 | $CDROM_POST" aptcdromlog add -o APT::CDROM::DropTranslation=0 | |
126 | ||
127 | # take Translations from previous runs as needed | |
128 | testsuccessequal "$CDROM_PRE | |
129 | Found 3 package indexes, 1 source indexes, 2 translation indexes and 1 signatures | |
130 | $CDROM_POST" aptcdromlog add | |
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 | |
134 | testsuccessequal "$CDROM_PRE | |
135 | Found 3 package indexes, 1 source indexes, 1 translation indexes and 1 signatures | |
136 | $CDROM_POST" aptcdromlog add | |
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 | ||
140 | # ensure cdrom method isn't trying to mount the cdrom | |
141 | mv rootdir/media/cdrom-unmounted rootdir/media/cdrom-ejected | |
142 | msgmsg "ensure an update doesn't mess with cdrom sources" | |
143 | testsuccess aptget update | |
144 | testfileequal rootdir/tmp/testsuccess.output 'Hit:1 cdrom://Debian APT Testdisk 0.8.15 stable InRelease | |
145 | Reading package lists...' | |
146 | mv rootdir/media/cdrom-ejected rootdir/media/cdrom-unmounted | |
147 | testcdromusage | |
148 | ||
149 | msgmsg 'and again to check that it withstands the temptation even if it could mount' | |
150 | testsuccess aptget update | |
151 | testfileequal rootdir/tmp/testsuccess.output 'Hit:1 cdrom://Debian APT Testdisk 0.8.15 stable InRelease | |
152 | Reading package lists...' | |
153 | testcdromusage | |
154 | ||
155 | msgmsg 'Check that nothing touched our' 'CD-ROM' | |
156 | for file in $(find rootdir/media/cdrom-unmounted/dists); do | |
157 | testfilestats "$file" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:555" | |
158 | done |