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