]>
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\?: Signature made/ d' -e '/gpgv\?: Good signature/ d' -e '/^Identifying/ d' -e '/Reading / d' rootdir/tmp/apt-cdrom.log | |
33 | test ! -e rootdir/media/cdrom || echo "CD-ROM is mounted, but shouldn't be!" | |
34 | test -e rootdir/media/cdrom-unmounted || echo "Unmounted CD-ROM doesn't exist, but it should!" | |
35 | } | |
36 | aptautotest_aptcdromlog_add() { aptautotest_aptget_update "$@"; } | |
37 | ||
38 | CDROM_PRE="Using CD-ROM mount point $(readlink -f ./rootdir/media)/cdrom/ | |
39 | Unmounting CD-ROM... | |
40 | Waiting for disc... | |
41 | Please insert a Disc in the drive and press [Enter] | |
42 | Mounting CD-ROM... | |
43 | Scanning disc for index files..." | |
44 | CDROM_POST="This disc is called: | |
45 | 'Debian APT Testdisk 0.8.15' | |
46 | Writing new source list | |
47 | Source list entries for this disc are: | |
48 | deb cdrom:[Debian APT Testdisk 0.8.15]/ stable main | |
49 | deb-src cdrom:[Debian APT Testdisk 0.8.15]/ stable main | |
50 | Unmounting CD-ROM... | |
51 | Repeat this process for the rest of the CDs in your set." | |
52 | ||
53 | testsuccessequal "$CDROM_PRE | |
54 | Found 3 package indexes, 1 source indexes, 1 translation indexes and 1 signatures | |
55 | Found label 'Debian APT Testdisk 0.8.15' | |
56 | $CDROM_POST" aptcdromlog add | |
57 | ||
58 | testsuccessequal "Using CD-ROM mount point $(readlink -f ./rootdir/media)/cdrom/ | |
59 | Mounting CD-ROM... | |
60 | Stored label: Debian APT Testdisk 0.8.15 | |
61 | Unmounting CD-ROM..." aptcdromlog ident | |
62 | ||
63 | # apt-setup uses these commands (expect the tr in the id) to find id and label | |
64 | ident="$(LC_ALL=C aptcdrom ident 2>&1 )" | |
65 | CD_ID="$(echo "$ident" | grep "^Identifying" | head -n1 | cut -d" " -f2 | tr --delete '[]')" | |
66 | CD_LABEL="$(echo "$ident" | grep "^Stored label:" | head -n1 | sed "s/^[^:]*: //")" | |
67 | testfileequal rootdir/var/lib/apt/cdroms.list "CD::${CD_ID} \"${CD_LABEL}\"; | |
68 | CD::${CD_ID}::Label \"${CD_LABEL}\";" | |
69 | ||
70 | testcdromusage() { | |
71 | touch rootdir/var/lib/apt/extended_states | |
72 | ||
73 | testsuccessequal 'Reading package lists... | |
74 | Building dependency tree... | |
75 | Reading state information... | |
76 | The following NEW packages will be installed: | |
77 | testing | |
78 | 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. | |
79 | Inst testing (0.8.15 stable [amd64]) | |
80 | Conf testing (0.8.15 stable [amd64])' aptget install testing -s | |
81 | ||
82 | testdpkgnotinstalled testing | |
83 | testsuccess aptget install testing -y | |
84 | testdpkginstalled testing | |
85 | testsuccess aptget purge testing -y | |
86 | testdpkgnotinstalled testing | |
87 | ||
88 | testsuccessequal 'Reading package lists... | |
89 | Building dependency tree... | |
90 | Reading state information... | |
91 | The following NEW packages will be installed: | |
92 | testing:i386 | |
93 | 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. | |
94 | Inst testing:i386 (0.8.15 stable [i386]) | |
95 | Conf testing:i386 (0.8.15 stable [i386])' aptget install testing:i386 -s | |
96 | ||
97 | testdpkgnotinstalled testing:i386 | |
98 | testsuccess aptget install testing:i386 -y | |
99 | testdpkginstalled testing:i386 | |
100 | testsuccess aptget purge testing:i386 -y | |
101 | testdpkgnotinstalled testing:i386 | |
102 | ||
103 | cd downloaded | |
104 | rm -f testing_0.8.15_amd64.deb | |
105 | testsuccess aptget download testing | |
106 | testsuccess test -s testing_0.8.15_amd64.deb | |
107 | rm -f testing_0.8.15_amd64.deb | |
108 | ||
109 | rm -f testing_0.8.15.dsc | |
110 | testsuccess aptget source testing --dsc-only -d | |
111 | testsuccess test -s testing_0.8.15.dsc | |
112 | rm -f testing_0.8.15.dsc | |
113 | cd - >/dev/null | |
114 | } | |
115 | testcdromusage | |
116 | ||
117 | # check Idempotence of apt-cdrom (and disabling of Translation dropping) | |
118 | testsuccessequal "$CDROM_PRE | |
119 | Found 3 package indexes, 1 source indexes, 2 translation indexes and 1 signatures | |
120 | $CDROM_POST" aptcdromlog add -o APT::CDROM::DropTranslation=0 | |
121 | ||
122 | # take Translations from previous runs as needed | |
123 | testsuccessequal "$CDROM_PRE | |
124 | Found 3 package indexes, 1 source indexes, 2 translation indexes and 1 signatures | |
125 | $CDROM_POST" aptcdromlog add | |
126 | msgtest 'Test for the german description translation of' 'testing' | |
127 | aptcache show testing -o Acquire::Languages=de | grep -q '^Description-de: ' && msgpass || msgfail | |
128 | rm -rf rootdir/var/lib/apt/lists | |
129 | testsuccessequal "$CDROM_PRE | |
130 | Found 3 package indexes, 1 source indexes, 1 translation indexes and 1 signatures | |
131 | $CDROM_POST" aptcdromlog add | |
132 | msgtest 'Test for the english description translation of' 'testing' | |
133 | aptcache show testing -o Acquire::Languages=en | grep -q '^Description-en: ' && msgpass || msgfail | |
134 | ||
135 | # ensure cdrom method isn't trying to mount the cdrom | |
136 | mv rootdir/media/cdrom-unmounted rootdir/media/cdrom-ejected | |
137 | msgmsg "ensure an update doesn't mess with cdrom sources" | |
138 | testsuccess aptget update | |
139 | testfileequal rootdir/tmp/testsuccess.output 'Hit:1 cdrom://Debian APT Testdisk 0.8.15 stable InRelease | |
140 | Reading package lists...' | |
141 | mv rootdir/media/cdrom-ejected rootdir/media/cdrom-unmounted | |
142 | testcdromusage | |
143 | ||
144 | msgmsg 'and again to check that it withstands the temptation even if it could mount' | |
145 | testsuccess aptget update | |
146 | testfileequal rootdir/tmp/testsuccess.output 'Hit:1 cdrom://Debian APT Testdisk 0.8.15 stable InRelease | |
147 | Reading package lists...' | |
148 | testcdromusage | |
149 | ||
150 | msgmsg 'Check that nothing touched our' 'CD-ROM' | |
151 | for file in $(find rootdir/media/cdrom-unmounted/dists); do | |
152 | testfilestats "$file" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:555" | |
153 | done |