0002-basic-c-s 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  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. import-fixture-signing-key
  23. # add a unstable suite with amd64
  24. dak admin architecture add amd64 AMD64
  25. dak admin suite add unstable "" codename=sid
  26. dak admin suite-architecture add unstable source all amd64
  27. dak admin suite-component add unstable main contrib non-free
  28. dak admin suite add testing "" codename=buster
  29. dak admin suite-architecture add testing source all amd64
  30. dak admin suite-component add testing main contrib non-free
  31. assert-control-suite-list() {
  32. local suite="$1" expected="$2"
  33. actual=$(dak control-suite --list="${suite}")
  34. assert-equal "dak control-suite --list=${suite}" "${actual}" "${expected}"
  35. }
  36. (
  37. dak control-overrides -s unstable -t deb -a << EOF
  38. package required admin
  39. EOF
  40. dak control-overrides -s unstable -t dsc -a << EOF
  41. package admin
  42. EOF
  43. )
  44. (
  45. packages=$(fixture-package-dir)
  46. cp ${packages:?}/package_0.1* ${DAKBASE}/tmp
  47. dak process-upload -d ${DAKBASE}/tmp --automatic
  48. )
  49. # unstable should have 0.1
  50. (
  51. expected="$(cat <<EOF
  52. package 0.1-1 all
  53. package 0.1-1 source
  54. EOF
  55. )"
  56. assert-control-suite-list unstable "${expected}"
  57. )
  58. # testing should be empty
  59. (
  60. expected=""
  61. assert-control-suite-list testing "${expected}"
  62. )
  63. # dak ls test just for the sake for it
  64. (
  65. expected="$(cat <<EOF
  66. package | 0.1-1 | unstable | source, all
  67. EOF
  68. )"
  69. actual=$(dak ls -S -s unstable package)
  70. assert-equal "dak ls -S -s unstable -f=control-suite package" "${actual}" "${expected}"
  71. )
  72. # Move package 0.1 to testing
  73. (
  74. dak control-suite --list=unstable | dak control-suite --add=testing
  75. actual=$(dak control-suite --list=testing)
  76. expected=$(dak control-suite --list=unstable)
  77. assert-equal "dak control-suite --list=testing" "${actual}" "${expected}"
  78. )
  79. (
  80. dak contents scan-binary
  81. dak contents scan-source
  82. dak generate-packages-sources2 -s unstable
  83. dak contents generate -a dak-master -s unstable
  84. # TODO: make this work in the CI; needs GnuPG key
  85. #dak generate-release -s unstable
  86. )
  87. (
  88. packages=$(fixture-package-dir)
  89. cp ${packages:?}/package_0.2* ${DAKBASE}/tmp
  90. dak process-upload -d ${DAKBASE}/tmp --automatic
  91. )
  92. # unstable currently has both and control-suite should confirm this
  93. (
  94. expected="$(cat <<EOF
  95. package 0.1-1 all
  96. package 0.2-1 all
  97. package 0.1-1 source
  98. package 0.2-1 source
  99. EOF
  100. )"
  101. assert-control-suite-list unstable "${expected}"
  102. )
  103. # testing should be unchanged (i.e. only have 0.1)
  104. (
  105. expected="$(cat <<EOF
  106. package 0.1-1 all
  107. package 0.1-1 source
  108. EOF
  109. )"
  110. assert-control-suite-list testing "${expected}"
  111. )
  112. # dak ls run just for the sake of it
  113. (
  114. expected="$(cat <<EOF
  115. package | 0.1-1 | unstable | source, all
  116. package | 0.2-1 | unstable | source, all
  117. EOF
  118. )"
  119. actual=$(dak ls -S -s unstable package)
  120. assert-equal "dak ls -S -s unstable -f=control-suite package" "${actual}" "${expected}"
  121. )
  122. # Clean up unstable
  123. (
  124. dak dominate
  125. )
  126. # unstable now only has version 0.2
  127. (
  128. expected="$(cat <<EOF
  129. package 0.2-1 all
  130. package 0.2-1 source
  131. EOF
  132. )"
  133. assert-control-suite-list unstable "${expected}"
  134. )
  135. # testing still has version 0.1
  136. (
  137. expected="$(cat <<EOF
  138. package 0.1-1 all
  139. package 0.1-1 source
  140. EOF
  141. )"
  142. assert-control-suite-list testing "${expected}"
  143. )
  144. # dak ls run just for the sake of it
  145. (
  146. expected="$(cat <<EOF
  147. package | 0.2-1 | unstable | source, all
  148. EOF
  149. )"
  150. actual=$(dak ls -S -s unstable package)
  151. assert-equal "dak ls -S -s unstable -f=control-suite package" "${actual}" "${expected}"
  152. )