]> git.saurik.com Git - apt.git/blame - test/integration/test-sourceslist-target-plusminus-options
support setting empty values (sanely) & removing support for
[apt.git] / test / integration / test-sourceslist-target-plusminus-options
CommitLineData
e6a12ff7
DK
1#!/bin/sh
2set -e
3
4TESTDIR=$(readlink -f $(dirname $0))
5. $TESTDIR/framework
6setupenvironment
7configarchitecture 'amd64'
8
9testtargets() {
10 msgtest 'Test acquired targets for' "$1"
11 shift
12 while [ -n "$1" ]; do
13 echo "$1"
14 shift
15 done | sort -u > expectedtargets.lst
16 aptget indextargets --no-release-info --format='$(CREATED_BY)' | sort -u > gottargets.lst
17 testfileequal --nomsg ./expectedtargets.lst "$(cat ./gottargets.lst)"
18}
19
20echo 'deb http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
21testtargets 'default' 'Packages' 'Translations'
22
9adb9778 23msgmsg 'Contents as a default target'
e6a12ff7
DK
24cat > rootdir/etc/apt/apt.conf.d/content-target.conf <<EOF
25Acquire::IndexTargets::deb::Contents {
26 MetaKey "\$(COMPONENT)/Contents-\$(ARCHITECTURE)";
27 ShortDescription "Contents";
28 Description "\$(RELEASE)/\$(COMPONENT) \$(ARCHITECTURE) Contents";
29};
30EOF
9adb9778
DK
31
32echo 'deb http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
e6a12ff7
DK
33testtargets 'default + Contents' 'Packages' 'Translations' 'Contents'
34
35echo 'deb [target=Packages] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
36testtargets 'force Packages target' 'Packages'
37
38echo 'deb [target=Contents] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
39testtargets 'force Contents target' 'Contents'
40
41echo 'deb [target=Translations,Contents] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
42testtargets 'force two targets' 'Contents' 'Translations'
43
44echo 'deb [target+=Translations,Contents] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
45testtargets 'add existing' 'Packages' 'Contents' 'Translations'
46
47echo 'deb [target+=AppStream] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
48testtargets 'add non-existing' 'Packages' 'Contents' 'Translations'
49
50echo 'deb [target-=Translations,Contents] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
51testtargets 'remove existing' 'Packages'
52
53echo 'deb [target-=AppStream] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
54testtargets 'remove non-existing' 'Packages' 'Contents' 'Translations'
55
56echo 'deb [AppStream=yes] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
57testtargets 'activate non-existing' 'Packages' 'Contents' 'Translations'
58
59echo 'deb [AppStream=no] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
60testtargets 'deactivate non-existing' 'Packages' 'Contents' 'Translations'
61
62echo 'deb [Contents=yes] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
63testtargets 'activate existing' 'Packages' 'Contents' 'Translations'
64
65echo 'deb [Contents=no] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
66testtargets 'deactivate existing' 'Packages' 'Translations'
67
68echo 'deb [target=Packages Contents=yes] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
69testtargets 'explicit + activate' 'Packages' 'Contents'
9adb9778
DK
70
71
72msgmsg 'Contents NOT as a default target'
73echo 'Acquire::IndexTargets::deb::Contents::DefaultEnabled "no";' > rootdir/etc/apt/apt.conf.d/content-target-notdefault.conf
74
75echo 'deb http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
76testtargets 'default + Contents' 'Packages' 'Translations'
77
78echo 'deb [target=Packages] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
79testtargets 'force Packages target' 'Packages'
80
81echo 'deb [target=Contents] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
82testtargets 'force Contents target' 'Contents'
83
84echo 'deb [target=Translations,Contents] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
85testtargets 'force two targets' 'Contents' 'Translations'
86
87echo 'deb [target+=Translations,Contents] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
88testtargets 'add existing' 'Packages' 'Contents' 'Translations'
89
90echo 'deb [target+=AppStream] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
91testtargets 'add non-existing' 'Packages' 'Translations'
92
93echo 'deb [target-=Translations,Contents] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
94testtargets 'remove existing' 'Packages'
95
96echo 'deb [target-=AppStream] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
97testtargets 'remove non-existing' 'Packages' 'Translations'
98
99echo 'deb [AppStream=yes] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
100testtargets 'activate non-existing' 'Packages' 'Translations'
101
102echo 'deb [AppStream=no] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
103testtargets 'deactivate non-existing' 'Packages' 'Translations'
104
105echo 'deb [Contents=yes] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
106testtargets 'activate existing' 'Packages' 'Contents' 'Translations'
107
108echo 'deb [Contents=no] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
109testtargets 'deactivate existing' 'Packages' 'Translations'
110
111echo 'deb [target=Packages Contents=yes] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
112testtargets 'explicit + activate' 'Packages' 'Contents'