]>
Commit | Line | Data |
---|---|---|
1 | #!/bin/sh | |
2 | set -e | |
3 | ||
4 | TESTDIR="$(readlink -f "$(dirname "$0")")" | |
5 | . "$TESTDIR/framework" | |
6 | setupenvironment | |
7 | configarchitecture 'amd64' | |
8 | ||
9 | testtargets() { | |
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 | ||
20 | echo 'deb http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list | |
21 | testtargets 'default' 'Packages' 'Translations' | |
22 | ||
23 | msgmsg 'Contents as a default target' | |
24 | cat > rootdir/etc/apt/apt.conf.d/content-target.conf <<EOF | |
25 | Acquire::IndexTargets::deb::Contents { | |
26 | MetaKey "\$(COMPONENT)/Contents-\$(ARCHITECTURE)"; | |
27 | ShortDescription "Contents"; | |
28 | Description "\$(RELEASE)/\$(COMPONENT) \$(ARCHITECTURE) Contents"; | |
29 | }; | |
30 | Acquire::IndexTargets::deb::Contents2 { | |
31 | MetaKey "Contents-\$(ARCHITECTURE)"; | |
32 | ShortDescription "Contents2"; | |
33 | Description "\$(RELEASE) \$(ARCHITECTURE) Contents2"; | |
34 | Fallback-Of "Contents"; | |
35 | Identifier "Contents"; | |
36 | }; | |
37 | EOF | |
38 | ||
39 | echo 'deb http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list | |
40 | testtargets 'default + Contents' 'Packages' 'Translations' 'Contents' 'Contents2' | |
41 | ||
42 | echo 'deb [target=Packages] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list | |
43 | testtargets 'force Packages target' 'Packages' | |
44 | ||
45 | echo 'deb [target=Contents] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list | |
46 | testtargets 'force Contents target' 'Contents' | |
47 | ||
48 | echo 'deb [target=Translations,Contents] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list | |
49 | testtargets 'force two targets' 'Contents' 'Translations' | |
50 | ||
51 | echo 'deb [target+=Translations,Contents] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list | |
52 | testtargets 'add existing' 'Packages' 'Contents' 'Translations' 'Contents2' | |
53 | ||
54 | echo 'deb [target+=AppStream] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list | |
55 | testtargets 'add non-existing' 'Packages' 'Contents' 'Translations' 'Contents2' | |
56 | ||
57 | echo 'deb [target-=Translations,Contents] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list | |
58 | testtargets 'remove existing' 'Packages' 'Contents2' | |
59 | ||
60 | echo 'deb [target-=AppStream] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list | |
61 | testtargets 'remove non-existing' 'Packages' 'Contents' 'Translations' 'Contents2' | |
62 | ||
63 | echo 'deb [AppStream=yes] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list | |
64 | testtargets 'activate non-existing' 'Packages' 'Contents' 'Translations' 'Contents2' | |
65 | ||
66 | echo 'deb [AppStream=no] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list | |
67 | testtargets 'deactivate non-existing' 'Packages' 'Contents' 'Translations' 'Contents2' | |
68 | ||
69 | echo 'deb [Contents=yes] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list | |
70 | testtargets 'activate existing' 'Packages' 'Contents' 'Contents2' 'Translations' | |
71 | ||
72 | echo 'deb [Contents=no] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list | |
73 | testtargets 'deactivate existing' 'Packages' 'Translations' | |
74 | ||
75 | echo 'deb [target=Packages Contents=yes] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list | |
76 | testtargets 'explicit + activate' 'Packages' 'Contents' 'Contents2' | |
77 | ||
78 | echo 'deb [Contents=yes,target+=Contents] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list | |
79 | testtargets 'duplications are okay' 'Packages' 'Translations' 'Contents' 'Contents2' | |
80 | ||
81 | msgmsg 'Contents NOT as a default target (but Contents2)' | |
82 | echo 'Acquire::IndexTargets::deb::Contents::DefaultEnabled "no";' > rootdir/etc/apt/apt.conf.d/content-target-notdefault.conf | |
83 | ||
84 | echo 'deb http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list | |
85 | testtargets 'default + Contents' 'Packages' 'Translations' 'Contents2' | |
86 | ||
87 | echo 'deb [target=Packages] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list | |
88 | testtargets 'force Packages target' 'Packages' | |
89 | ||
90 | echo 'deb [target=Contents] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list | |
91 | testtargets 'force Contents target' 'Contents' | |
92 | ||
93 | echo 'deb [target=Translations,Contents] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list | |
94 | testtargets 'force two targets' 'Contents' 'Translations' | |
95 | ||
96 | echo 'deb [target+=Translations,Contents] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list | |
97 | testtargets 'add existing' 'Packages' 'Contents' 'Translations' 'Contents2' | |
98 | ||
99 | echo 'deb [target+=AppStream] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list | |
100 | testtargets 'add non-existing' 'Packages' 'Translations' 'Contents2' | |
101 | ||
102 | echo 'deb [target-=Translations,Contents] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list | |
103 | testtargets 'remove existing' 'Packages' 'Contents2' | |
104 | ||
105 | echo 'deb [target-=AppStream] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list | |
106 | testtargets 'remove non-existing' 'Packages' 'Translations' 'Contents2' | |
107 | ||
108 | echo 'deb [AppStream=yes] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list | |
109 | testtargets 'activate non-existing' 'Packages' 'Translations' 'Contents2' | |
110 | ||
111 | echo 'deb [AppStream=no] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list | |
112 | testtargets 'deactivate non-existing' 'Packages' 'Translations' 'Contents2' | |
113 | ||
114 | echo 'deb [Contents=yes] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list | |
115 | testtargets 'activate existing' 'Packages' 'Contents' 'Contents2' 'Translations' | |
116 | ||
117 | echo 'deb [Contents=no] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list | |
118 | testtargets 'deactivate existing' 'Packages' 'Translations' | |
119 | ||
120 | echo 'deb [target=Packages Contents=yes] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list | |
121 | testtargets 'explicit + activate' 'Packages' 'Contents' 'Contents2' | |
122 | ||
123 | echo 'deb [Contents=yes,target+=Contents] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list | |
124 | testtargets 'duplications are okay' 'Packages' 'Translations' 'Contents' 'Contents2' |