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