1000-external-signatures 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. #! /bin/bash
  2. #
  3. # © 2018 Ansgar Burchardt <ansgar@debian.org>
  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. shopt -s extglob
  21. . ${DAK_ROOT:?}/integration-tests/common
  22. . ${DAK_ROOT:?}/integration-tests/setup
  23. . ${DAK_ROOT:?}/integration-tests/dinstall
  24. # add a unstable suite with amd64
  25. dak admin architecture add amd64 AMD64
  26. dak admin suite add unstable "" codename=sid
  27. dak admin suite-architecture add unstable source all amd64
  28. dak admin suite-component add unstable main contrib non-free
  29. dak admin suite add-build-queue unstable buildd-unstable buildd-sid ${DAKHOST}
  30. dak admin suite-config set unstable allowcsset=yes
  31. import-fixture-signing-key
  32. packages=$(fixture-package-dir)
  33. cat >> ${DAKBASE}/etc/dak.conf <<-EOT
  34. External-Signature-Requests {
  35. Sources {
  36. linux {
  37. Packages { "linux-image-all-signed-template"; };
  38. Architectures { "all"; } ;
  39. };
  40. };
  41. Default-Suites { "unstable"; "proposed-updates"; };
  42. Export "${DAKBASE}/ftp/external-signature-requests.json";
  43. };
  44. EOT
  45. expected='
  46. {
  47. "packages": [
  48. {
  49. "suite": "unstable",
  50. "codename": "sid",
  51. "version": "42.0-1",
  52. "architecture": "all",
  53. "package": "linux-image-all-signed-template"
  54. }
  55. ]
  56. }
  57. '
  58. expected_empty='
  59. {
  60. "packages": []
  61. }
  62. '
  63. # try NEW upload
  64. (
  65. upload_changes ${packages:?}/linux_42.0-1_amd64.changes
  66. process_uploads
  67. # TODO: test upload is in NEW
  68. dak control-override -s unstable --add <<-EOT
  69. linux-image-all-signed-template optional misc
  70. linux-image-all optional misc
  71. EOT
  72. dak control-override -s unstable -t dsc --add <<-EOT
  73. linux misc
  74. EOT
  75. dak process-new --automatic
  76. dak process-policy new
  77. dak manage-external-signature-requests
  78. if ! diff -u <(jq -S . <<< "${expected}") <(jq -S . ${DAKBASE}/ftp/external-signature-requests.json); then
  79. echo >&2 "E: external-signature-requests.json differs from expected value"
  80. exit 1
  81. fi
  82. )
  83. # remove upload, should go away from external-signature-requests
  84. (
  85. dak control-suite --set unstable </dev/null
  86. dak manage-build-queues
  87. dak manage-external-signature-requests
  88. if ! diff -u <(jq -S . <<< "${expected_empty}") <(jq -S . ${DAKBASE}/ftp/external-signature-requests.json); then
  89. echo >&2 "E: external-signature-requests.json differs from expected value"
  90. exit 1
  91. fi
  92. )
  93. # try non-NEW upload
  94. (
  95. reupload_changes ${packages:?}/linux_42.0-1_amd64.changes
  96. process_uploads
  97. dak manage-external-signature-requests
  98. if ! diff -u <(jq -S . <<< "${expected}") <(jq -S . ${DAKBASE}/ftp/external-signature-requests.json); then
  99. echo >&2 "E: external-signature-requests.json differs from expected value"
  100. exit 1
  101. fi
  102. )
  103. # try upload to policy queue w/ build queue (like on security-master)
  104. (
  105. # configure a policy queue first...
  106. dak admin suite add embargoed "" codename=embargoed
  107. dak admin suite-architecture add unstable source all amd64
  108. dak admin suite-component add unstable main contrib non-free
  109. psql -1 -d projectb <<-EOT
  110. \set ON_ERROR_STOP
  111. INSERT INTO policy_queue (queue_name, path, send_to_build_queues, suite_id)
  112. VALUES ('embargoed',
  113. '${DAKBASE}/queue/embargoed',
  114. TRUE,
  115. (SELECT id FROM suite WHERE suite_name = 'embargoed'));
  116. UPDATE suite
  117. SET policy_queue_id = (SELECT id FROM policy_queue WHERE queue_name = 'embargoed')
  118. WHERE suite_name = 'unstable';
  119. EOT
  120. dak control-suite --set unstable </dev/null
  121. dak manage-build-queues
  122. reupload_changes ${packages:?}/linux_42.0-1_amd64.changes
  123. process_uploads
  124. dak manage-external-signature-requests
  125. if ! diff -u <(jq -S . <<< "${expected}") <(jq -S . ${DAKBASE}/ftp/external-signature-requests.json); then
  126. echo >&2 "E: external-signature-requests.json differs from expected value"
  127. exit 1
  128. fi
  129. commentdir=${DAKBASE}/queue/embargoed/COMMENTS
  130. mkdir -p ${commentdir}
  131. echo OK > ${commentdir}/ACCEPT.linux_42.0-1
  132. dak process-policy embargoed
  133. dak manage-external-signature-requests
  134. if ! diff -u <(jq -S . <<< "${expected}") <(jq -S . ${DAKBASE}/ftp/external-signature-requests.json); then
  135. echo >&2 "E: external-signature-requests.json differs from expected value"
  136. exit 1
  137. fi
  138. )