You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

test-sourceslist-target-plusminus-options 6.2 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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. Acquire::IndexTargets::deb::Contents2 {
  27. MetaKey "Contents-\$(ARCHITECTURE)";
  28. ShortDescription "Contents2";
  29. Description "\$(RELEASE) \$(ARCHITECTURE) Contents2";
  30. Fallback-Of "Contents";
  31. Identifier "Contents";
  32. };
  33. EOF
  34. echo 'deb http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
  35. testtargets 'default + Contents' 'Packages' 'Translations' 'Contents' 'Contents2'
  36. echo 'deb [target=Packages] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
  37. testtargets 'force Packages target' 'Packages'
  38. echo 'deb [target=Contents] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
  39. testtargets 'force Contents target' 'Contents'
  40. echo 'deb [target=Translations,Contents] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
  41. testtargets 'force two targets' 'Contents' 'Translations'
  42. echo 'deb [target+=Translations,Contents] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
  43. testtargets 'add existing' 'Packages' 'Contents' 'Translations' 'Contents2'
  44. echo 'deb [target+=AppStream] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
  45. testtargets 'add non-existing' 'Packages' 'Contents' 'Translations' 'Contents2'
  46. echo 'deb [target-=Translations,Contents] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
  47. testtargets 'remove existing' 'Packages' 'Contents2'
  48. echo 'deb [target-=AppStream] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
  49. testtargets 'remove non-existing' 'Packages' 'Contents' 'Translations' 'Contents2'
  50. echo 'deb [AppStream=yes] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
  51. testtargets 'activate non-existing' 'Packages' 'Contents' 'Translations' 'Contents2'
  52. echo 'deb [AppStream=no] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
  53. testtargets 'deactivate non-existing' 'Packages' 'Contents' 'Translations' 'Contents2'
  54. echo 'deb [Contents=yes] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
  55. testtargets 'activate existing' 'Packages' 'Contents' 'Contents2' 'Translations'
  56. echo 'deb [Contents=no] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
  57. testtargets 'deactivate existing' 'Packages' 'Translations'
  58. echo 'deb [target=Packages Contents=yes] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
  59. testtargets 'explicit + activate' 'Packages' 'Contents' 'Contents2'
  60. echo 'deb [Contents=yes,target+=Contents] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
  61. testtargets 'duplications are okay' 'Packages' 'Translations' 'Contents' 'Contents2'
  62. msgmsg 'Contents NOT as a default target (but Contents2)'
  63. echo 'Acquire::IndexTargets::deb::Contents::DefaultEnabled "no";' > rootdir/etc/apt/apt.conf.d/content-target-notdefault.conf
  64. echo 'deb http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
  65. testtargets 'default + Contents' 'Packages' 'Translations' 'Contents2'
  66. echo 'deb [target=Packages] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
  67. testtargets 'force Packages target' 'Packages'
  68. echo 'deb [target=Contents] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
  69. testtargets 'force Contents target' 'Contents'
  70. echo 'deb [target=Translations,Contents] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
  71. testtargets 'force two targets' 'Contents' 'Translations'
  72. echo 'deb [target+=Translations,Contents] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
  73. testtargets 'add existing' 'Packages' 'Contents' 'Translations' 'Contents2'
  74. echo 'deb [target+=AppStream] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
  75. testtargets 'add non-existing' 'Packages' 'Translations' 'Contents2'
  76. echo 'deb [target-=Translations,Contents] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
  77. testtargets 'remove existing' 'Packages' 'Contents2'
  78. echo 'deb [target-=AppStream] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
  79. testtargets 'remove non-existing' 'Packages' 'Translations' 'Contents2'
  80. echo 'deb [AppStream=yes] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
  81. testtargets 'activate non-existing' 'Packages' 'Translations' 'Contents2'
  82. echo 'deb [AppStream=no] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
  83. testtargets 'deactivate non-existing' 'Packages' 'Translations' 'Contents2'
  84. echo 'deb [Contents=yes] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
  85. testtargets 'activate existing' 'Packages' 'Contents' 'Contents2' 'Translations'
  86. echo 'deb [Contents=no] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
  87. testtargets 'deactivate existing' 'Packages' 'Translations'
  88. echo 'deb [target=Packages Contents=yes] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
  89. testtargets 'explicit + activate' 'Packages' 'Contents' 'Contents2'
  90. echo 'deb [Contents=yes,target+=Contents] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
  91. testtargets 'duplications are okay' 'Packages' 'Translations' 'Contents' 'Contents2'
  92. # we can't check if it really reorders here
  93. echo 'deb [target+=Contents2,Contents] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
  94. testtargets 'reordered fallback order' 'Packages' 'Translations' 'Contents' 'Contents2'