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