dinstall 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. # -*- mode: sh -*-
  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. . ${DAK_ROOT:?}/integration-tests/common
  19. declare public_archives=(ftp-master debian-debug)
  20. declare -r scriptdir=${DAKBASE}/scripts
  21. declare -r overridedir=${scriptdir}/override # debian
  22. echo "Dir::Override \"${overridedir}\";" >> "${DAK_CONFIG}"
  23. declare -r pdiff_tempdir="${DAKBASE}/_dinstall-pdiff-temp"
  24. declare -r upload_dir="${DAKBASE}/uploads"
  25. DINSTALL_COUNTER=0
  26. mkdir -p $upload_dir
  27. setup_empty_archive() {
  28. section_start "setup_empty_archive[collapsed=true]" "Setup empty archive"
  29. dak admin archive add ftp-master "${DAKBASE}/ftp-master" "main archive"
  30. dak admin archive add debian-debug "${DAKBASE}/debian-debug" "debug archive"
  31. dak admin architecture add amd64 AMD64
  32. dak admin architecture add i386 "Intel ia32"
  33. HAVE_EXPERIMENTAL=
  34. HAVE_TPU=
  35. section_end setup_empty_archive
  36. }
  37. setup_unstable() {
  38. section_start "setup_debian_unstable[collapsed=true]" "Debian-like unstable"
  39. # unstable-debug + unstable
  40. dak admin suite add-all-arches unstable-debug "" codename=sid-debug archive=debian-debug \
  41. allowcsset=no byhash=yes accept_binary_uploads=False accept_source_uploads=False
  42. dak admin suite-component add unstable-debug main contrib non-free-firmware non-free
  43. dak admin suite add-all-arches unstable "" codename=sid archive=ftp-master \
  44. allowcsset=no byhash=yes overrideprocess=True debugsuite=unstable-debug \
  45. changelog_url=http://metadata.ftp-master.debian.org/changelogs/@CHANGEPATH@_changelog
  46. dak admin suite-component add unstable main contrib non-free-firmware non-free
  47. dak admin suite add-build-queue unstable buildd-unstable buildd-sid build-queues
  48. section_end setup_debian_unstable
  49. }
  50. setup_debian_like_archive() {
  51. section_start "setup_debian_archive[collapsed=true]" "Debian-like Archive setup"
  52. setup_empty_archive
  53. setup_unstable
  54. # testing-debug + testing
  55. dak admin suite add-all-arches testing-debug "" codename=buster-debug archive=debian-debug \
  56. allowcsset=no byhash=yes accept_binary_uploads=False accept_source_uploads=False
  57. dak admin suite-component add testing-debug main contrib non-free-firmware non-free
  58. dak admin suite add-all-arches testing "" codename=buster archive=ftp-master \
  59. allowcsset=yes byhash=yes \
  60. changelog_url=http://metadata.ftp-master.debian.org/changelogs/@CHANGEPATH@_changelog \
  61. changelog=dists/testing/ChangeLog \
  62. overrideprocess=True overrideorigin=unstable debugsuite=testing-debug
  63. dak admin suite-component add testing main contrib non-free-firmware non-free
  64. # testing-proposed-updates
  65. dak admin suite add-all-arches testing-proposed-updates "" \
  66. codename=buster-proposed-updates archive=ftp-master \
  67. allowcsset=yes byhash=yes \
  68. changelog_url=http://metadata.ftp-master.debian.org/changelogs/@CHANGEPATH@_changelog \
  69. overridesuite=testing
  70. dak admin suite-component add testing-proposed-updates main contrib non-free-firmware non-free
  71. dak admin suite add-build-queue testing-proposed-updates buildd-testing-proposed-updates buildd-buster-proposed-updates build-queues
  72. HAVE_TPU=1
  73. # experimental
  74. dak admin suite add-all-arches experimental "" codename=rc-buggy archive=ftp-master \
  75. allowcsset=no byhash=yes \
  76. changelog_url=http://metadata.ftp-master.debian.org/changelogs/@CHANGEPATH@_changelog \
  77. notautomatic=yes butautomaticupgrades=no \
  78. overridesuite=unstable overridecodename=sid
  79. dak admin suite-component add experimental main contrib non-free-firmware non-free
  80. dak admin suite add-build-queue experimental buildd-experimental buildd-rc-buggy build-queues
  81. HAVE_EXPERIMENTAL=1
  82. # Version constraints
  83. # Run "dak admin v-c list" to see them
  84. # experimental
  85. for suite in unstable testing ; do
  86. dak admin v-c add experimental MustBeNewerThan $suite
  87. done
  88. # testing-proposed-updates
  89. dak admin v-c add testing-proposed-updates Enhances testing
  90. dak admin v-c add testing-proposed-updates MustBeNewerThan testing
  91. # unstable
  92. dak admin v-c add unstable MustBeNewerThan testing
  93. # Lintian check
  94. cat > ${DAKBASE}/etc/lintian.tags <<-EOF
  95. lintian:
  96. nonfatal:
  97. - wrong-file-owner-uid-or-gid
  98. fatal:
  99. - binary-in-etc
  100. EOF
  101. echo "Dinstall::LintianTags \"${DAKBASE}/etc/lintian.tags\";" >> ${DAKBASE}/etc/dak.conf
  102. section_end setup_debian_archive
  103. }
  104. upload_changes() {
  105. dcmd cp -v "$@" $upload_dir
  106. }
  107. reupload_changes() {
  108. dak admin forget-signature "$@"
  109. dcmd cp -v "$@" $upload_dir
  110. }
  111. process_uploads() {
  112. dak process-upload -d $upload_dir --automatic
  113. }
  114. dinstall() {
  115. DINSTALL_COUNTER=$(( DINSTALL_COUNTER + 1 ))
  116. dinstall_name="dinstall_${DINSTALL_COUNTER}"
  117. section_start "${dinstall_name}[collapsed=true]" "dinstall #${DINSTALL_COUNTER}"
  118. echo "STARTING dinstall"
  119. dinstall_stage_start_up
  120. dinstall_stage_indices
  121. dinstall_stage_packages_contents
  122. dinstall_stage_dists
  123. # state scripts (mostly OMITTED)
  124. # mkmaintainers
  125. # copyoverrides
  126. # mklslar
  127. # mkfilesindices
  128. # mkchecksums
  129. # dedup
  130. dak archive-dedup-pool
  131. # signotherfiles
  132. # mirror hardlinks
  133. # UNLOCK UNCHECKED
  134. # UNLOCK DAILY
  135. echo "FINISHED dinstall"
  136. section_end "${dinstall_name}"
  137. }
  138. dinstall_stage_start_up() {
  139. # LOCK DAILY
  140. # LOCK UNCHECKED
  141. # run p-u-new (OMITTED)
  142. # run backports-policy (OMITTED)
  143. # cruft
  144. echo "Checking for cruft in overrides"
  145. dak check-overrides
  146. }
  147. dinstall_stage_indices() {
  148. # run dominate
  149. echo "Removing obsolete source and binary associations"
  150. dak dominate
  151. # NB: testing-debug is omitted in PROD as well (presumably
  152. # because the RT tooling handles that part)
  153. dak manage-debug-suites unstable-debug experimental-debug
  154. # run autocruft
  155. autocruft
  156. # run import-keyring (orig function fingerprints)
  157. # Skip: fingerprints / import-kerings
  158. # - It is used for sync'ing the deiban keyrings and emailing
  159. # d-project. Both of which we can do without in a test.
  160. # run overrides
  161. echo "Writing overrides into text files"
  162. mkdir -p $overridedir
  163. (cd $overridedir && dak make-overrides)
  164. # run pkg-file-mapping (orig function mpfm)
  165. mpfm
  166. }
  167. dinstall_stage_packages_contents() {
  168. # run apt-ftparchive (orig function packages)
  169. echo " Generating Packages/Sources for: ${public_archives[*]}"
  170. dak generate-packages-sources2 -a "${public_archives[*]}"
  171. echo " Generating Contents for: ${public_archives[*]}"
  172. dak contents generate -a "${public_archives[*]}"
  173. }
  174. dinstall_stage_dists() {
  175. # run pdiff
  176. echo "Generating pdiff files"
  177. mkdir -p "${pdiff_tempdir}"
  178. dak generate-index-diffs -d "${pdiff_tempdir}" -a "${public_archives[*]}"
  179. # run release files
  180. echo "Generating Release files"
  181. dak generate-releases -a "${public_archives[*]}"
  182. # run cleanup (OMITTED) - it removes tempfiles that we do not have
  183. }
  184. autocruft() {
  185. echo "Check for obsolete binary packages"
  186. dak auto-decruft -s unstable
  187. if [ -n "$HAVE_EXPERIMENTAL" ]
  188. then
  189. dak auto-decruft -s experimental --if-newer-version-in unstable --if-newer-version-in-rm-msg "NVIU"
  190. fi
  191. if [ -n "$HAVE_TPU" ]
  192. then
  193. dak auto-decruft -s testing-proposed-updates --if-newer-version-in testing --if-newer-version-in-rm-msg "NVIT" --decruft-equal-versions
  194. fi
  195. }
  196. get_archiveroot() {
  197. local archivename="$1"
  198. local query="SELECT path FROM archive WHERE name='${archivename}'"
  199. local archiveroot="$(psql -tAc "${query}")"
  200. if [[ -z ${archiveroot} ]]; then
  201. echo "get_archiveroot: couldn't get archiveroot for '${archivename}'" >&2
  202. return 1
  203. fi
  204. echo "${archiveroot}"
  205. }
  206. mpfm() {
  207. local archiveroot
  208. echo "Generating package / file mapping"
  209. for archive in "${public_archives[@]}"; do
  210. echo " archive: ${archive}"
  211. archiveroot="$(get_archiveroot "${archive}")"
  212. mkdir -p "${archiveroot}/indices"
  213. dak make-pkg-file-mapping "${archive}" | bzip2 -9 > "${archiveroot}/indices/package-file.map.bz2"
  214. done
  215. }
  216. # process NEW policy queue
  217. function do_new () {
  218. echo "Doing NEW processing"
  219. dak process-policy new
  220. echo "Cleanup NEW/Backports NEW"
  221. dak clean-suites -a new
  222. }