test-sourceslist-lang-plusminus-options 3.7 KB

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