dinstall 8.1 KB

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