]> git.saurik.com Git - apt.git/blame - test/integration/test-apt-sources-deb822
various changes to increase test-coverage
[apt.git] / test / integration / test-apt-sources-deb822
CommitLineData
a537ce19
MV
1#!/bin/sh
2set -e
3
4TESTDIR=$(readlink -f $(dirname $0))
5. $TESTDIR/framework
6
7setupenvironment
f74a6fa1 8configarchitecture 'i386'
a537ce19 9
81460e32 10LISTS='rootdir/etc/apt/sources.list.d/test.list'
7414af7f 11ABSLISTS="$(readlink -f $LISTS)"
81460e32 12SOURCES='rootdir/etc/apt/sources.list.d/test.sources'
f74a6fa1 13BASE='# some comment
d2d68aaf 14# that contains a : as well
7f316a3f 15#Types: meep
d2d68aaf 16
7f316a3f 17Types: deb
75c10df1 18URIs: http://ftp.debian.org/debian
6c069a22 19Suites: stable
81460e32 20Components: main
e67b9a23 21Description: summay
f744c64c 22 and the long part'
a537ce19 23
81460e32
DK
24msgcleantest() {
25 rm -f $LISTS $SOURCES
26 msgtest "$@"
27}
28
29msgcleantest 'Test sources.list' 'old style'
30echo "deb http://ftp.debian.org/debian stable main" > $LISTS
7414af7f 31testsuccessequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0
e93b4028
DK
32'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.xz' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0
33'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.xz' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 " aptget update --print-uris
defe3231
JAK
34
35msgcleantest 'Test sources.list' 'old style with tabs'
36echo "deb http://ftp.debian.org/debian stable main" > $LISTS
7414af7f 37testsuccessequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0
e93b4028
DK
38'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.xz' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0
39'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.xz' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 " aptget update --print-uris
81460e32 40
7414af7f
DK
41msgcleantest 'Test sources.list' 'old style with forgotten end for options'
42echo "deb [trusted=yes arch+=armel,powerpc http://ftp.debian.org/debian stable main" > $LISTS
43testfailureequal "E: Malformed entry 1 in list file $ABSLISTS ([option] not assignment)
44E: The list of sources could not be read." aptget update --print-uris
45
46msgcleantest 'Test sources.list' 'old style with stray ] instead of options'
47echo "deb ] http://ftp.debian.org/debian stable main" > $LISTS
48testfailureequal "E: Malformed entry 1 in list file $ABSLISTS (URI parse)
49E: The list of sources could not be read." aptget update --print-uris
50
51msgcleantest 'Test sources.list' 'old style options no key'
52echo "deb [=test] http://ftp.debian.org/debian stable main" > $LISTS
53testfailureequal "E: Malformed entry 1 in list file $ABSLISTS ([option] no key)
54E: The list of sources could not be read." aptget update --print-uris
55
56msgcleantest 'Test sources.list' 'old style options no value'
57echo "deb [test=] http://ftp.debian.org/debian stable main" > $LISTS
58testfailureequal "E: Malformed entry 1 in list file $ABSLISTS ([option] no value)
59E: The list of sources could not be read." aptget update --print-uris
60
81460e32
DK
61msgcleantest 'Test sources.list' 'old style with options'
62echo "deb [trusted=yes arch+=armel,powerpc] http://ftp.debian.org/debian stable main" > $LISTS
7414af7f 63testsuccessequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0
e93b4028
DK
64'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.xz' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0
65'http://ftp.debian.org/debian/dists/stable/main/binary-armel/Packages.xz' ftp.debian.org_debian_dists_stable_main_binary-armel_Packages 0
66'http://ftp.debian.org/debian/dists/stable/main/binary-powerpc/Packages.xz' ftp.debian.org_debian_dists_stable_main_binary-powerpc_Packages 0
67'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.xz' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 " aptget update --print-uris
81460e32
DK
68
69msgcleantest 'Test sources.list' 'old style with comments'
70echo "deb http://ftp.debian.org/debian stable main # non-free" > $LISTS
7414af7f 71testsuccessequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0
e93b4028
DK
72'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.xz' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0
73'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.xz' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 " aptget update --print-uris
81460e32
DK
74
75msgcleantest 'Test sources.list' 'old style with option comments'
76echo "deb [trusted=yes#yeahreally] http://ftp.debian.org/debian stable main # non-free" > $LISTS
7414af7f 77testsuccessequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0
e93b4028
DK
78'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.xz' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0
79'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.xz' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 " aptget update --print-uris
a537ce19 80
81460e32 81msgcleantest 'Test sources.list' 'simple deb822'
4194c9ae 82echo "$BASE" > $SOURCES
7414af7f 83testsuccessequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0
e93b4028
DK
84'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.xz' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0
85'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.xz' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 " aptget update --print-uris
a537ce19 86
81460e32 87msgcleantest 'Test deb822 with' 'two entries'
a537ce19 88# Two entries
4194c9ae
MV
89echo "$BASE" > $SOURCES
90echo "" >> $SOURCES
91echo "$BASE" | sed s/stable/unstable/ >> $SOURCES
7414af7f 92testsuccessequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0
e93b4028
DK
93'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.xz' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0
94'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.xz' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0
448c38bd 95'http://ftp.debian.org/debian/dists/unstable/InRelease' ftp.debian.org_debian_dists_unstable_InRelease 0
e93b4028
DK
96'http://ftp.debian.org/debian/dists/unstable/main/binary-i386/Packages.xz' ftp.debian.org_debian_dists_unstable_main_binary-i386_Packages 0
97'http://ftp.debian.org/debian/dists/unstable/main/i18n/Translation-en.xz' ftp.debian.org_debian_dists_unstable_main_i18n_Translation-en 0 " aptget update --print-uris
a537ce19 98
d73743dd 99# two suite entries
81460e32 100msgcleantest 'Test deb822 with' 'two Suite entries'
d73743dd 101echo "$BASE" | sed -e "s/stable/stable unstable/" > $SOURCES
7414af7f 102testsuccessequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0
e93b4028
DK
103'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.xz' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0
104'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.xz' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0
448c38bd 105'http://ftp.debian.org/debian/dists/unstable/InRelease' ftp.debian.org_debian_dists_unstable_InRelease 0
e93b4028
DK
106'http://ftp.debian.org/debian/dists/unstable/main/binary-i386/Packages.xz' ftp.debian.org_debian_dists_unstable_main_binary-i386_Packages 0
107'http://ftp.debian.org/debian/dists/unstable/main/i18n/Translation-en.xz' ftp.debian.org_debian_dists_unstable_main_i18n_Translation-en 0 " aptget update --print-uris
a537ce19 108
81460e32 109msgcleantest 'Test deb822' 'architecture option'
4194c9ae 110echo "$BASE" > $SOURCES
41e6bd08 111echo "Architectures: amd64 armel" >> $SOURCES
7414af7f 112testsuccessequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0
e93b4028
DK
113'http://ftp.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz' ftp.debian.org_debian_dists_stable_main_binary-amd64_Packages 0
114'http://ftp.debian.org/debian/dists/stable/main/binary-armel/Packages.xz' ftp.debian.org_debian_dists_stable_main_binary-armel_Packages 0
115'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.xz' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 " aptget update --print-uris
d2d68aaf 116
81460e32
DK
117msgcleantest 'Test old-style' 'suite arch variable'
118echo 'deb http://ftp.tlh.debian.org/universe unstable/binary-$(ARCH)/' > $LISTS
7414af7f 119testsuccessequal --nomsg "'http://ftp.tlh.debian.org/universe/unstable/binary-i386/InRelease' ftp.tlh.debian.org_universe_unstable_binary-i386_InRelease 0
e93b4028
DK
120'http://ftp.tlh.debian.org/universe/unstable/binary-i386/Packages.xz' ftp.tlh.debian.org_universe_unstable_binary-i386_Packages 0
121'http://ftp.tlh.debian.org/universe/unstable/binary-i386/en.xz' ftp.tlh.debian.org_universe_unstable_binary-i386_en 0 " aptget update --print-uris
81460e32
DK
122
123msgcleantest 'Test deb822' 'suite arch variable'
124echo 'Types: deb
125URIs: http://ftp.tlh.debian.org/universe
126Suites: stable/binary-$(ARCH)/' > $SOURCES
7414af7f 127testsuccessequal --nomsg "'http://ftp.tlh.debian.org/universe/stable/binary-i386/InRelease' ftp.tlh.debian.org_universe_stable_binary-i386_InRelease 0
e93b4028
DK
128'http://ftp.tlh.debian.org/universe/stable/binary-i386/Packages.xz' ftp.tlh.debian.org_universe_stable_binary-i386_Packages 0
129'http://ftp.tlh.debian.org/universe/stable/binary-i386/en.xz' ftp.tlh.debian.org_universe_stable_binary-i386_en 0 " aptget update --print-uris
81460e32
DK
130
131msgcleantest 'Test old-style sources.list file which has' 'malformed dist'
132echo "deb http://ftp.debian.org" > $LISTS
7414af7f 133testfailureequal --nomsg "E: Malformed entry 1 in list file $TMPWORKINGDIRECTORY/$LISTS (Suite)
4194c9ae
MV
134E: The list of sources could not be read." aptget update --print-uris
135
81460e32 136msgcleantest 'Test deb822 sources.list file which has' 'malformed URI'
7f316a3f 137echo "Types: deb
6c069a22 138Suites: stable
4194c9ae 139" > $SOURCES
7414af7f 140testfailureequal --nomsg "E: Malformed entry 1 in sources file $TMPWORKINGDIRECTORY/$SOURCES (URI)
4194c9ae 141E: The list of sources could not be read." aptget update --print-uris
e67b9a23 142
7dd62ea9
MV
143# with Enabled: false
144echo "$BASE" > $SOURCES
145echo "Enabled: no" >> $SOURCES
146testempty aptget update --print-uris
75c10df1
MV
147
148# multiple URIs
81460e32 149msgcleantest 'Test deb822 sources.list file which has' 'Multiple URIs work'
75c10df1 150echo "$BASE" | sed -e 's#http://ftp.debian.org/debian#http://ftp.debian.org/debian http://ftp.de.debian.org/debian#' > $SOURCES
7414af7f 151testsuccessequal --nomsg "'http://ftp.de.debian.org/debian/dists/stable/InRelease' ftp.de.debian.org_debian_dists_stable_InRelease 0
e93b4028
DK
152'http://ftp.de.debian.org/debian/dists/stable/main/binary-i386/Packages.xz' ftp.de.debian.org_debian_dists_stable_main_binary-i386_Packages 0
153'http://ftp.de.debian.org/debian/dists/stable/main/i18n/Translation-en.xz' ftp.de.debian.org_debian_dists_stable_main_i18n_Translation-en 0
448c38bd 154'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0
e93b4028
DK
155'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.xz' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0
156'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.xz' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 " aptget update --print-uris
7f316a3f
MV
157
158# multiple Type in one field
81460e32 159msgcleantest 'Test deb822 sources.list file which has' 'Multiple Types work'
7f316a3f 160echo "$BASE" | sed -e 's#Types: deb#Types: deb deb-src#' > $SOURCES
7414af7f 161testsuccessequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0
e93b4028
DK
162'http://ftp.debian.org/debian/dists/stable/main/source/Sources.xz' ftp.debian.org_debian_dists_stable_main_source_Sources 0
163'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.xz' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0
164'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.xz' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 " aptget update --print-uris
6f43fac6
MV
165
166# a Suite
81460e32 167msgcleantest 'Test deb822 sources.list file which has' 'an exact path and no sections'
6f43fac6
MV
168cat > $SOURCES <<EOF
169Types: deb
170URIs: http://emacs.naquadah.org
171Suites: stable/
172EOF
7414af7f 173testsuccessequal --nomsg "'http://emacs.naquadah.org/stable/InRelease' emacs.naquadah.org_stable_InRelease 0
e93b4028
DK
174'http://emacs.naquadah.org/stable/Packages.xz' emacs.naquadah.org_stable_Packages 0
175'http://emacs.naquadah.org/stable/en.xz' emacs.naquadah.org_stable_en 0 " aptget update --print-uris