summaryrefslogtreecommitdiffstats
path: root/test/integration/test-sourceslist-lang-plusminus-options
blob: abdb647933c59cd4e9c74d7d2756b4110da45f8a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/bin/sh
set -e

TESTDIR="$(readlink -f "$(dirname "$0")")"
. "$TESTDIR/framework"
setupenvironment
configarchitecture 'amd64'

testlangs() {
	msgtest 'Test acquired languages for' "$1"
	local LANGS="$2"
	shift 2
	rm -f gotlangs.list
	aptget indextargets --no-release-info 'Identifier: Translations' "$@" --format '$(LANGUAGE)' | sort -u > gotlangs.list
	if [ -z "$LANGS" ]; then
		echo -n | tr ',' '\n' | sort | checkdiff - gotlangs.list && msgpass || msgfail
	else
		echo -n "$LANGS" | tr ',' '\n' | sort | checkdiff - gotlangs.list && msgpass || msgfail
	fi
}
echo 'deb http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
testlangs 'default' 'en'

echo 'Acquire::Languages "environment,en";' > rootdir/etc/apt/apt.conf.d/langs.conf
testlangs 'default config' 'en'

echo 'Acquire::Languages "en,en,en";' > rootdir/etc/apt/apt.conf.d/langs.conf
testlangs 'duplicated config' 'en'

echo 'Acquire::Languages "none";' > rootdir/etc/apt/apt.conf.d/langs.conf
testlangs 'none config' ''

echo 'Acquire::Languages "en,none,de,de_DE";' > rootdir/etc/apt/apt.conf.d/langs.conf
testlangs 'english + german config' 'en,de,de_DE'

echo 'deb [lang=pt] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
testlangs 'lang=pt' 'pt'

echo 'deb [lang=en] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
testlangs 'lang=en' 'en'

echo 'deb [lang=de_DE] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
testlangs 'lang=de_DE' 'de_DE'

echo 'deb [lang=none] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
testlangs 'lang=none' ''
testequal 'amd64
all' aptget indextargets --no-release-info 'Identifier: Packages' --format '$(ARCHITECTURE)'

echo 'deb [lang+=pt] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
testlangs 'lang+=pt' 'en,de,de_DE,pt'

echo 'deb [lang+=en] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
testlangs 'lang+=en' 'en,de,de_DE'

echo 'deb [lang+=de_DE] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
testlangs 'lang+=de_DE' 'en,de,de_DE'

echo 'deb [lang-=pt] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
testlangs 'lang-=pt' 'en,de,de_DE'

echo 'deb [lang-=en] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
testlangs 'lang-=en' 'de,de_DE'

echo 'deb [lang-=de_DE] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
testlangs 'lang-=de_DE' 'en,de'

echo 'deb http://example.org/debian stable rocks
deb http://example.org/debian stable solid' > rootdir/etc/apt/sources.list
testlangs 'english + german config multicomponent' 'en,de,de_DE'

echo 'deb http://example.org/debian stable rocks
deb [lang=pt] http://example.org/debian stable solid' > rootdir/etc/apt/sources.list
testlangs 'multicomponent one lang= combined' 'en,de,de_DE,pt'
testlangs 'multicomponent one lang= rocks' 'en,de,de_DE' 'Component: rocks'
testlangs 'multicomponent one lang= solid' 'pt' 'Component: solid'

echo 'deb [lang=pt] http://example.org/debian stable rocks
deb [lang=de] http://example.org/debian stable solid' > rootdir/etc/apt/sources.list
testlangs 'multicomponent different lang= combined' 'de,pt'
testlangs 'multicomponent different lang= rocks' 'pt' 'Component: rocks'
testlangs 'multicomponent different lang= solid' 'de' 'Component: solid'

echo 'deb [lang+=pt] http://example.org/debian stable rocks
deb [lang-=de] http://example.org/debian stable solid' > rootdir/etc/apt/sources.list
testlangs 'multicomponent different lang+-= combined' 'en,de,de_DE,pt'
testlangs 'multicomponent different lang+-= rocks' 'en,de,de_DE,pt' 'Component: rocks'
testlangs 'multicomponent different lang+-= solid' 'en,de_DE' 'Component: solid'