]> git.saurik.com Git - apt.git/blame_incremental - test/integration/test-apt-cdrom
test-apt-cdrom: Fix for gnupg 2.1.15
[apt.git] / test / integration / test-apt-cdrom
... / ...
CommitLineData
1#!/bin/sh
2set -e
3
4TESTDIR="$(readlink -f "$(dirname "$0")")"
5. "$TESTDIR/framework"
6setupenvironment
7configarchitecture 'amd64' 'i386'
8
9buildsimplenativepackage 'testing' 'amd64,i386' '0.8.15' 'stable'
10setupaptarchive --no-update
11
12changetocdrom 'Debian APT Testdisk 0.8.15'
13
14# -de is not in the Release file, but picked up anyway for compatibility
15cd rootdir/media/cdrom-unmounted/dists/stable/main/i18n
16chmod +w .
17sed -e '/^Description-en:/ d' -e '/^ / d' -e '/^$/ d' Translation-en > Translation-de
18echo '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
22compressfile Translation-de
23rm -f Translation-en Translation-de
24chmod -R 555 .
25cd - > /dev/null
26
27aptcdromlog() {
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}
41aptautotest_aptcdromlog_add() { aptautotest_aptget_update "$@"; }
42
43CDROM_PRE="Using CD-ROM mount point $(readlink -f ./rootdir/media)/cdrom/
44Unmounting CD-ROM...
45Waiting for disc...
46Please insert a Disc in the drive and press [Enter]
47Mounting CD-ROM...
48Scanning disc for index files..."
49CDROM_POST="This disc is called:
50'Debian APT Testdisk 0.8.15'
51Writing new source list
52Source list entries for this disc are:
53deb cdrom:[Debian APT Testdisk 0.8.15]/ stable main
54deb-src cdrom:[Debian APT Testdisk 0.8.15]/ stable main
55Unmounting CD-ROM...
56Repeat this process for the rest of the CDs in your set."
57
58testsuccessequal "$CDROM_PRE
59Found 3 package indexes, 1 source indexes, 1 translation indexes and 1 signatures
60Found label 'Debian APT Testdisk 0.8.15'
61$CDROM_POST" aptcdromlog add
62
63testsuccessequal "Using CD-ROM mount point $(readlink -f ./rootdir/media)/cdrom/
64Mounting CD-ROM...
65Stored label: Debian APT Testdisk 0.8.15
66Unmounting CD-ROM..." aptcdromlog ident
67
68# apt-setup uses these commands (expect the tr in the id) to find id and label
69ident="$(LC_ALL=C aptcdrom ident 2>&1 )"
70CD_ID="$(echo "$ident" | grep "^Identifying" | head -n1 | cut -d" " -f2 | tr --delete '[]')"
71CD_LABEL="$(echo "$ident" | grep "^Stored label:" | head -n1 | sed "s/^[^:]*: //")"
72testfileequal rootdir/var/lib/apt/cdroms.list "CD::${CD_ID} \"${CD_LABEL}\";
73CD::${CD_ID}::Label \"${CD_LABEL}\";"
74
75testcdromusage() {
76 touch rootdir/var/lib/apt/extended_states
77
78 testsuccessequal 'Reading package lists...
79Building dependency tree...
80Reading state information...
81The following NEW packages will be installed:
82 testing
830 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
84Inst testing (0.8.15 stable [amd64])
85Conf 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...
94Building dependency tree...
95Reading state information...
96The following NEW packages will be installed:
97 testing:i386
980 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
99Inst testing:i386 (0.8.15 stable [i386])
100Conf 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}
120testcdromusage
121
122# check Idempotence of apt-cdrom (and disabling of Translation dropping)
123testsuccessequal "$CDROM_PRE
124Found 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
128testsuccessequal "$CDROM_PRE
129Found 3 package indexes, 1 source indexes, 2 translation indexes and 1 signatures
130$CDROM_POST" aptcdromlog add
131msgtest 'Test for the german description translation of' 'testing'
132aptcache show testing -o Acquire::Languages=de | grep -q '^Description-de: ' && msgpass || msgfail
133rm -rf rootdir/var/lib/apt/lists
134testsuccessequal "$CDROM_PRE
135Found 3 package indexes, 1 source indexes, 1 translation indexes and 1 signatures
136$CDROM_POST" aptcdromlog add
137msgtest 'Test for the english description translation of' 'testing'
138aptcache show testing -o Acquire::Languages=en | grep -q '^Description-en: ' && msgpass || msgfail
139
140# ensure cdrom method isn't trying to mount the cdrom
141mv rootdir/media/cdrom-unmounted rootdir/media/cdrom-ejected
142msgmsg "ensure an update doesn't mess with cdrom sources"
143testsuccess aptget update
144testfileequal rootdir/tmp/testsuccess.output 'Hit:1 cdrom://Debian APT Testdisk 0.8.15 stable InRelease
145Reading package lists...'
146mv rootdir/media/cdrom-ejected rootdir/media/cdrom-unmounted
147testcdromusage
148
149msgmsg 'and again to check that it withstands the temptation even if it could mount'
150testsuccess aptget update
151testfileequal rootdir/tmp/testsuccess.output 'Hit:1 cdrom://Debian APT Testdisk 0.8.15 stable InRelease
152Reading package lists...'
153testcdromusage
154
155msgmsg 'Check that nothing touched our' 'CD-ROM'
156for file in $(find rootdir/media/cdrom-unmounted/dists); do
157 testfilestats "$file" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:555"
158done