]> git.saurik.com Git - apt.git/blob - test/integration/test-apt-cdrom
Merge remote-tracking branch 'mvo/feature/apt-ftparchive-srccache2' into debian/sid
[apt.git] / test / integration / test-apt-cdrom
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 -w .
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/ 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
37 CDROM_PRE="Using CD-ROM mount point $(readlink -f ./rootdir/media)/cdrom/
38 Unmounting CD-ROM...
39 Waiting for disc...
40 Please insert a Disc in the drive and press enter
41 Mounting CD-ROM...
42 Scanning disc for index files..."
43 CDROM_POST="This disc is called:
44 'Debian APT Testdisk 0.8.15'
45 Writing new source list
46 Source list entries for this disc are:
47 deb cdrom:[Debian APT Testdisk 0.8.15]/ stable main
48 deb-src cdrom:[Debian APT Testdisk 0.8.15]/ stable main
49 Unmounting CD-ROM...
50 Repeat this process for the rest of the CDs in your set."
51
52 testequal "$CDROM_PRE
53 Found 2 package indexes, 1 source indexes, 1 translation indexes and 1 signatures
54 Found label 'Debian APT Testdisk 0.8.15'
55 $CDROM_POST" aptcdromlog add
56
57 testequal "Using CD-ROM mount point $(readlink -f ./rootdir/media)/cdrom/
58 Mounting CD-ROM...
59 Stored label: Debian APT Testdisk 0.8.15
60 Unmounting CD-ROM..." aptcdromlog ident
61
62 # apt-setup uses these commands (expect the tr in the id) to find id and label
63 ident="$(LC_ALL=C aptcdrom ident 2>&1 )"
64 CD_ID="$(echo "$ident" | grep "^Identifying" | head -n1 | cut -d" " -f2 | tr --delete '[]')"
65 CD_LABEL="$(echo "$ident" | grep "^Stored label:" | head -n1 | sed "s/^[^:]*: //")"
66 testequal "CD::${CD_ID} \"${CD_LABEL}\";
67 CD::${CD_ID}::Label \"${CD_LABEL}\";" cat rootdir/var/lib/apt/cdroms.list
68
69 testequal 'Reading package lists...
70 Building dependency tree...
71 The following NEW packages will be installed:
72 testing
73 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
74 Inst testing (0.8.15 stable [amd64])
75 Conf testing (0.8.15 stable [amd64])' aptget install testing -s
76
77 testequal 'Reading package lists...
78 Building dependency tree...
79 The following NEW packages will be installed:
80 testing:i386
81 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
82 Inst testing:i386 (0.8.15 stable [i386])
83 Conf testing:i386 (0.8.15 stable [i386])' aptget install testing:i386 -s
84
85 # check Idempotence of apt-cdrom (and disabling of Translation dropping)
86 testequal "$CDROM_PRE
87 Found 2 package indexes, 1 source indexes, 2 translation indexes and 1 signatures
88 $CDROM_POST" aptcdromlog add -o APT::CDROM::DropTranslation=0
89
90 # take Translations from previous runs as needed
91 testequal "$CDROM_PRE
92 Found 2 package indexes, 1 source indexes, 2 translation indexes and 1 signatures
93 $CDROM_POST" aptcdromlog add
94 msgtest 'Test for the german description translation of' 'testing'
95 aptcache show testing -o Acquire::Languages=de | grep -q '^Description-de: ' && msgpass || msgfail
96 rm -rf rootdir/var/lib/apt/lists
97 mkdir -p rootdir/var/lib/apt/lists/partial
98 testequal "$CDROM_PRE
99 Found 2 package indexes, 1 source indexes, 1 translation indexes and 1 signatures
100 $CDROM_POST" aptcdromlog add
101 msgtest 'Test for the english description translation of' 'testing'
102 aptcache show testing -o Acquire::Languages=en | grep -q '^Description-en: ' && msgpass || msgfail
103
104 # check that we really can install from a 'cdrom'
105 testdpkgnotinstalled testing
106 testsuccess aptget install testing -y
107 testdpkginstalled testing