]>
Commit | Line | Data |
---|---|---|
a537ce19 MV |
1 | #!/bin/sh |
2 | set -e | |
3 | ||
4 | TESTDIR=$(readlink -f $(dirname $0)) | |
5 | . $TESTDIR/framework | |
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 |
75c10df1 | 18 | URIs: http://ftp.debian.org/debian |
6c069a22 | 19 | Suites: stable |
81460e32 | 20 | Components: main |
e67b9a23 | 21 | Description: summay |
f744c64c | 22 | and the long part' |
a537ce19 | 23 | |
81460e32 DK |
24 | msgcleantest() { |
25 | rm -f $LISTS $SOURCES | |
26 | msgtest "$@" | |
27 | } | |
28 | ||
29 | msgcleantest 'Test sources.list' 'old style' | |
30 | echo "deb http://ftp.debian.org/debian stable main" > $LISTS | |
7414af7f | 31 | testsuccessequal --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 | |
35 | msgcleantest 'Test sources.list' 'old style with tabs' | |
36 | echo "deb http://ftp.debian.org/debian stable main" > $LISTS | |
7414af7f | 37 | testsuccessequal --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 |
41 | msgcleantest 'Test sources.list' 'old style with forgotten end for options' |
42 | echo "deb [trusted=yes arch+=armel,powerpc http://ftp.debian.org/debian stable main" > $LISTS | |
43 | testfailureequal "E: Malformed entry 1 in list file $ABSLISTS ([option] not assignment) | |
44 | E: The list of sources could not be read." aptget update --print-uris | |
45 | ||
46 | msgcleantest 'Test sources.list' 'old style with stray ] instead of options' | |
47 | echo "deb ] http://ftp.debian.org/debian stable main" > $LISTS | |
48 | testfailureequal "E: Malformed entry 1 in list file $ABSLISTS (URI parse) | |
49 | E: The list of sources could not be read." aptget update --print-uris | |
50 | ||
51 | msgcleantest 'Test sources.list' 'old style options no key' | |
52 | echo "deb [=test] http://ftp.debian.org/debian stable main" > $LISTS | |
53 | testfailureequal "E: Malformed entry 1 in list file $ABSLISTS ([option] no key) | |
54 | E: The list of sources could not be read." aptget update --print-uris | |
55 | ||
56 | msgcleantest 'Test sources.list' 'old style options no value' | |
57 | echo "deb [test=] http://ftp.debian.org/debian stable main" > $LISTS | |
58 | testfailureequal "E: Malformed entry 1 in list file $ABSLISTS ([option] no value) | |
59 | E: The list of sources could not be read." aptget update --print-uris | |
60 | ||
81460e32 DK |
61 | msgcleantest 'Test sources.list' 'old style with options' |
62 | echo "deb [trusted=yes arch+=armel,powerpc] http://ftp.debian.org/debian stable main" > $LISTS | |
7414af7f | 63 | testsuccessequal --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 | |
69 | msgcleantest 'Test sources.list' 'old style with comments' | |
70 | echo "deb http://ftp.debian.org/debian stable main # non-free" > $LISTS | |
7414af7f | 71 | testsuccessequal --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 | |
75 | msgcleantest 'Test sources.list' 'old style with option comments' | |
76 | echo "deb [trusted=yes#yeahreally] http://ftp.debian.org/debian stable main # non-free" > $LISTS | |
7414af7f | 77 | testsuccessequal --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 | 81 | msgcleantest 'Test sources.list' 'simple deb822' |
4194c9ae | 82 | echo "$BASE" > $SOURCES |
7414af7f | 83 | testsuccessequal --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 | 87 | msgcleantest 'Test deb822 with' 'two entries' |
a537ce19 | 88 | # Two entries |
4194c9ae MV |
89 | echo "$BASE" > $SOURCES |
90 | echo "" >> $SOURCES | |
91 | echo "$BASE" | sed s/stable/unstable/ >> $SOURCES | |
7414af7f | 92 | testsuccessequal --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 | 100 | msgcleantest 'Test deb822 with' 'two Suite entries' |
d73743dd | 101 | echo "$BASE" | sed -e "s/stable/stable unstable/" > $SOURCES |
7414af7f | 102 | testsuccessequal --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 | 109 | msgcleantest 'Test deb822' 'architecture option' |
4194c9ae | 110 | echo "$BASE" > $SOURCES |
41e6bd08 | 111 | echo "Architectures: amd64 armel" >> $SOURCES |
7414af7f | 112 | testsuccessequal --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 |
117 | msgcleantest 'Test old-style' 'suite arch variable' |
118 | echo 'deb http://ftp.tlh.debian.org/universe unstable/binary-$(ARCH)/' > $LISTS | |
7414af7f | 119 | testsuccessequal --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 | |
123 | msgcleantest 'Test deb822' 'suite arch variable' | |
124 | echo 'Types: deb | |
125 | URIs: http://ftp.tlh.debian.org/universe | |
126 | Suites: stable/binary-$(ARCH)/' > $SOURCES | |
7414af7f | 127 | testsuccessequal --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 | |
131 | msgcleantest 'Test old-style sources.list file which has' 'malformed dist' | |
132 | echo "deb http://ftp.debian.org" > $LISTS | |
7414af7f | 133 | testfailureequal --nomsg "E: Malformed entry 1 in list file $TMPWORKINGDIRECTORY/$LISTS (Suite) |
4194c9ae MV |
134 | E: The list of sources could not be read." aptget update --print-uris |
135 | ||
81460e32 | 136 | msgcleantest 'Test deb822 sources.list file which has' 'malformed URI' |
7f316a3f | 137 | echo "Types: deb |
6c069a22 | 138 | Suites: stable |
4194c9ae | 139 | " > $SOURCES |
7414af7f | 140 | testfailureequal --nomsg "E: Malformed entry 1 in sources file $TMPWORKINGDIRECTORY/$SOURCES (URI) |
4194c9ae | 141 | E: The list of sources could not be read." aptget update --print-uris |
e67b9a23 | 142 | |
7dd62ea9 MV |
143 | # with Enabled: false |
144 | echo "$BASE" > $SOURCES | |
145 | echo "Enabled: no" >> $SOURCES | |
146 | testempty aptget update --print-uris | |
75c10df1 MV |
147 | |
148 | # multiple URIs | |
81460e32 | 149 | msgcleantest 'Test deb822 sources.list file which has' 'Multiple URIs work' |
75c10df1 | 150 | echo "$BASE" | sed -e 's#http://ftp.debian.org/debian#http://ftp.debian.org/debian http://ftp.de.debian.org/debian#' > $SOURCES |
7414af7f | 151 | testsuccessequal --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 | 159 | msgcleantest 'Test deb822 sources.list file which has' 'Multiple Types work' |
7f316a3f | 160 | echo "$BASE" | sed -e 's#Types: deb#Types: deb deb-src#' > $SOURCES |
7414af7f | 161 | testsuccessequal --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 | 167 | msgcleantest 'Test deb822 sources.list file which has' 'an exact path and no sections' |
6f43fac6 MV |
168 | cat > $SOURCES <<EOF |
169 | Types: deb | |
170 | URIs: http://emacs.naquadah.org | |
171 | Suites: stable/ | |
172 | EOF | |
7414af7f | 173 | testsuccessequal --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 |