]>
Commit | Line | Data |
---|---|---|
a537ce19 MV |
1 | #!/bin/sh |
2 | set -e | |
3 | ||
3abb6a6a DK |
4 | TESTDIR="$(readlink -f "$(dirname "$0")")" |
5 | . "$TESTDIR/framework" | |
a537ce19 MV |
6 | |
7 | setupenvironment | |
f74a6fa1 | 8 | configarchitecture 'i386' |
a537ce19 | 9 | |
81460e32 | 10 | LISTS='rootdir/etc/apt/sources.list.d/test.list' |
7414af7f | 11 | ABSLISTS="$(readlink -f $LISTS)" |
81460e32 | 12 | SOURCES='rootdir/etc/apt/sources.list.d/test.sources' |
f74a6fa1 | 13 | BASE='# some comment |
d2d68aaf | 14 | # that contains a : as well |
7f316a3f | 15 | #Types: meep |
d2d68aaf | 16 | |
7f316a3f | 17 | Types: deb |
f6459e64 | 18 | #Types: deb-src |
75c10df1 | 19 | URIs: http://ftp.debian.org/debian |
6c069a22 | 20 | Suites: stable |
81460e32 | 21 | Components: main |
e67b9a23 | 22 | Description: summay |
f6459e64 | 23 | # comments are ignored |
f744c64c | 24 | and the long part' |
a537ce19 | 25 | |
81460e32 DK |
26 | msgcleantest() { |
27 | rm -f $LISTS $SOURCES | |
28 | msgtest "$@" | |
29 | } | |
30 | ||
31 | msgcleantest 'Test sources.list' 'old style' | |
32 | echo "deb http://ftp.debian.org/debian stable main" > $LISTS | |
7414af7f | 33 | testsuccessequal --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 | |
38 | msgcleantest 'Test sources.list' 'old style with tabs' | |
39 | echo "deb http://ftp.debian.org/debian stable main" > $LISTS | |
7414af7f | 40 | testsuccessequal --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 |
45 | msgcleantest 'Test sources.list' 'old style with forgotten end for options' |
46 | echo "deb [trusted=yes arch+=armel,powerpc http://ftp.debian.org/debian stable main" > $LISTS | |
1dd20368 | 47 | testfailureequal --nomsg "E: Malformed entry 1 in list file $ABSLISTS ([option] not assignment) |
7414af7f DK |
48 | E: The list of sources could not be read." aptget update --print-uris |
49 | ||
50 | msgcleantest 'Test sources.list' 'old style with stray ] instead of options' | |
51 | echo "deb ] http://ftp.debian.org/debian stable main" > $LISTS | |
1dd20368 | 52 | testfailureequal --nomsg "E: Malformed entry 1 in list file $ABSLISTS (URI parse) |
7414af7f DK |
53 | E: The list of sources could not be read." aptget update --print-uris |
54 | ||
55 | msgcleantest 'Test sources.list' 'old style options no key' | |
56 | echo "deb [=test] http://ftp.debian.org/debian stable main" > $LISTS | |
1dd20368 | 57 | testfailureequal --nomsg "E: Malformed entry 1 in list file $ABSLISTS ([option] no key) |
7414af7f DK |
58 | E: The list of sources could not be read." aptget update --print-uris |
59 | ||
60 | msgcleantest 'Test sources.list' 'old style options no value' | |
61 | echo "deb [test=] http://ftp.debian.org/debian stable main" > $LISTS | |
1dd20368 | 62 | testfailureequal --nomsg "E: Malformed entry 1 in list file $ABSLISTS ([option] no value) |
7414af7f DK |
63 | E: The list of sources could not be read." aptget update --print-uris |
64 | ||
81460e32 DK |
65 | msgcleantest 'Test sources.list' 'old style with options' |
66 | echo "deb [trusted=yes arch+=armel,powerpc] http://ftp.debian.org/debian stable main" > $LISTS | |
7414af7f | 67 | testsuccessequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 |
e93b4028 DK |
68 | 'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.xz' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 |
69 | 'http://ftp.debian.org/debian/dists/stable/main/binary-armel/Packages.xz' ftp.debian.org_debian_dists_stable_main_binary-armel_Packages 0 | |
70 | 'http://ftp.debian.org/debian/dists/stable/main/binary-powerpc/Packages.xz' ftp.debian.org_debian_dists_stable_main_binary-powerpc_Packages 0 | |
e8e5d464 | 71 | 'http://ftp.debian.org/debian/dists/stable/main/binary-all/Packages.xz' ftp.debian.org_debian_dists_stable_main_binary-all_Packages 0 |
e93b4028 | 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 | |
74 | msgcleantest 'Test sources.list' 'old style with comments' | |
75 | echo "deb http://ftp.debian.org/debian stable main # non-free" > $LISTS | |
7414af7f | 76 | testsuccessequal --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 | |
81 | msgcleantest 'Test sources.list' 'old style with option comments' | |
82 | echo "deb [trusted=yes#yeahreally] http://ftp.debian.org/debian stable main # non-free" > $LISTS | |
7414af7f | 83 | testsuccessequal --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 | 88 | msgcleantest 'Test sources.list' 'simple deb822' |
4194c9ae | 89 | echo "$BASE" > $SOURCES |
7414af7f | 90 | testsuccessequal --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 | 95 | msgcleantest 'Test deb822 with' 'two entries' |
a537ce19 | 96 | # Two entries |
4194c9ae MV |
97 | echo "$BASE" > $SOURCES |
98 | echo "" >> $SOURCES | |
99 | echo "$BASE" | sed s/stable/unstable/ >> $SOURCES | |
7414af7f | 100 | testsuccessequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 |
2a440328 | 101 | 'http://ftp.debian.org/debian/dists/unstable/InRelease' ftp.debian.org_debian_dists_unstable_InRelease 0 |
e93b4028 | 102 | 'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.xz' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 |
1dd20368 | 103 | 'http://ftp.debian.org/debian/dists/stable/main/binary-all/Packages.xz' ftp.debian.org_debian_dists_stable_main_binary-all_Packages 0 |
e93b4028 | 104 | 'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.xz' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 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 | 110 | msgcleantest 'Test deb822 with' 'two Suite entries' |
d73743dd | 111 | echo "$BASE" | sed -e "s/stable/stable unstable/" > $SOURCES |
7414af7f | 112 | testsuccessequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 |
2a440328 | 113 | 'http://ftp.debian.org/debian/dists/unstable/InRelease' ftp.debian.org_debian_dists_unstable_InRelease 0 |
e93b4028 | 114 | 'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.xz' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 |
1dd20368 | 115 | 'http://ftp.debian.org/debian/dists/stable/main/binary-all/Packages.xz' ftp.debian.org_debian_dists_stable_main_binary-all_Packages 0 |
e93b4028 | 116 | 'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.xz' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 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 | 121 | msgcleantest 'Test deb822' 'architecture option' |
4194c9ae | 122 | echo "$BASE" > $SOURCES |
41e6bd08 | 123 | echo "Architectures: amd64 armel" >> $SOURCES |
7414af7f | 124 | testsuccessequal --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 |
130 | msgcleantest 'Test old-style' 'suite arch variable' |
131 | echo 'deb http://ftp.tlh.debian.org/universe unstable/binary-$(ARCH)/' > $LISTS | |
7414af7f | 132 | testsuccessequal --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 | |
136 | msgcleantest 'Test deb822' 'suite arch variable' | |
137 | echo 'Types: deb | |
138 | URIs: http://ftp.tlh.debian.org/universe | |
139 | Suites: stable/binary-$(ARCH)/' > $SOURCES | |
7414af7f | 140 | testsuccessequal --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 | |
144 | msgcleantest 'Test old-style sources.list file which has' 'malformed dist' | |
145 | echo "deb http://ftp.debian.org" > $LISTS | |
7414af7f | 146 | testfailureequal --nomsg "E: Malformed entry 1 in list file $TMPWORKINGDIRECTORY/$LISTS (Suite) |
4194c9ae MV |
147 | E: The list of sources could not be read." aptget update --print-uris |
148 | ||
81460e32 | 149 | msgcleantest 'Test deb822 sources.list file which has' 'malformed URI' |
7f316a3f | 150 | echo "Types: deb |
6c069a22 | 151 | Suites: stable |
4194c9ae | 152 | " > $SOURCES |
7414af7f | 153 | testfailureequal --nomsg "E: Malformed entry 1 in sources file $TMPWORKINGDIRECTORY/$SOURCES (URI) |
4194c9ae | 154 | E: The list of sources could not be read." aptget update --print-uris |
e67b9a23 | 155 | |
7dd62ea9 MV |
156 | # with Enabled: false |
157 | echo "$BASE" > $SOURCES | |
158 | echo "Enabled: no" >> $SOURCES | |
159 | testempty aptget update --print-uris | |
75c10df1 MV |
160 | |
161 | # multiple URIs | |
81460e32 | 162 | msgcleantest 'Test deb822 sources.list file which has' 'Multiple URIs work' |
75c10df1 | 163 | echo "$BASE" | sed -e 's#http://ftp.debian.org/debian#http://ftp.debian.org/debian http://ftp.de.debian.org/debian#' > $SOURCES |
7414af7f | 164 | testsuccessequal --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 | 174 | msgcleantest 'Test deb822 sources.list file which has' 'Multiple Types work' |
7f316a3f | 175 | echo "$BASE" | sed -e 's#Types: deb#Types: deb deb-src#' > $SOURCES |
7414af7f | 176 | testsuccessequal --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 | 183 | msgcleantest 'Test deb822 sources.list file which has' 'an exact path and no sections' |
6f43fac6 MV |
184 | cat > $SOURCES <<EOF |
185 | Types: deb | |
186 | URIs: http://emacs.naquadah.org | |
187 | Suites: stable/ | |
188 | EOF | |
7414af7f | 189 | testsuccessequal --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 | |
194 | msgcleantest 'Test deb822 sources.list file which has' '-Add/-Remove multivalues' | |
195 | echo "$BASE" > $SOURCES | |
196 | echo "Languages-Remove: en" >> $SOURCES | |
197 | echo "Architectures-Add: armel" >> $SOURCES | |
198 | testsuccessequal --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 | |
e8e5d464 DK |
200 | 'http://ftp.debian.org/debian/dists/stable/main/binary-armel/Packages.xz' ftp.debian.org_debian_dists_stable_main_binary-armel_Packages 0 |
201 | 'http://ftp.debian.org/debian/dists/stable/main/binary-all/Packages.xz' ftp.debian.org_debian_dists_stable_main_binary-all_Packages 0 " aptget update --print-uris |