X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/a1e68c33ac15be454984b00d62c7fc331bd0b32b..d3930f8716f439c229cd3d11813823d847a2ecff:/test/integration/test-bug-624218-Translation-file-handling diff --git a/test/integration/test-bug-624218-Translation-file-handling b/test/integration/test-bug-624218-Translation-file-handling index a1e708d2e..b629dd665 100755 --- a/test/integration/test-bug-624218-Translation-file-handling +++ b/test/integration/test-bug-624218-Translation-file-handling @@ -1,87 +1,105 @@ #!/bin/sh set -e -TESTDIR=$(readlink -f $(dirname $0)) -. $TESTDIR/framework +TESTDIR="$(readlink -f "$(dirname "$0")")" +. "$TESTDIR/framework" setupenvironment configarchitecture 'i386' buildsimplenativepackage 'coolstuff' 'all' '1.0' 'unstable' -setupaptarchive +setupaptarchive --no-update changetowebserver - -rm -rf rootdir/var/lib/apt/lists - -msgtest 'No download of non-existent locals' 'with Index' -LC_ALL="" aptget update -o Acquire::Languages=en | grep -q -e 'Translation-[^e][^n] ' && msgfail || msgpass -rm -rf rootdir/var/lib/apt/lists - -msgtest 'Download of existent locals' 'with Index' -LC_ALL="" aptget update | grep -q -e 'Translation-en ' && msgpass || msgfail -rm -rf rootdir/var/lib/apt/lists - -msgtest 'Download of en in LC_ALL=C' 'with Index' -LC_ALL=C aptget update | grep -q -e 'Translation-en ' && msgpass || msgfail -rm -rf rootdir/var/lib/apt/lists - -msgtest 'Download of en as forced language' 'with Index' -aptget update -o Acquire::Languages=en | grep -q -e 'Translation-en ' && msgpass || msgfail -rm -rf rootdir/var/lib/apt/lists - -msgtest 'Download of nothing else in forced language' 'with Index' -aptget update -o Acquire::Languages=en | grep -q -e 'Translation-[^e][^n] ' && msgfail || msgpass -rm -rf rootdir/var/lib/apt/lists - -msgtest 'Download no Translation- if forced language is non-existent' 'with Index' -aptget update -o Acquire::Languages=ast_DE | grep -q -e 'Translation-' && msgfail || msgpass -rm -rf rootdir/var/lib/apt/lists - -msgtest 'Download of nothing if none is forced' 'with Index' -aptget update -o Acquire::Languages=none | grep -q -e 'Translation' && msgfail || msgpass -rm -rf rootdir/var/lib/apt/lists - -sed -i '/i18n\/Index$/ d' $(find aptarchive -name 'Release') -signreleasefiles - -# we have to try as not every archive includes the i18n Index in the Release file - if it has one at all -msgtest 'Download no Translation- if forced language is non-existent' 'with not-announced Index' -aptget update -o Acquire::Languages=ast_DE | grep -q -e 'Translation-' && msgfail || msgpass rm -rf rootdir/var/lib/apt/lists -find aptarchive -name 'Index' -delete +translationslisted() { + msgtest 'No download of non-existent locals' "$1" + export LC_ALL="" + testsuccess --nomsg aptget update -o Acquire::Languages=en + testfailure grep -q -e 'Translation-[^e][^n] ' rootdir/tmp/testsuccess.output + rm -rf rootdir/var/lib/apt/lists + + msgtest 'Download of existent locals' "$1" + testsuccess --nomsg aptget update + cp rootdir/tmp/testsuccess.output testsuccess.output + testsuccess grep -q -e 'Translation-en ' testsuccess.output + rm -rf rootdir/var/lib/apt/lists + + msgtest 'Download of en in LC_ALL=C' "$1" + export LC_ALL=C + testsuccess --nomsg aptget update + cp rootdir/tmp/testsuccess.output testsuccess.output + testsuccess grep -q -e 'Translation-en ' testsuccess.output + rm -rf rootdir/var/lib/apt/lists + unset LC_ALL + + msgtest 'Download of en as forced language' "$1" + testsuccess --nomsg aptget update -o Acquire::Languages=en + cp rootdir/tmp/testsuccess.output testsuccess.output + testsuccess grep -q -e 'Translation-en ' testsuccess.output + rm -rf rootdir/var/lib/apt/lists + + msgtest 'Download of nothing else in forced language' "$1" + testsuccess --nomsg aptget update -o Acquire::Languages=en + testfailure grep -q -e 'Translation-[^e][^n] ' rootdir/tmp/testsuccess.output + rm -rf rootdir/var/lib/apt/lists + + msgtest 'Download no Translation- if forced language is non-existent' "$1" + testsuccess --nomsg aptget update -o Acquire::Languages=ast_DE + testfailure grep -q -e 'Translation-' rootdir/tmp/testsuccess.output + rm -rf rootdir/var/lib/apt/lists + + msgtest 'Download of nothing if none is forced' "$1" + testsuccess --nomsg aptget update -o Acquire::Languages=none + testfailure grep -q -e 'Translation' rootdir/tmp/testsuccess.output + rm -rf rootdir/var/lib/apt/lists +} + +translationslisted 'with full Index' + +# No Release file at all, so no records about Translation files +# (fallback to guessing) +find aptarchive \( -name 'Release' -o -name 'InRelease' \) -delete +echo 'Acquire::AllowInsecureRepositories "true";' > rootdir/etc/apt/apt.conf.d/allow-insecure-repositories.conf msgtest 'Download of en as forced language' 'without Index' -aptget update -o Acquire::Languages=en | grep -q -e 'Translation-en ' && msgpass || msgfail +testwarning --nomsg aptget update -o Acquire::Languages=en +testsuccess grep -q -e 'Translation-en ' rootdir/tmp/testwarning.output rm -rf rootdir/var/lib/apt/lists msgtest 'Download of nothing else in forced language' 'without Index' -aptget update -o Acquire::Languages=en | grep -q -e 'Translation-[^e][^n] ' && msgfail || msgpass +testwarning --nomsg aptget update -o Acquire::Languages=en +testfailure grep -q -e 'Translation-[^e][^n] ' rootdir/tmp/testwarning.output rm -rf rootdir/var/lib/apt/lists msgtest 'Download of ast_DE as forced language' 'without Index' -aptget update -o Acquire::Languages=ast_DE | grep -q -e 'Translation-ast_DE$' && msgpass || msgfail +testwarning --nomsg aptget update -o Acquire::Languages=ast_DE +testsuccess grep -q -e 'Translation-ast_DE$' rootdir/tmp/testwarning.output rm -rf rootdir/var/lib/apt/lists msgtest 'Download of nothing else in forced language' 'without Index' -aptget update -o Acquire::Languages=ast_DE | grep -q -e 'Translation-[^a][^s]' && msgfail || msgpass +testwarning --nomsg aptget update -o Acquire::Languages=ast_DE +testfailure grep -q -e 'Translation-[^a][^s]' rootdir/tmp/testwarning.output rm -rf rootdir/var/lib/apt/lists msgtest 'Download of nothing if none is forced' 'without Index' -aptget update -o Acquire::Languages=none | grep -q -e 'Translation' && msgfail || msgpass +testwarning --nomsg aptget update -o Acquire::Languages=none +testfailure grep -q -e 'Translation' rootdir/tmp/testwarning.output rm -rf rootdir/var/lib/apt/lists mkdir -p rootdir/var/lib/apt/lists -touch rootdir/var/lib/apt/lists/localhost:8080_dists_unstable_main_i18n_Translation-ast_DE +touch rootdir/var/lib/apt/lists/localhost:${APTHTTPPORT}_dists_unstable_main_i18n_Translation-ast_DE msgtest 'Download of builtin files' 'without Index' -aptget update | grep -q -e 'Translation-ast_DE' && msgpass || msgfail +testwarning --nomsg aptget update +testsuccess grep -q -e 'Translation-ast_DE' rootdir/tmp/testwarning.output rm -rf rootdir/var/lib/apt/lists mkdir -p rootdir/var/lib/apt/lists -touch rootdir/var/lib/apt/lists/localhost:8080_dists_unstable_main_i18n_Translation-ast_DE +touch rootdir/var/lib/apt/lists/localhost:${APTHTTPPORT}_dists_unstable_main_i18n_Translation-ast_DE msgtest 'Download of nothing (even builtin) if none is forced' 'without Index' -aptget update -o Acquire::Languages=none | grep -q -e 'Translation' && msgfail || msgpass +testwarning --nomsg aptget update -o Acquire::Languages=none +testfailure grep -q -e 'Translation' rootdir/tmp/testwarning.output rm -rf rootdir/var/lib/apt/lists