use 'best' hash for source authentication
[ntk/apt.git] / test / integration / test-bug-624218-Translation-file-handling
index a1e708d..d3c5b08 100755 (executable)
@@ -14,43 +14,49 @@ 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
+translationslisted() {
+       msgtest 'No download of non-existent locals' "$1"
+       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 existent locals' "$1"
+       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 in LC_ALL=C' "$1"
+       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 en as forced language' "$1"
+       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 of nothing else in forced language' "$1"
+       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 no Translation- if forced language is non-existent' "$1"
+       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' "$1"
+       aptget update -o Acquire::Languages=none | grep -q -e 'Translation' && msgfail || msgpass
+       rm -rf rootdir/var/lib/apt/lists
+}
+
+translationslisted 'with full Index'
 
-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')
+# only compressed files available (as it happens on CD-ROM)
+sed -i '/i18n\/Translation-[^.]*$/ 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
+translationslisted 'with partial Index'
+
 
-find aptarchive -name 'Index' -delete
+# no records at all about Translation files (fallback to guessing)
+sed -i '/i18n\/Translation-.*$/ d' $(find aptarchive -name 'Release')
+signreleasefiles
 
 msgtest 'Download of en as forced language' 'without Index'
 aptget update -o Acquire::Languages=en | grep -q -e 'Translation-en ' && msgpass || msgfail