test-bug-624218-Translation-file-handling 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. #!/bin/sh
  2. set -e
  3. TESTDIR=$(readlink -f $(dirname $0))
  4. . $TESTDIR/framework
  5. setupenvironment
  6. configarchitecture 'i386'
  7. buildsimplenativepackage 'coolstuff' 'all' '1.0' 'unstable'
  8. setupaptarchive
  9. changetowebserver
  10. rm -rf rootdir/var/lib/apt/lists
  11. translationslisted() {
  12. msgtest 'No download of non-existent locals' "$1"
  13. LC_ALL="" aptget update -o Acquire::Languages=en | grep -q -e 'Translation-[^e][^n] ' && msgfail || msgpass
  14. rm -rf rootdir/var/lib/apt/lists
  15. msgtest 'Download of existent locals' "$1"
  16. LC_ALL="" aptget update | grep -q -e 'Translation-en ' && msgpass || msgfail
  17. rm -rf rootdir/var/lib/apt/lists
  18. msgtest 'Download of en in LC_ALL=C' "$1"
  19. LC_ALL=C aptget update | grep -q -e 'Translation-en ' && msgpass || msgfail
  20. rm -rf rootdir/var/lib/apt/lists
  21. msgtest 'Download of en as forced language' "$1"
  22. aptget update -o Acquire::Languages=en | grep -q -e 'Translation-en ' && msgpass || msgfail
  23. rm -rf rootdir/var/lib/apt/lists
  24. msgtest 'Download of nothing else in forced language' "$1"
  25. aptget update -o Acquire::Languages=en | grep -q -e 'Translation-[^e][^n] ' && msgfail || msgpass
  26. rm -rf rootdir/var/lib/apt/lists
  27. msgtest 'Download no Translation- if forced language is non-existent' "$1"
  28. aptget update -o Acquire::Languages=ast_DE | grep -q -e 'Translation-' && msgfail || msgpass
  29. rm -rf rootdir/var/lib/apt/lists
  30. msgtest 'Download of nothing if none is forced' "$1"
  31. aptget update -o Acquire::Languages=none | grep -q -e 'Translation' && msgfail || msgpass
  32. rm -rf rootdir/var/lib/apt/lists
  33. }
  34. translationslisted 'with full Index'
  35. # only compressed files available (as it happens on CD-ROM)
  36. sed -i '/i18n\/Translation-[^.]*$/ d' $(find aptarchive -name 'Release')
  37. signreleasefiles
  38. translationslisted 'with partial Index'
  39. # no records at all about Translation files (fallback to guessing)
  40. sed -i '/i18n\/Translation-.*$/ d' $(find aptarchive -name 'Release')
  41. signreleasefiles
  42. msgtest 'Download of en as forced language' 'without Index'
  43. aptget update -o Acquire::Languages=en | grep -q -e 'Translation-en ' && msgpass || msgfail
  44. rm -rf rootdir/var/lib/apt/lists
  45. msgtest 'Download of nothing else in forced language' 'without Index'
  46. aptget update -o Acquire::Languages=en | grep -q -e 'Translation-[^e][^n] ' && msgfail || msgpass
  47. rm -rf rootdir/var/lib/apt/lists
  48. msgtest 'Download of ast_DE as forced language' 'without Index'
  49. aptget update -o Acquire::Languages=ast_DE | grep -q -e 'Translation-ast_DE$' && msgpass || msgfail
  50. rm -rf rootdir/var/lib/apt/lists
  51. msgtest 'Download of nothing else in forced language' 'without Index'
  52. aptget update -o Acquire::Languages=ast_DE | grep -q -e 'Translation-[^a][^s]' && msgfail || msgpass
  53. rm -rf rootdir/var/lib/apt/lists
  54. msgtest 'Download of nothing if none is forced' 'without Index'
  55. aptget update -o Acquire::Languages=none | grep -q -e 'Translation' && msgfail || msgpass
  56. rm -rf rootdir/var/lib/apt/lists
  57. mkdir -p rootdir/var/lib/apt/lists
  58. touch rootdir/var/lib/apt/lists/localhost:8080_dists_unstable_main_i18n_Translation-ast_DE
  59. msgtest 'Download of builtin files' 'without Index'
  60. aptget update | grep -q -e 'Translation-ast_DE' && msgpass || msgfail
  61. rm -rf rootdir/var/lib/apt/lists
  62. mkdir -p rootdir/var/lib/apt/lists
  63. touch rootdir/var/lib/apt/lists/localhost:8080_dists_unstable_main_i18n_Translation-ast_DE
  64. msgtest 'Download of nothing (even builtin) if none is forced' 'without Index'
  65. aptget update -o Acquire::Languages=none | grep -q -e 'Translation' && msgfail || msgpass
  66. rm -rf rootdir/var/lib/apt/lists