test-acquire-binary-all 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. #!/bin/sh
  2. set -e
  3. TESTDIR="$(readlink -f "$(dirname "$0")")"
  4. . "$TESTDIR/framework"
  5. setupenvironment
  6. configarchitecture 'amd64'
  7. buildsimplenativepackage 'foo-1' 'all' '2' 'unstable'
  8. buildsimplenativepackage 'foo-2' 'amd64' '2' 'unstable'
  9. setupaptarchive --no-update
  10. cat >rootdir/etc/apt/apt.conf.d/get-contents <<EOF
  11. Acquire::IndexTargets::deb::Contents {
  12. MetaKey "\$(COMPONENT)/Contents-\$(ARCHITECTURE)";
  13. ShortDescription "Contents";
  14. Description "\$(RELEASE)/\$(COMPONENT) \$(ARCHITECTURE) Contents";
  15. KeepCompressed "true";
  16. };
  17. EOF
  18. msgmsg 'Releasefile with Architectures field and all included'
  19. testsuccess apt update
  20. cp rootdir/tmp/testsuccess.output aptupdate.output
  21. testsuccess grep '^Get.* all Packages ' aptupdate.output
  22. testsuccess grep '^Get.* all Contents ' aptupdate.output
  23. testequal 'foo-1
  24. foo-2' aptcache pkgnames foo-
  25. listcurrentlistsdirectory > lists.before
  26. testsuccess grep '_binary-all_Packages' lists.before
  27. testsuccess grep '_Contents-all\.' lists.before
  28. configarchitecture 'amd64' 'i386'
  29. testsuccessequal "All packages are up to date.
  30. N: Skipping acquire of configured file 'main/binary-i386/Packages' as repository 'file:$(readlink -f ./aptarchive) unstable InRelease' doesn't support architecture 'i386'" apt update -o quiet::NoProgress=1
  31. testfileequal lists.before "$(listcurrentlistsdirectory)"
  32. testequal 'foo-1
  33. foo-2' aptcache pkgnames foo-
  34. rm -rf rootdir/var/lib/apt/lists
  35. msgmsg 'Releasefile has all, but forbids its usage'
  36. configarchitecture 'amd64'
  37. sed -i '/^Architectures: / a\
  38. No-Support-for-Architecture-all: Packages' $(find ./aptarchive -name 'Release')
  39. signreleasefiles
  40. testsuccess apt update
  41. cp rootdir/tmp/testsuccess.output aptupdate.output
  42. testfailure grep '^Get.* all Packages ' aptupdate.output
  43. testsuccess grep '^Get.* all Contents ' aptupdate.output
  44. sed -i '/^No-Support-for-Architecture-all: / d' $(find ./aptarchive -name 'Release')
  45. rm -rf rootdir/var/lib/apt/lists
  46. msgmsg 'Releasefile with Architectures field but without all'
  47. configarchitecture 'amd64' 'i386'
  48. getarchitecturesfromreleasefile() { echo "$(getarchitectures)"; }
  49. generatereleasefiles
  50. signreleasefiles
  51. testsuccessequal 'All packages are up to date.' apt update -o quiet::NoProgress=1
  52. cp rootdir/tmp/testsuccess.output aptupdate.output
  53. testfailure grep '^Get.* all Packages ' aptupdate.output
  54. testfailure grep '^Get.* all Contents ' aptupdate.output
  55. testequal 'foo-2' aptcache pkgnames foo-
  56. configarchitecture 'amd64'
  57. testsuccess apt update
  58. cp rootdir/tmp/testsuccess.output aptupdate.output
  59. testfailure grep '^Get.* all Packages ' aptupdate.output
  60. testfailure grep '^Get.* all Contents ' aptupdate.output
  61. testequal 'foo-2' aptcache pkgnames foo-
  62. rm -rf rootdir/var/lib/apt/lists
  63. msgmsg 'Releasefile without Architectures field'
  64. getarchitecturesfromreleasefile() { echo -n ''; }
  65. generatereleasefiles
  66. signreleasefiles
  67. testfailure grep '^Architectures: ' $(find ./aptarchive -name 'Release')
  68. testsuccess apt update
  69. cp rootdir/tmp/testsuccess.output aptupdate.output
  70. testsuccess grep '^Get.* all Packages ' aptupdate.output
  71. testsuccess grep '^Get.* all Contents ' aptupdate.output
  72. testequal 'foo-1
  73. foo-2' aptcache pkgnames foo-
  74. # apt doesn't know supported archs, so missing a configured arch is a failure
  75. configarchitecture 'amd64' 'i386'
  76. testfailure apt update
  77. testequal 'foo-1
  78. foo-2' aptcache pkgnames foo-
  79. rm -rf rootdir/var/lib/apt/lists
  80. msgmsg 'Releasefile no Architectures all, but forbids its usage'
  81. configarchitecture 'amd64'
  82. sed -i '/^Date: / a\
  83. No-Support-for-Architecture-all: Packages' $(find ./aptarchive -name 'Release')
  84. signreleasefiles
  85. testsuccess apt update
  86. cp rootdir/tmp/testsuccess.output aptupdate.output
  87. testfailure grep '^Get.* all Packages ' aptupdate.output
  88. testsuccess grep '^Get.* all Contents ' aptupdate.output
  89. sed -i '/^No-Support-for-Architecture-all: / d' $(find ./aptarchive -name 'Release')
  90. msgmsg 'No Releasefile'
  91. rm -rf rootdir/var/lib/apt/lists
  92. find aptarchive -name '*Release*' -delete
  93. configarchitecture 'amd64'
  94. testfailure apt update
  95. testwarning apt update --allow-insecure-repositories
  96. testequal 'foo-1
  97. foo-2' aptcache pkgnames foo-