]> git.saurik.com Git - apt.git/blob - test/integration/test-sourceslist-lang-plusminus-options
c61d5a4ca7b0e60956187d8bd9f7dd70db2ef536
[apt.git] / test / integration / test-sourceslist-lang-plusminus-options
1 #!/bin/sh
2 set -e
3
4 TESTDIR=$(readlink -f $(dirname $0))
5 . $TESTDIR/framework
6 setupenvironment
7 configarchitecture 'native'
8
9 testlangs() {
10 msgtest 'Test acquired languages for' "$1"
11 local LANGS="$2"
12 shift 2
13 rm -f gotlangs.list
14 aptget indextargets --no-release-info 'Created-By: Translations' "$@" --format '$(LANGUAGE)' | sort -u > gotlangs.list
15 if [ -z "$LANGS" ]; then
16 echo -n | tr ',' '\n' | sort | checkdiff - gotlangs.list && msgpass || msgfail
17 else
18 echo -n "$LANGS" | tr ',' '\n' | sort | checkdiff - gotlangs.list && msgpass || msgfail
19 fi
20 }
21 echo 'deb http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
22 testlangs 'default' 'en'
23
24 echo 'Acquire::Languages "environment,en";' > rootdir/etc/apt/apt.conf.d/langs.conf
25 testlangs 'default config' 'en'
26
27 echo 'Acquire::Languages "en,en,en";' > rootdir/etc/apt/apt.conf.d/langs.conf
28 testlangs 'duplicated config' 'en'
29
30 echo 'Acquire::Languages "none";' > rootdir/etc/apt/apt.conf.d/langs.conf
31 testlangs 'none config' ''
32
33 echo 'Acquire::Languages "en,none,de,de_DE";' > rootdir/etc/apt/apt.conf.d/langs.conf
34 testlangs 'english + german config' 'en,de,de_DE'
35
36 echo 'deb [lang=pt] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
37 testlangs 'lang=pt' 'pt'
38
39 echo 'deb [lang=en] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
40 testlangs 'lang=en' 'en'
41
42 echo 'deb [lang=de_DE] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
43 testlangs 'lang=de_DE' 'de_DE'
44
45 echo 'deb [lang=none] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
46 testlangs 'lang=none' ''
47 testequal 'amd64' aptget indextargets --no-release-info 'Created-By: Packages' --format '$(ARCHITECTURE)'
48
49 echo 'deb [lang+=pt] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
50 testlangs 'lang+=pt' 'en,de,de_DE,pt'
51
52 echo 'deb [lang+=en] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
53 testlangs 'lang+=en' 'en,de,de_DE'
54
55 echo 'deb [lang+=de_DE] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
56 testlangs 'lang+=de_DE' 'en,de,de_DE'
57
58 echo 'deb [lang-=pt] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
59 testlangs 'lang-=pt' 'en,de,de_DE'
60
61 echo 'deb [lang-=en] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
62 testlangs 'lang-=en' 'de,de_DE'
63
64 echo 'deb [lang-=de_DE] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
65 testlangs 'lang-=de_DE' 'en,de'
66
67 echo 'deb http://example.org/debian stable rocks
68 deb http://example.org/debian stable solid' > rootdir/etc/apt/sources.list
69 testlangs 'english + german config multicomponent' 'en,de,de_DE'
70
71 echo 'deb http://example.org/debian stable rocks
72 deb [lang=pt] http://example.org/debian stable solid' > rootdir/etc/apt/sources.list
73 testlangs 'multicomponent one lang= combined' 'en,de,de_DE,pt'
74 testlangs 'multicomponent one lang= rocks' 'en,de,de_DE' 'Component: rocks'
75 testlangs 'multicomponent one lang= solid' 'pt' 'Component: solid'
76
77 echo 'deb [lang=pt] http://example.org/debian stable rocks
78 deb [lang=de] http://example.org/debian stable solid' > rootdir/etc/apt/sources.list
79 testlangs 'multicomponent different lang= combined' 'de,pt'
80 testlangs 'multicomponent different lang= rocks' 'pt' 'Component: rocks'
81 testlangs 'multicomponent different lang= solid' 'de' 'Component: solid'
82
83 echo 'deb [lang+=pt] http://example.org/debian stable rocks
84 deb [lang-=de] http://example.org/debian stable solid' > rootdir/etc/apt/sources.list
85 testlangs 'multicomponent different lang+-= combined' 'en,de,de_DE,pt'
86 testlangs 'multicomponent different lang+-= rocks' 'en,de,de_DE,pt' 'Component: rocks'
87 testlangs 'multicomponent different lang+-= solid' 'en,de_DE' 'Component: solid'