]>
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 | EOF | |
31 | ||
32 | echo 'deb http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list | |
33 | testtargets 'default + Contents' 'Packages' 'Translations' 'Contents' | |
34 | ||
35 | echo 'deb [target=Packages] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list | |
36 | testtargets 'force Packages target' 'Packages' | |
37 | ||
38 | echo 'deb [target=Contents] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list | |
39 | testtargets 'force Contents target' 'Contents' | |
40 | ||
41 | echo 'deb [target=Translations,Contents] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list | |
42 | testtargets 'force two targets' 'Contents' 'Translations' | |
43 | ||
44 | echo 'deb [target+=Translations,Contents] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list | |
45 | testtargets 'add existing' 'Packages' 'Contents' 'Translations' | |
46 | ||
47 | echo 'deb [target+=AppStream] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list | |
48 | testtargets 'add non-existing' 'Packages' 'Contents' 'Translations' | |
49 | ||
50 | echo 'deb [target-=Translations,Contents] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list | |
51 | testtargets 'remove existing' 'Packages' | |
52 | ||
53 | echo 'deb [target-=AppStream] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list | |
54 | testtargets 'remove non-existing' 'Packages' 'Contents' 'Translations' | |
55 | ||
56 | echo 'deb [AppStream=yes] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list | |
57 | testtargets 'activate non-existing' 'Packages' 'Contents' 'Translations' | |
58 | ||
59 | echo 'deb [AppStream=no] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list | |
60 | testtargets 'deactivate non-existing' 'Packages' 'Contents' 'Translations' | |
61 | ||
62 | echo 'deb [Contents=yes] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list | |
63 | testtargets 'activate existing' 'Packages' 'Contents' 'Translations' | |
64 | ||
65 | echo 'deb [Contents=no] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list | |
66 | testtargets 'deactivate existing' 'Packages' 'Translations' | |
67 | ||
68 | echo 'deb [target=Packages Contents=yes] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list | |
69 | testtargets 'explicit + activate' 'Packages' 'Contents' | |
70 | ||
71 | ||
72 | msgmsg 'Contents NOT as a default target' | |
73 | echo 'Acquire::IndexTargets::deb::Contents::DefaultEnabled "no";' > rootdir/etc/apt/apt.conf.d/content-target-notdefault.conf | |
74 | ||
75 | echo 'deb http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list | |
76 | testtargets 'default + Contents' 'Packages' 'Translations' | |
77 | ||
78 | echo 'deb [target=Packages] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list | |
79 | testtargets 'force Packages target' 'Packages' | |
80 | ||
81 | echo 'deb [target=Contents] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list | |
82 | testtargets 'force Contents target' 'Contents' | |
83 | ||
84 | echo 'deb [target=Translations,Contents] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list | |
85 | testtargets 'force two targets' 'Contents' 'Translations' | |
86 | ||
87 | echo 'deb [target+=Translations,Contents] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list | |
88 | testtargets 'add existing' 'Packages' 'Contents' 'Translations' | |
89 | ||
90 | echo 'deb [target+=AppStream] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list | |
91 | testtargets 'add non-existing' 'Packages' 'Translations' | |
92 | ||
93 | echo 'deb [target-=Translations,Contents] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list | |
94 | testtargets 'remove existing' 'Packages' | |
95 | ||
96 | echo 'deb [target-=AppStream] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list | |
97 | testtargets 'remove non-existing' 'Packages' 'Translations' | |
98 | ||
99 | echo 'deb [AppStream=yes] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list | |
100 | testtargets 'activate non-existing' 'Packages' 'Translations' | |
101 | ||
102 | echo 'deb [AppStream=no] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list | |
103 | testtargets 'deactivate non-existing' 'Packages' 'Translations' | |
104 | ||
105 | echo 'deb [Contents=yes] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list | |
106 | testtargets 'activate existing' 'Packages' 'Contents' 'Translations' | |
107 | ||
108 | echo 'deb [Contents=no] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list | |
109 | testtargets 'deactivate existing' 'Packages' 'Translations' | |
110 | ||
111 | echo 'deb [target=Packages Contents=yes] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list | |
112 | testtargets 'explicit + activate' 'Packages' 'Contents' |