]> git.saurik.com Git - apt.git/blame - test/integration/test-apt-cdrom
add optional support for comments in pkgTagFile
[apt.git] / test / integration / test-apt-cdrom
CommitLineData
c45233ea
DK
1#!/bin/sh
2set -e
3
3abb6a6a
DK
4TESTDIR="$(readlink -f "$(dirname "$0")")"
5. "$TESTDIR/framework"
c45233ea
DK
6setupenvironment
7configarchitecture 'amd64' 'i386'
8
9buildsimplenativepackage 'testing' 'amd64,i386' '0.8.15' 'stable'
b2ea1a47 10setupaptarchive --no-update
c45233ea
DK
11
12changetocdrom 'Debian APT Testdisk 0.8.15'
13
14# -de is not in the Release file, but picked up anyway for compatibility
a0975c8d
DK
15cd rootdir/media/cdrom-unmounted/dists/stable/main/i18n
16chmod +w .
c45233ea
DK
17sed -e '/^Description-en:/ d' -e '/^ / d' -e '/^$/ d' Translation-en > Translation-de
18echo '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
276e51dd 22compressfile Translation-de
a0975c8d 23rm -f Translation-en Translation-de
b0314abb 24chmod -R 555 .
c45233ea
DK
25cd - > /dev/null
26
1e071c30
DK
27aptcdromlog() {
28 rm -f rootdir/tmp/apt-cdrom.log
a0975c8d
DK
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
12841e83 32 sed -e '/gpgv\?: Signature made/ d' -e '/gpgv\?: Good signature/ d' -e '/^Identifying/ d' -e '/Reading / d' rootdir/tmp/apt-cdrom.log
a0975c8d
DK
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!"
1e071c30 35}
d84da499 36aptautotest_aptcdromlog_add() { aptautotest_aptget_update "$@"; }
1e071c30 37
a0975c8d 38CDROM_PRE="Using CD-ROM mount point $(readlink -f ./rootdir/media)/cdrom/
1166ea79 39Unmounting CD-ROM...
a0975c8d 40Waiting for disc...
94171725 41Please insert a Disc in the drive and press [Enter]
a0975c8d 42Mounting CD-ROM...
1166ea79 43Scanning disc for index files..."
a0975c8d 44CDROM_POST="This disc is called:
c45233ea
DK
45'Debian APT Testdisk 0.8.15'
46Writing new source list
47Source list entries for this disc are:
48deb cdrom:[Debian APT Testdisk 0.8.15]/ stable main
49deb-src cdrom:[Debian APT Testdisk 0.8.15]/ stable main
a0975c8d
DK
50Unmounting CD-ROM...
51Repeat this process for the rest of the CDs in your set."
52
25b86db1 53testsuccessequal "$CDROM_PRE
1dd20368 54Found 3 package indexes, 1 source indexes, 1 translation indexes and 1 signatures
a0975c8d
DK
55Found label 'Debian APT Testdisk 0.8.15'
56$CDROM_POST" aptcdromlog add
57
25b86db1 58testsuccessequal "Using CD-ROM mount point $(readlink -f ./rootdir/media)/cdrom/
a0975c8d
DK
59Mounting CD-ROM...
60Stored label: Debian APT Testdisk 0.8.15
61Unmounting CD-ROM..." aptcdromlog ident
1e071c30 62
a0975c8d
DK
63# apt-setup uses these commands (expect the tr in the id) to find id and label
64ident="$(LC_ALL=C aptcdrom ident 2>&1 )"
65CD_ID="$(echo "$ident" | grep "^Identifying" | head -n1 | cut -d" " -f2 | tr --delete '[]')"
66CD_LABEL="$(echo "$ident" | grep "^Stored label:" | head -n1 | sed "s/^[^:]*: //")"
25b86db1
DK
67testfileequal rootdir/var/lib/apt/cdroms.list "CD::${CD_ID} \"${CD_LABEL}\";
68CD::${CD_ID}::Label \"${CD_LABEL}\";"
c45233ea 69
5afcfe2a
DK
70testcdromusage() {
71 touch rootdir/var/lib/apt/extended_states
72
25b86db1 73 testsuccessequal 'Reading package lists...
c45233ea 74Building dependency tree...
5afcfe2a 75Reading state information...
c45233ea
DK
76The following NEW packages will be installed:
77 testing
780 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
79Inst testing (0.8.15 stable [amd64])
80Conf testing (0.8.15 stable [amd64])' aptget install testing -s
81
5afcfe2a
DK
82 testdpkgnotinstalled testing
83 testsuccess aptget install testing -y
84 testdpkginstalled testing
85 testsuccess aptget purge testing -y
86 testdpkgnotinstalled testing
87
25b86db1 88 testsuccessequal 'Reading package lists...
c45233ea 89Building dependency tree...
5afcfe2a 90Reading state information...
c45233ea
DK
91The following NEW packages will be installed:
92 testing:i386
930 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
94Inst testing:i386 (0.8.15 stable [i386])
95Conf testing:i386 (0.8.15 stable [i386])' aptget install testing:i386 -s
96
5afcfe2a
DK
97 testdpkgnotinstalled testing:i386
98 testsuccess aptget install testing:i386 -y
99 testdpkginstalled testing:i386
100 testsuccess aptget purge testing:i386 -y
101 testdpkgnotinstalled testing:i386
102
03aa0847 103 cd downloaded
5afcfe2a
DK
104 rm -f testing_0.8.15_amd64.deb
105 testsuccess aptget download testing
106 testsuccess test -s testing_0.8.15_amd64.deb
107 rm -f testing_0.8.15_amd64.deb
108
109 rm -f testing_0.8.15.dsc
110 testsuccess aptget source testing --dsc-only -d
111 testsuccess test -s testing_0.8.15.dsc
112 rm -f testing_0.8.15.dsc
03aa0847 113 cd - >/dev/null
5afcfe2a
DK
114}
115testcdromusage
116
c45233ea 117# check Idempotence of apt-cdrom (and disabling of Translation dropping)
25b86db1 118testsuccessequal "$CDROM_PRE
1dd20368 119Found 3 package indexes, 1 source indexes, 2 translation indexes and 1 signatures
a0975c8d 120$CDROM_POST" aptcdromlog add -o APT::CDROM::DropTranslation=0
c45233ea
DK
121
122# take Translations from previous runs as needed
25b86db1 123testsuccessequal "$CDROM_PRE
1dd20368 124Found 3 package indexes, 1 source indexes, 2 translation indexes and 1 signatures
a0975c8d 125$CDROM_POST" aptcdromlog add
c45233ea
DK
126msgtest 'Test for the german description translation of' 'testing'
127aptcache show testing -o Acquire::Languages=de | grep -q '^Description-de: ' && msgpass || msgfail
128rm -rf rootdir/var/lib/apt/lists
25b86db1 129testsuccessequal "$CDROM_PRE
1dd20368 130Found 3 package indexes, 1 source indexes, 1 translation indexes and 1 signatures
a0975c8d 131$CDROM_POST" aptcdromlog add
c45233ea
DK
132msgtest 'Test for the english description translation of' 'testing'
133aptcache show testing -o Acquire::Languages=en | grep -q '^Description-en: ' && msgpass || msgfail
134
5afcfe2a
DK
135# ensure cdrom method isn't trying to mount the cdrom
136mv rootdir/media/cdrom-unmounted rootdir/media/cdrom-ejected
d84da499 137msgmsg "ensure an update doesn't mess with cdrom sources"
5afcfe2a 138testsuccess aptget update
1eb1836f 139testfileequal rootdir/tmp/testsuccess.output 'Hit:1 cdrom://Debian APT Testdisk 0.8.15 stable InRelease
ff86d7df 140Reading package lists...'
5afcfe2a
DK
141mv rootdir/media/cdrom-ejected rootdir/media/cdrom-unmounted
142testcdromusage
143
d84da499 144msgmsg 'and again to check that it withstands the temptation even if it could mount'
5afcfe2a 145testsuccess aptget update
1eb1836f 146testfileequal rootdir/tmp/testsuccess.output 'Hit:1 cdrom://Debian APT Testdisk 0.8.15 stable InRelease
ff86d7df 147Reading package lists...'
5afcfe2a 148testcdromusage
b0314abb
DK
149
150msgmsg 'Check that nothing touched our' 'CD-ROM'
151for file in $(find rootdir/media/cdrom-unmounted/dists); do
4bb006d1 152 testfilestats "$file" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:555"
b0314abb 153done