0002-basic-c-s 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  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. dak generate-release -s unstable
  85. )
  86. (
  87. packages=$(fixture-package-dir)
  88. cp ${packages:?}/package_0.2* ${DAKBASE}/tmp
  89. dak process-upload -d ${DAKBASE}/tmp --automatic
  90. )
  91. # unstable currently has both and control-suite should confirm this
  92. (
  93. expected="$(cat <<EOF
  94. package 0.1-1 all
  95. package 0.2-1 all
  96. package 0.1-1 source
  97. package 0.2-1 source
  98. EOF
  99. )"
  100. assert-control-suite-list unstable "${expected}"
  101. )
  102. # testing should be unchanged (i.e. only have 0.1)
  103. (
  104. expected="$(cat <<EOF
  105. package 0.1-1 all
  106. package 0.1-1 source
  107. EOF
  108. )"
  109. assert-control-suite-list testing "${expected}"
  110. )
  111. # dak ls run just for the sake of it
  112. (
  113. expected="$(cat <<EOF
  114. package | 0.1-1 | unstable | source, all
  115. package | 0.2-1 | unstable | source, all
  116. EOF
  117. )"
  118. actual=$(dak ls -S -s unstable package)
  119. assert-equal "dak ls -S -s unstable -f=control-suite package" "${actual}" "${expected}"
  120. )
  121. # Clean up unstable
  122. (
  123. dak dominate
  124. )
  125. # unstable now only has version 0.2
  126. (
  127. expected="$(cat <<EOF
  128. package 0.2-1 all
  129. package 0.2-1 source
  130. EOF
  131. )"
  132. assert-control-suite-list unstable "${expected}"
  133. )
  134. # testing still has version 0.1
  135. (
  136. expected="$(cat <<EOF
  137. package 0.1-1 all
  138. package 0.1-1 source
  139. EOF
  140. )"
  141. assert-control-suite-list testing "${expected}"
  142. )
  143. # dak ls run just for the sake of it
  144. (
  145. expected="$(cat <<EOF
  146. package | 0.2-1 | unstable | source, all
  147. EOF
  148. )"
  149. actual=$(dak ls -S -s unstable package)
  150. assert-equal "dak ls -S -s unstable -f=control-suite package" "${actual}" "${expected}"
  151. )