test-sourceslist-target-plusminus-options 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. #!/bin/sh
  2. set -e
  3. TESTDIR="$(readlink -f "$(dirname "$0")")"
  4. . "$TESTDIR/framework"
  5. setupenvironment
  6. configarchitecture 'amd64'
  7. testtargets() {
  8. msgtest 'Test acquired targets for' "$1"
  9. shift
  10. while [ -n "$1" ]; do
  11. echo "$1"
  12. shift
  13. done | sort -u > expectedtargets.lst
  14. aptget indextargets --no-release-info --format='$(CREATED_BY)' | sort -u > gottargets.lst
  15. testfileequal --nomsg ./expectedtargets.lst "$(cat ./gottargets.lst)"
  16. }
  17. echo 'deb http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
  18. testtargets 'default' 'Packages' 'Translations'
  19. msgmsg 'Contents as a default target'
  20. cat > rootdir/etc/apt/apt.conf.d/content-target.conf <<EOF
  21. Acquire::IndexTargets::deb::Contents {
  22. MetaKey "\$(COMPONENT)/Contents-\$(ARCHITECTURE)";
  23. ShortDescription "Contents";
  24. Description "\$(RELEASE)/\$(COMPONENT) \$(ARCHITECTURE) Contents";
  25. };
  26. EOF
  27. echo 'deb http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
  28. testtargets 'default + Contents' 'Packages' 'Translations' 'Contents'
  29. echo 'deb [target=Packages] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
  30. testtargets 'force Packages target' 'Packages'
  31. echo 'deb [target=Contents] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
  32. testtargets 'force Contents target' 'Contents'
  33. echo 'deb [target=Translations,Contents] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
  34. testtargets 'force two targets' 'Contents' 'Translations'
  35. echo 'deb [target+=Translations,Contents] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
  36. testtargets 'add existing' 'Packages' 'Contents' 'Translations'
  37. echo 'deb [target+=AppStream] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
  38. testtargets 'add non-existing' 'Packages' 'Contents' 'Translations'
  39. echo 'deb [target-=Translations,Contents] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
  40. testtargets 'remove existing' 'Packages'
  41. echo 'deb [target-=AppStream] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
  42. testtargets 'remove non-existing' 'Packages' 'Contents' 'Translations'
  43. echo 'deb [AppStream=yes] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
  44. testtargets 'activate non-existing' 'Packages' 'Contents' 'Translations'
  45. echo 'deb [AppStream=no] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
  46. testtargets 'deactivate non-existing' 'Packages' 'Contents' 'Translations'
  47. echo 'deb [Contents=yes] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
  48. testtargets 'activate existing' 'Packages' 'Contents' 'Translations'
  49. echo 'deb [Contents=no] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
  50. testtargets 'deactivate existing' 'Packages' 'Translations'
  51. echo 'deb [target=Packages Contents=yes] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
  52. testtargets 'explicit + activate' 'Packages' 'Contents'
  53. msgmsg 'Contents NOT as a default target'
  54. echo 'Acquire::IndexTargets::deb::Contents::DefaultEnabled "no";' > rootdir/etc/apt/apt.conf.d/content-target-notdefault.conf
  55. echo 'deb http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
  56. testtargets 'default + Contents' 'Packages' 'Translations'
  57. echo 'deb [target=Packages] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
  58. testtargets 'force Packages target' 'Packages'
  59. echo 'deb [target=Contents] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
  60. testtargets 'force Contents target' 'Contents'
  61. echo 'deb [target=Translations,Contents] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
  62. testtargets 'force two targets' 'Contents' 'Translations'
  63. echo 'deb [target+=Translations,Contents] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
  64. testtargets 'add existing' 'Packages' 'Contents' 'Translations'
  65. echo 'deb [target+=AppStream] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
  66. testtargets 'add non-existing' 'Packages' 'Translations'
  67. echo 'deb [target-=Translations,Contents] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
  68. testtargets 'remove existing' 'Packages'
  69. echo 'deb [target-=AppStream] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
  70. testtargets 'remove non-existing' 'Packages' 'Translations'
  71. echo 'deb [AppStream=yes] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
  72. testtargets 'activate non-existing' 'Packages' 'Translations'
  73. echo 'deb [AppStream=no] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
  74. testtargets 'deactivate non-existing' 'Packages' 'Translations'
  75. echo 'deb [Contents=yes] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
  76. testtargets 'activate existing' 'Packages' 'Contents' 'Translations'
  77. echo 'deb [Contents=no] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
  78. testtargets 'deactivate existing' 'Packages' 'Translations'
  79. echo 'deb [target=Packages Contents=yes] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
  80. testtargets 'explicit + activate' 'Packages' 'Contents'