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.
 
 
 
 
 
 

143 lines
5.7 KiB

  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. cp -a rootdir/etc/apt/sources.list.d rootdir/etc/apt/sources.list.d.bak
  19. msgmsg 'Releasefile with Architectures field and all included'
  20. testsuccess apt update
  21. cp rootdir/tmp/testsuccess.output aptupdate.output
  22. testsuccess grep '^Get.* all Packages ' aptupdate.output
  23. testsuccess grep '^Get.* all Contents ' aptupdate.output
  24. testequal 'foo-1
  25. foo-2' aptcache pkgnames foo-
  26. listcurrentlistsdirectory > lists.before
  27. testsuccess grep '_binary-all_Packages' lists.before
  28. testsuccess grep '_Contents-all\.' lists.before
  29. configarchitecture 'amd64' 'i386'
  30. testsuccessequal "All packages are up to date.
  31. 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
  32. testfileequal lists.before "$(listcurrentlistsdirectory)"
  33. testequal 'foo-1
  34. foo-2' aptcache pkgnames foo-
  35. rm -rf rootdir/var/lib/apt/lists
  36. msgmsg 'Releasefile with Architectures field and all included, but arch-=all'
  37. sed -i 's#^deb\(-src\)\? #deb\1 [arch-=all] #' rootdir/etc/apt/sources.list.d/*
  38. testsuccesswithnotice apt update
  39. cp -a rootdir/etc/apt/sources.list.d.bak/* rootdir/etc/apt/sources.list.d/
  40. cp rootdir/tmp/testsuccess.output aptupdate.output
  41. testfailure grep '^Get.* all Packages ' aptupdate.output
  42. testfailure grep '^Get.* all Contents ' aptupdate.output
  43. testequal 'foo-2' aptcache pkgnames foo-
  44. rm -rf rootdir/var/lib/apt/lists
  45. msgmsg 'Releasefile has all, but forbids its usage'
  46. configarchitecture 'amd64'
  47. sed -i '/^Architectures: / a\
  48. No-Support-for-Architecture-all: Packages' $(find ./aptarchive -name 'Release')
  49. signreleasefiles
  50. testsuccess apt update
  51. cp rootdir/tmp/testsuccess.output aptupdate.output
  52. testfailure grep '^Get.* all Packages ' aptupdate.output
  53. testsuccess grep '^Get.* all Contents ' aptupdate.output
  54. sed -i '/^No-Support-for-Architecture-all: / d' $(find ./aptarchive -name 'Release')
  55. rm -rf rootdir/var/lib/apt/lists
  56. msgmsg 'Releasefile has all, forbids its usage, but it is forced with arch=all'
  57. sed -i 's#^deb\(-src\)\? #deb\1 [arch=all] #' rootdir/etc/apt/sources.list.d/*
  58. testsuccess apt update
  59. cp -a rootdir/etc/apt/sources.list.d.bak/* rootdir/etc/apt/sources.list.d/
  60. cp rootdir/tmp/testsuccess.output aptupdate.output
  61. testsuccess grep '^Get.* all Packages ' aptupdate.output
  62. testsuccess grep '^Get.* all Contents ' aptupdate.output
  63. testequal 'foo-1' aptcache pkgnames foo-
  64. rm -rf rootdir/var/lib/apt/lists
  65. msgmsg 'Releasefile with Architectures field but without all'
  66. configarchitecture 'amd64' 'i386'
  67. getarchitecturesfromreleasefile() { echo "$(getarchitectures)"; }
  68. generatereleasefiles
  69. signreleasefiles
  70. testsuccessequal 'All packages are up to date.' apt update -o quiet::NoProgress=1
  71. cp rootdir/tmp/testsuccess.output aptupdate.output
  72. testfailure grep '^Get.* all Packages ' aptupdate.output
  73. testfailure grep '^Get.* all Contents ' aptupdate.output
  74. testequal 'foo-2' aptcache pkgnames foo-
  75. configarchitecture 'amd64'
  76. testsuccess apt update
  77. cp rootdir/tmp/testsuccess.output aptupdate.output
  78. testfailure grep '^Get.* all Packages ' aptupdate.output
  79. testfailure grep '^Get.* all Contents ' aptupdate.output
  80. testequal 'foo-2' aptcache pkgnames foo-
  81. rm -rf rootdir/var/lib/apt/lists
  82. msgmsg 'Releasefile with Architectures field but without all forced with arch+=all'
  83. sed -i 's#^deb\(-src\)\? #deb\1 [arch+=all] #' rootdir/etc/apt/sources.list.d/*
  84. testsuccess apt update
  85. cp -a rootdir/etc/apt/sources.list.d.bak/* rootdir/etc/apt/sources.list.d/
  86. cp rootdir/tmp/testsuccess.output aptupdate.output
  87. testsuccess grep '^Get.* all Packages ' aptupdate.output
  88. testsuccess grep '^Get.* all Contents ' aptupdate.output
  89. testequal 'foo-1
  90. foo-2' aptcache pkgnames foo-
  91. rm -rf rootdir/var/lib/apt/lists
  92. msgmsg 'Releasefile without Architectures field'
  93. getarchitecturesfromreleasefile() { echo -n ''; }
  94. generatereleasefiles
  95. signreleasefiles
  96. testfailure grep '^Architectures: ' $(find ./aptarchive -name 'Release')
  97. testsuccess apt update
  98. cp rootdir/tmp/testsuccess.output aptupdate.output
  99. testsuccess grep '^Get.* all Packages ' aptupdate.output
  100. testsuccess grep '^Get.* all Contents ' aptupdate.output
  101. testequal 'foo-1
  102. foo-2' aptcache pkgnames foo-
  103. # apt doesn't know supported archs, so missing a configured arch is a problem
  104. configarchitecture 'amd64' 'i386'
  105. testwarningmsg "W: Skipping acquire of configured file 'main/binary-i386/Packages' as repository 'file:$(readlink -f ./aptarchive) unstable InRelease' does not seem to provide it (sources.list entry misspelt?)" apt update
  106. testequal 'foo-1
  107. foo-2' aptcache pkgnames foo-
  108. rm -rf rootdir/var/lib/apt/lists
  109. msgmsg 'Releasefile no Architectures all, but forbids its usage'
  110. configarchitecture 'amd64'
  111. sed -i '/^Date: / a\
  112. No-Support-for-Architecture-all: Packages' $(find ./aptarchive -name 'Release')
  113. signreleasefiles
  114. testsuccess apt update
  115. cp rootdir/tmp/testsuccess.output aptupdate.output
  116. testfailure grep '^Get.* all Packages ' aptupdate.output
  117. testsuccess grep '^Get.* all Contents ' aptupdate.output
  118. sed -i '/^No-Support-for-Architecture-all: / d' $(find ./aptarchive -name 'Release')
  119. msgmsg 'No Releasefile'
  120. rm -rf rootdir/var/lib/apt/lists
  121. find aptarchive -name '*Release*' -delete
  122. configarchitecture 'amd64'
  123. testfailure apt update
  124. testwarning apt update --allow-insecure-repositories
  125. testequal 'foo-1
  126. foo-2' aptcache pkgnames foo-