* apt-pkg/cdrom.cc:
[ntk/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
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/dists/stable/main/i18n
16 sed -e '/^Description-en:/ d' -e '/^ / d' -e '/^$/ d' Translation-en > Translation-de
17 echo 'Description-de: automatisch generiertes Testpaket testing=0.8.15/stable
18 Diese Pakete sind nur für das testen von APT gedacht,
19 sie erfüllen keinen Zweck auf einem normalen System…
20 ' >> Translation-de
21 cat Translation-de | gzip > Translation-de.gz
22 cat Translation-de | bzip2 > Translation-de.bz2
23 cat Translation-de | xz --format=lzma > Translation-de.lzma
24 cat Translation-de | xz > Translation-de.xz
25 rm Translation-en Translation-de
26 cd - > /dev/null
27
28 aptcdrom add -m -o quiet=1 > apt-cdrom.log 2>&1
29 sed -i -e '/^Using CD-ROM/ d' -e '/gpgv/ d' -e '/^Identifying/ d' -e '/Reading / d' apt-cdrom.log
30 testfileequal apt-cdrom.log "Scanning disc for index files..
31 Found 2 package indexes, 1 source indexes, 1 translation indexes and 1 signatures
32 Found label 'Debian APT Testdisk 0.8.15'
33 This disc is called:
34 'Debian APT Testdisk 0.8.15'
35 Writing new source list
36 Source list entries for this disc are:
37 deb cdrom:[Debian APT Testdisk 0.8.15]/ stable main
38 deb-src cdrom:[Debian APT Testdisk 0.8.15]/ stable main
39 Repeat this process for the rest of the CDs in your set."
40
41 testequal 'Reading package lists...
42 Building dependency tree...
43 The following NEW packages will be installed:
44 testing
45 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
46 Inst testing (0.8.15 stable [amd64])
47 Conf testing (0.8.15 stable [amd64])' aptget install testing -s
48
49 testequal 'Reading package lists...
50 Building dependency tree...
51 The following NEW packages will be installed:
52 testing:i386
53 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
54 Inst testing:i386 (0.8.15 stable [i386])
55 Conf testing:i386 (0.8.15 stable [i386])' aptget install testing:i386 -s
56
57 # check Idempotence of apt-cdrom (and disabling of Translation dropping)
58 aptcdrom add -m -o quiet=1 -o APT::CDROM::DropTranslation=0 > apt-cdrom.log 2>&1
59 sed -i -e '/^Using CD-ROM/ d' -e '/gpgv/ d' -e '/^Identifying/ d' -e '/Reading / d' apt-cdrom.log
60 testfileequal apt-cdrom.log "Scanning disc for index files..
61 Found 2 package indexes, 1 source indexes, 2 translation indexes and 1 signatures
62 This disc is called:
63 'Debian APT Testdisk 0.8.15'
64 Writing new source list
65 Source list entries for this disc are:
66 deb cdrom:[Debian APT Testdisk 0.8.15]/ stable main
67 deb-src cdrom:[Debian APT Testdisk 0.8.15]/ stable main
68 Repeat this process for the rest of the CDs in your set."
69
70 # take Translations from previous runs as needed
71 aptcdrom add -m -o quiet=1 > apt-cdrom.log 2>&1
72 sed -i -e '/^Using CD-ROM/ d' -e '/gpgv/ d' -e '/^Identifying/ d' -e '/Reading / d' apt-cdrom.log
73 testfileequal apt-cdrom.log "Scanning disc for index files..
74 Found 2 package indexes, 1 source indexes, 2 translation indexes and 1 signatures
75 This disc is called:
76 'Debian APT Testdisk 0.8.15'
77 Writing new source list
78 Source list entries for this disc are:
79 deb cdrom:[Debian APT Testdisk 0.8.15]/ stable main
80 deb-src cdrom:[Debian APT Testdisk 0.8.15]/ stable main
81 Repeat this process for the rest of the CDs in your set."
82 msgtest 'Test for the german description translation of' 'testing'
83 aptcache show testing -o Acquire::Languages=de | grep -q '^Description-de: ' && msgpass || msgfail
84 rm -rf rootdir/var/lib/apt/lists
85 mkdir -p rootdir/var/lib/apt/lists/partial
86 aptcdrom add -m -o quiet=1 > apt-cdrom.log 2>&1
87 sed -i -e '/^Using CD-ROM/ d' -e '/gpgv/ d' -e '/^Identifying/ d' -e '/Reading / d' apt-cdrom.log
88 testfileequal apt-cdrom.log "Scanning disc for index files..
89 Found 2 package indexes, 1 source indexes, 1 translation indexes and 1 signatures
90 This disc is called:
91 'Debian APT Testdisk 0.8.15'
92 Writing new source list
93 Source list entries for this disc are:
94 deb cdrom:[Debian APT Testdisk 0.8.15]/ stable main
95 deb-src cdrom:[Debian APT Testdisk 0.8.15]/ stable main
96 Repeat this process for the rest of the CDs in your set."
97 msgtest 'Test for the english description translation of' 'testing'
98 aptcache show testing -o Acquire::Languages=en | grep -q '^Description-en: ' && msgpass || msgfail
99
100
101 # check that we really can install from a 'cdrom'
102 testdpkgnotinstalled testing
103 aptget install testing -y > /dev/null 2>&1
104 testdpkginstalled testing