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