]> git.saurik.com Git - apt.git/blob - test/integration/test-apt-sources-deb822
various changes to increase test-coverage
[apt.git] / test / integration / test-apt-sources-deb822
1 #!/bin/sh
2 set -e
3
4 TESTDIR=$(readlink -f $(dirname $0))
5 . $TESTDIR/framework
6
7 setupenvironment
8 configarchitecture 'i386'
9
10 LISTS='rootdir/etc/apt/sources.list.d/test.list'
11 ABSLISTS="$(readlink -f $LISTS)"
12 SOURCES='rootdir/etc/apt/sources.list.d/test.sources'
13 BASE='# some comment
14 # that contains a : as well
15 #Types: meep
16
17 Types: deb
18 URIs: http://ftp.debian.org/debian
19 Suites: stable
20 Components: main
21 Description: summay
22 and the long part'
23
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
31 testsuccessequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0
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
34
35 msgcleantest 'Test sources.list' 'old style with tabs'
36 echo "deb http://ftp.debian.org/debian stable main" > $LISTS
37 testsuccessequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0
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
40
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
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
63 testsuccessequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0
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
68
69 msgcleantest 'Test sources.list' 'old style with comments'
70 echo "deb http://ftp.debian.org/debian stable main # non-free" > $LISTS
71 testsuccessequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0
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
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
77 testsuccessequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0
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
80
81 msgcleantest 'Test sources.list' 'simple deb822'
82 echo "$BASE" > $SOURCES
83 testsuccessequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0
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
86
87 msgcleantest 'Test deb822 with' 'two entries'
88 # Two entries
89 echo "$BASE" > $SOURCES
90 echo "" >> $SOURCES
91 echo "$BASE" | sed s/stable/unstable/ >> $SOURCES
92 testsuccessequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0
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
95 'http://ftp.debian.org/debian/dists/unstable/InRelease' ftp.debian.org_debian_dists_unstable_InRelease 0
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
98
99 # two suite entries
100 msgcleantest 'Test deb822 with' 'two Suite entries'
101 echo "$BASE" | sed -e "s/stable/stable unstable/" > $SOURCES
102 testsuccessequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0
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
105 'http://ftp.debian.org/debian/dists/unstable/InRelease' ftp.debian.org_debian_dists_unstable_InRelease 0
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
108
109 msgcleantest 'Test deb822' 'architecture option'
110 echo "$BASE" > $SOURCES
111 echo "Architectures: amd64 armel" >> $SOURCES
112 testsuccessequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0
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
116
117 msgcleantest 'Test old-style' 'suite arch variable'
118 echo 'deb http://ftp.tlh.debian.org/universe unstable/binary-$(ARCH)/' > $LISTS
119 testsuccessequal --nomsg "'http://ftp.tlh.debian.org/universe/unstable/binary-i386/InRelease' ftp.tlh.debian.org_universe_unstable_binary-i386_InRelease 0
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
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
127 testsuccessequal --nomsg "'http://ftp.tlh.debian.org/universe/stable/binary-i386/InRelease' ftp.tlh.debian.org_universe_stable_binary-i386_InRelease 0
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
130
131 msgcleantest 'Test old-style sources.list file which has' 'malformed dist'
132 echo "deb http://ftp.debian.org" > $LISTS
133 testfailureequal --nomsg "E: Malformed entry 1 in list file $TMPWORKINGDIRECTORY/$LISTS (Suite)
134 E: The list of sources could not be read." aptget update --print-uris
135
136 msgcleantest 'Test deb822 sources.list file which has' 'malformed URI'
137 echo "Types: deb
138 Suites: stable
139 " > $SOURCES
140 testfailureequal --nomsg "E: Malformed entry 1 in sources file $TMPWORKINGDIRECTORY/$SOURCES (URI)
141 E: The list of sources could not be read." aptget update --print-uris
142
143 # with Enabled: false
144 echo "$BASE" > $SOURCES
145 echo "Enabled: no" >> $SOURCES
146 testempty aptget update --print-uris
147
148 # multiple URIs
149 msgcleantest 'Test deb822 sources.list file which has' 'Multiple URIs work'
150 echo "$BASE" | sed -e 's#http://ftp.debian.org/debian#http://ftp.debian.org/debian http://ftp.de.debian.org/debian#' > $SOURCES
151 testsuccessequal --nomsg "'http://ftp.de.debian.org/debian/dists/stable/InRelease' ftp.de.debian.org_debian_dists_stable_InRelease 0
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
154 'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0
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
157
158 # multiple Type in one field
159 msgcleantest 'Test deb822 sources.list file which has' 'Multiple Types work'
160 echo "$BASE" | sed -e 's#Types: deb#Types: deb deb-src#' > $SOURCES
161 testsuccessequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0
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
165
166 # a Suite
167 msgcleantest 'Test deb822 sources.list file which has' 'an exact path and no sections'
168 cat > $SOURCES <<EOF
169 Types: deb
170 URIs: http://emacs.naquadah.org
171 Suites: stable/
172 EOF
173 testsuccessequal --nomsg "'http://emacs.naquadah.org/stable/InRelease' emacs.naquadah.org_stable_InRelease 0
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