2004-contents-all 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. #! /bin/bash
  2. #
  3. # © 2019 Niels Thykier <niels@thykier.net>
  4. # License: GPL-2+
  5. #
  6. # This program is free software; you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation; either version 2 of the License, or
  9. # (at your option) any later version.
  10. #
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program. If not, see <https://www.gnu.org/licenses/>.
  18. set -e
  19. set -u
  20. . ${DAK_ROOT:?}/integration-tests/common
  21. . ${DAK_ROOT:?}/integration-tests/setup
  22. . ${DAK_ROOT:?}/integration-tests/dinstall
  23. echo "Dinstall::AllowSourceOnlyUploads true;" >> ${DAKBASE}/etc/dak.conf
  24. setup_debian_like_archive
  25. import-fixture-signing-key
  26. dak admin suite-config set unstable separate_contents_architecture_all=no
  27. (
  28. packages=$(fixture-package-dir)
  29. upload_changes ${packages:?}/binnmupkg_0.1-1_amd64.changes
  30. upload_changes ${packages:?}/package_0.1-1_amd64.changes
  31. # Will be accepted later
  32. upload_changes ${packages:?}/package-built-using_0.1-1_amd64.changes
  33. process_uploads
  34. )
  35. # Accept the package from NEW
  36. (
  37. dak control-overrides -s unstable -t deb -a << EOF
  38. package required admin
  39. binnmupkg optional misc
  40. EOF
  41. dak control-overrides -s unstable -t dsc -a << EOF
  42. package admin
  43. binnmupkg misc
  44. EOF
  45. echo a | dak process-new binnmupkg_0.1-1_amd64.changes
  46. echo a | dak process-new package_0.1-1_amd64.changes
  47. # package-built-using_0.1-1_amd64.changes is for later
  48. dak process-new --automatic
  49. dak process-policy new
  50. )
  51. (
  52. dak contents scan-binary
  53. dak contents scan-source
  54. )
  55. # After running dinstall, the package should now be present in the pool
  56. dinstall
  57. ls -l ${DAKBASE}/ftp-master/pool/main/p/package/package_*.dsc
  58. ls -l ${DAKBASE}/ftp-master/pool/main/b/binnmupkg/binnmupkg_*.dsc
  59. # Also, they should be listed in the Contents-amd64
  60. zgrep usr/share/doc/package/changelog.Debian.gz ${DAKBASE}/ftp-master/dists/unstable/main/Contents-amd64.gz
  61. zgrep usr/share/doc/binnmupkg/changelog.Debian.gz ${DAKBASE}/ftp-master/dists/unstable/main/Contents-amd64.gz
  62. # The Architectures field in Release must NOT contain all at this point
  63. if [ ! -f "${DAKBASE}/ftp-master/dists/unstable/Release" ]; then
  64. echo "Release file is missing!?"
  65. exit 1
  66. fi
  67. if grep ^Architectures: ${DAKBASE}/ftp-master/dists/unstable/Release | grep 'all'; then
  68. echo "Release should not have arch:all in Architectures at this point"
  69. exit 1
  70. fi
  71. if grep ^No-Support-for-Architecture-all ${DAKBASE}/ftp-master/dists/unstable/Release; then
  72. echo "Release should not have No-Support-for-Architecture-all at this point"
  73. exit 1
  74. fi
  75. # Retry with separate arch:all Contents
  76. echo "Ok; creating separate architecture all Contents"
  77. dak admin suite-config set unstable separate_contents_architecture_all=yes
  78. # Regenerate to move things around
  79. dak generate-packages-sources2 -a "${public_archives[*]}"
  80. dak contents generate -a "${public_archives[*]}"
  81. dak generate-index-diffs -d "${pdiff_tempdir}" -a "${public_archives[*]}"
  82. dak generate-releases -a "${public_archives[*]}"
  83. # Also, they should be listed in the Contents-amd64
  84. echo "Checking that the data in the Contents are cleanly split as expected"
  85. if zgrep usr/share/doc/package/changelog.Debian.gz ${DAKBASE}/ftp-master/dists/unstable/main/Contents-amd64.gz ; then
  86. echo "Contents-amd64 should NOT have arch:all contents anymore"
  87. exit 1
  88. fi
  89. zgrep usr/share/doc/binnmupkg/changelog.Debian.gz ${DAKBASE}/ftp-master/dists/unstable/main/Contents-amd64.gz
  90. zgrep usr/share/doc/package/changelog.Debian.gz ${DAKBASE}/ftp-master/dists/unstable/main/Contents-all.gz
  91. # The Architectures field in Release must NOT contain all at this point
  92. if [ ! -f "${DAKBASE}/ftp-master/dists/unstable/Release" ]; then
  93. echo "Release file is missing!?"
  94. exit 1
  95. fi
  96. if grep ^Architectures: ${DAKBASE}/ftp-master/dists/unstable/Release | grep 'all'; then
  97. : # ok
  98. else
  99. echo "Release must have arch:all in Architectures at this point"
  100. exit 1
  101. fi
  102. if ! grep ^No-Support-for-Architecture-all ${DAKBASE}/ftp-master/dists/unstable/Release; then
  103. echo "Release must have No-Support-for-Architecture-all at this point"
  104. exit 1
  105. fi
  106. # Upload another arch:all packages to ensure the change also causes a PDiff
  107. (
  108. dak control-overrides -s unstable -t deb -a << EOF
  109. package-built-using optional misc
  110. EOF
  111. dak control-overrides -s unstable -t dsc -a << EOF
  112. package-built-using misc
  113. EOF
  114. echo a | dak process-new package-built-using_0.1-1_amd64.changes
  115. dak process-new --automatic
  116. dak process-policy new
  117. dak contents scan-binary
  118. dak contents scan-source
  119. )
  120. # Regenerate to create PDiffs
  121. dak generate-packages-sources2 -a "${public_archives[*]}"
  122. dak contents generate -a "${public_archives[*]}"
  123. dak generate-index-diffs -d "${pdiff_tempdir}" -a "${public_archives[*]}"
  124. dak generate-releases -a "${public_archives[*]}"
  125. echo "There should be a PDiff for Contents-all"
  126. ls -l ${DAKBASE}/ftp-master/dists/unstable/main/Contents-all.diff
  127. echo "Checking that the data in the Contents are cleanly split as expected"
  128. if zgrep usr/share/doc/package/changelog.Debian.gz ${DAKBASE}/ftp-master/dists/unstable/main/Contents-amd64.gz ; then
  129. echo "Contents-amd64 should NOT have arch:all contents anymore"
  130. exit 1
  131. fi
  132. zgrep usr/share/doc/binnmupkg/changelog.Debian.gz ${DAKBASE}/ftp-master/dists/unstable/main/Contents-amd64.gz
  133. zgrep usr/share/doc/package/changelog.Debian.gz ${DAKBASE}/ftp-master/dists/unstable/main/Contents-all.gz
  134. zgrep usr/share/doc/package/changelog.Debian.gz ${DAKBASE}/ftp-master/dists/unstable/main/Contents-all.gz
  135. # The Architectures field in Release must NOT contain all at this point
  136. if [ ! -f "${DAKBASE}/ftp-master/dists/unstable/Release" ]; then
  137. echo "Release file is missing!?"
  138. exit 1
  139. fi
  140. if grep ^Architectures: ${DAKBASE}/ftp-master/dists/unstable/Release | grep 'all'; then
  141. : # ok
  142. else
  143. echo "Release must have arch:all in Architectures at this point"
  144. exit 1
  145. fi
  146. if ! grep ^No-Support-for-Architecture-all ${DAKBASE}/ftp-master/dists/unstable/Release; then
  147. echo "Release must have No-Support-for-Architecture-all at this point"
  148. exit 1
  149. fi
  150. echo "Published successfully"