]> git.saurik.com Git - apt.git/blame - test/integration/test-apt-sources-deb822
improve partial/ cleanup in abort and failure cases
[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
bae81c13
DK
10echo 'APT::Sources::Use-Deb822 "true";' > rootdir/etc/apt/apt.conf.d/00enabledeb822
11
f74a6fa1
DK
12SOURCES='rootdir/etc/apt/sources.list'
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
MV
19Suites: stable
20Sections: main
e67b9a23 21Description: summay
f744c64c 22 and the long part'
a537ce19 23
bae81c13 24msgtest 'Test sources.list' 'old style'
f74a6fa1 25echo "deb http://ftp.debian.org/debian stable main" > $SOURCES
b3501edb
DK
26testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0
27'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0
f74a6fa1 28'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 " aptget update --print-uris
a537ce19 29
bae81c13 30msgtest 'Test sources.list' 'simple deb822'
4194c9ae 31echo "$BASE" > $SOURCES
b3501edb
DK
32testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0
33'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0
f74a6fa1 34'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 " aptget update --print-uris
300b15e3 35
a537ce19 36
f74a6fa1 37msgtest 'Test deb822 with' 'two entries'
a537ce19 38# Two entries
4194c9ae
MV
39echo "$BASE" > $SOURCES
40echo "" >> $SOURCES
41echo "$BASE" | sed s/stable/unstable/ >> $SOURCES
b3501edb
DK
42testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0
43'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0
a537ce19 44'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0
b3501edb
DK
45'http://ftp.debian.org/debian/dists/unstable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_unstable_main_binary-i386_Packages 0
46'http://ftp.debian.org/debian/dists/unstable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_unstable_main_i18n_Translation-en 0
f74a6fa1 47'http://ftp.debian.org/debian/dists/unstable/InRelease' ftp.debian.org_debian_dists_unstable_InRelease 0 " aptget update --print-uris
a537ce19 48
d73743dd 49# two suite entries
2f0ae309 50msgtest 'Test deb822 with' 'two Suite entries'
d73743dd 51echo "$BASE" | sed -e "s/stable/stable unstable/" > $SOURCES
b3501edb
DK
52testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0
53'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0
d73743dd 54'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0
b3501edb
DK
55'http://ftp.debian.org/debian/dists/unstable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_unstable_main_binary-i386_Packages 0
56'http://ftp.debian.org/debian/dists/unstable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_unstable_main_i18n_Translation-en 0
d73743dd 57'http://ftp.debian.org/debian/dists/unstable/InRelease' ftp.debian.org_debian_dists_unstable_InRelease 0 " aptget update --print-uris
a537ce19 58
f74a6fa1 59msgtest 'Test deb822' 'architecture option'
4194c9ae 60echo "$BASE" > $SOURCES
41e6bd08 61echo "Architectures: amd64 armel" >> $SOURCES
b3501edb
DK
62testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/main/binary-amd64/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-amd64_Packages 0
63'http://ftp.debian.org/debian/dists/stable/main/binary-armel/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-armel_Packages 0
64'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0
a537ce19 65'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 " aptget update --print-uris
d2d68aaf 66
4194c9ae 67
f74a6fa1
DK
68msgtest 'Test old-style sources.list file which has' 'malformed dist'
69echo "deb http://ftp.debian.org" > $SOURCES
70testequal --nomsg "E: Malformed line 1 in source list $TMPWORKINGDIRECTORY/rootdir/etc/apt/sources.list (dist)
4194c9ae
MV
71E: The list of sources could not be read." aptget update --print-uris
72
f74a6fa1 73msgtest 'Test deb822 sources.list file which has' 'malformed URI'
7f316a3f 74echo "Types: deb
6c069a22 75Suites: stable
4194c9ae 76" > $SOURCES
f74a6fa1 77testequal --nomsg "E: Malformed stanza 0 in source list $TMPWORKINGDIRECTORY/rootdir/etc/apt/sources.list (URI parse)
4194c9ae 78E: The list of sources could not be read." aptget update --print-uris
e67b9a23 79
7dd62ea9
MV
80# with Enabled: false
81echo "$BASE" > $SOURCES
82echo "Enabled: no" >> $SOURCES
83testempty aptget update --print-uris
75c10df1
MV
84
85# multiple URIs
f744c64c 86msgtest 'Test deb822 sources.list file which has' 'Multiple URIs work'
75c10df1 87echo "$BASE" | sed -e 's#http://ftp.debian.org/debian#http://ftp.debian.org/debian http://ftp.de.debian.org/debian#' > $SOURCES
b3501edb
DK
88testequal --nomsg "'http://ftp.de.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.de.debian.org_debian_dists_stable_main_binary-i386_Packages 0
89'http://ftp.de.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.de.debian.org_debian_dists_stable_main_i18n_Translation-en 0
75c10df1 90'http://ftp.de.debian.org/debian/dists/stable/InRelease' ftp.de.debian.org_debian_dists_stable_InRelease 0
b3501edb
DK
91'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0
92'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0
75c10df1 93'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 " aptget update --print-uris
7f316a3f
MV
94
95# multiple Type in one field
f744c64c 96msgtest 'Test deb822 sources.list file which has' 'Multiple Types work'
7f316a3f 97echo "$BASE" | sed -e 's#Types: deb#Types: deb deb-src#' > $SOURCES
b3501edb
DK
98testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/main/source/Sources.bz2' ftp.debian.org_debian_dists_stable_main_source_Sources 0
99'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0
100'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0
7f316a3f 101'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 " aptget update --print-uris
6f43fac6
MV
102
103# a Suite
104msgtest 'Test deb822 sources.list file which has' 'a exact path and no sections'
105cat > $SOURCES <<EOF
106Types: deb
107URIs: http://emacs.naquadah.org
108Suites: stable/
109EOF
b3501edb
DK
110testequal --nomsg "'http://emacs.naquadah.org/stable/Packages.bz2' emacs.naquadah.org_stable_Packages 0
111'http://emacs.naquadah.org/stable/en.bz2' emacs.naquadah.org_stable_en 0
6f43fac6 112'http://emacs.naquadah.org/stable/InRelease' emacs.naquadah.org_stable_InRelease 0 " aptget update --print-uris