]> git.saurik.com Git - apt.git/blame - test/integration/test-bug-624218-Translation-file-handling
Only support Translation-* that are listed in the {In,}Release file
[apt.git] / test / integration / test-bug-624218-Translation-file-handling
CommitLineData
7cb28948
DK
1#!/bin/sh
2set -e
3
4TESTDIR=$(readlink -f $(dirname $0))
5. $TESTDIR/framework
6setupenvironment
7configarchitecture 'i386'
8
9buildsimplenativepackage 'coolstuff' 'all' '1.0' 'unstable'
10
11setupaptarchive
12
13changetowebserver
14
15rm -rf rootdir/var/lib/apt/lists
16
a5b9f489
DK
17translationslisted() {
18 msgtest 'No download of non-existent locals' "$1"
19 LC_ALL="" aptget update -o Acquire::Languages=en | grep -q -e 'Translation-[^e][^n] ' && msgfail || msgpass
20 rm -rf rootdir/var/lib/apt/lists
7cb28948 21
a5b9f489
DK
22 msgtest 'Download of existent locals' "$1"
23 LC_ALL="" aptget update | grep -q -e 'Translation-en ' && msgpass || msgfail
24 rm -rf rootdir/var/lib/apt/lists
7cb28948 25
a5b9f489
DK
26 msgtest 'Download of en in LC_ALL=C' "$1"
27 LC_ALL=C aptget update | grep -q -e 'Translation-en ' && msgpass || msgfail
28 rm -rf rootdir/var/lib/apt/lists
7cb28948 29
a5b9f489
DK
30 msgtest 'Download of en as forced language' "$1"
31 aptget update -o Acquire::Languages=en | grep -q -e 'Translation-en ' && msgpass || msgfail
32 rm -rf rootdir/var/lib/apt/lists
7cb28948 33
a5b9f489
DK
34 msgtest 'Download of nothing else in forced language' "$1"
35 aptget update -o Acquire::Languages=en | grep -q -e 'Translation-[^e][^n] ' && msgfail || msgpass
36 rm -rf rootdir/var/lib/apt/lists
7cb28948 37
a5b9f489
DK
38 msgtest 'Download no Translation- if forced language is non-existent' "$1"
39 aptget update -o Acquire::Languages=ast_DE | grep -q -e 'Translation-' && msgfail || msgpass
40 rm -rf rootdir/var/lib/apt/lists
41
42 msgtest 'Download of nothing if none is forced' "$1"
43 aptget update -o Acquire::Languages=none | grep -q -e 'Translation' && msgfail || msgpass
44 rm -rf rootdir/var/lib/apt/lists
45}
46
47translationslisted 'with full Index'
48
49
a5b9f489 50# no records at all about Translation files (fallback to guessing)
18593cf7
MV
51find aptarchive -name 'Release' -or -name 'InRelease' | xargs rm -f
52configallowinsecurerepositories "true";
7cb28948 53
7cb28948
DK
54msgtest 'Download of en as forced language' 'without Index'
55aptget update -o Acquire::Languages=en | grep -q -e 'Translation-en ' && msgpass || msgfail
56rm -rf rootdir/var/lib/apt/lists
57
58msgtest 'Download of nothing else in forced language' 'without Index'
59aptget update -o Acquire::Languages=en | grep -q -e 'Translation-[^e][^n] ' && msgfail || msgpass
60rm -rf rootdir/var/lib/apt/lists
61
62msgtest 'Download of ast_DE as forced language' 'without Index'
63aptget update -o Acquire::Languages=ast_DE | grep -q -e 'Translation-ast_DE$' && msgpass || msgfail
64rm -rf rootdir/var/lib/apt/lists
65
66msgtest 'Download of nothing else in forced language' 'without Index'
67aptget update -o Acquire::Languages=ast_DE | grep -q -e 'Translation-[^a][^s]' && msgfail || msgpass
68rm -rf rootdir/var/lib/apt/lists
69
70msgtest 'Download of nothing if none is forced' 'without Index'
71aptget update -o Acquire::Languages=none | grep -q -e 'Translation' && msgfail || msgpass
72rm -rf rootdir/var/lib/apt/lists
73
74mkdir -p rootdir/var/lib/apt/lists
75touch rootdir/var/lib/apt/lists/localhost:8080_dists_unstable_main_i18n_Translation-ast_DE
76
77msgtest 'Download of builtin files' 'without Index'
78aptget update | grep -q -e 'Translation-ast_DE' && msgpass || msgfail
79rm -rf rootdir/var/lib/apt/lists
80
81mkdir -p rootdir/var/lib/apt/lists
82touch rootdir/var/lib/apt/lists/localhost:8080_dists_unstable_main_i18n_Translation-ast_DE
83
84msgtest 'Download of nothing (even builtin) if none is forced' 'without Index'
85aptget update -o Acquire::Languages=none | grep -q -e 'Translation' && msgfail || msgpass
86rm -rf rootdir/var/lib/apt/lists