dinstall 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  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. declare -r pdiff_tempdir="${DAKBASE}/_dinstall-pdiff-temp"
  22. setup_debian_like_archive() {
  23. dak admin archive add ftp-master "${DAKBASE}/ftp-master" "main archive"
  24. dak admin archive add debian-debug "${DAKBASE}/debian-debug" "debug archive"
  25. dak admin architecture add amd64 AMD64
  26. dak admin architecture add i386 "Intel ia32"
  27. # unstable
  28. dak admin suite add-all-arches unstable "" codename=sid archive=ftp-master
  29. dak admin suite-component add unstable main contrib non-free
  30. dak admin suite add-build-queue unstable buildd-unstable buildd-sid build-queues
  31. dak admin suite-config set unstable allowcsset=no byhash=yes \
  32. changelog_url=http://metadata.ftp-master.debian.org/changelogs/@CHANGEPATH@_changelog
  33. # testing
  34. dak admin suite add-all-arches testing "" codename=buster archive=ftp-master
  35. dak admin suite-component add testing main contrib non-free
  36. dak admin suite-config set testing allowcsset=yes byhash=yes \
  37. changelog_url=http://metadata.ftp-master.debian.org/changelogs/@CHANGEPATH@_changelog \
  38. changelog=dists/testing/ChangeLog
  39. # testing-proposed-updates
  40. dak admin suite add-all-arches testing-proposed-updates "" \
  41. codename=buster-proposed-updates archive=ftp-master
  42. dak admin suite-component add testing-proposed-updates main contrib non-free
  43. dak admin suite-config set testing-proposed-updates allowcsset=yes byhash=yes \
  44. changelog_url=http://metadata.ftp-master.debian.org/changelogs/@CHANGEPATH@_changelog
  45. # experimental
  46. dak admin suite add-all-arches experimental "" codename=rc-buggy archive=ftp-master
  47. dak admin suite-component add experimental main contrib non-free
  48. dak admin suite add-build-queue experimental buildd-experimental buildd-rc-buggy build-queues
  49. dak admin suite-config set experimental allowcsset=no byhash=yes \
  50. changelog_url=http://metadata.ftp-master.debian.org/changelogs/@CHANGEPATH@_changelog \
  51. notautomatic=yes butautomaticupgrades=no
  52. }
  53. dinstall() {
  54. echo "STARTING dinstall"
  55. dinstall_stage_start_up
  56. dinstall_stage_indices
  57. dinstall_stage_packages_contents
  58. dinstall_stage_dists
  59. # state scripts (OMITTED)
  60. # mkmaintainers
  61. # copyoverrides
  62. # mklslar
  63. # mkfilesindices
  64. # mkchecksums
  65. # dedup
  66. # signotherfiles
  67. # mirror hardlinks
  68. # UNLOCK UNCHECKED
  69. # UNLOCK DAILY
  70. echo "FINISHED dinstall"
  71. }
  72. dinstall_stage_start_up() {
  73. # LOCK DAILY
  74. # LOCK UNCHECKED
  75. # run p-u-new (OMITTED)
  76. # run backports-policy (OMITTED)
  77. # cruft
  78. echo "Checking for cruft in overrides"
  79. dak check-overrides
  80. }
  81. dinstall_stage_indices() {
  82. # run dominate
  83. echo "Removing obsolete source and binary associations"
  84. dak dominate
  85. # NB: testing-debug is omitted in PROD as well (presumably
  86. # because the RT tooling handles that part)
  87. dak manage-debug-suites unstable-debug experimental-debug
  88. # run autocruft
  89. autocruft
  90. # run import-keyring (orig function fingerprints)
  91. # Skip: fingerprints / import-kerings
  92. # - It is used for sync'ing the deiban keyrings and emailing
  93. # d-project. Both of which we can do without in a test.
  94. # run overrides
  95. echo "Writing overrides into text files"
  96. mkdir -p $overridedir
  97. (cd $overridedir && dak make-overrides)
  98. # run pkg-file-mapping (orig function mpfm)
  99. mpfm
  100. }
  101. dinstall_stage_packages_contents() {
  102. # run apt-ftparchive (orig function packages)
  103. echo " Generating Packages/Sources for: ${public_archives[*]}"
  104. dak generate-packages-sources2 -a "${public_archives[*]}"
  105. echo " Generating Contents for: ${public_archives[*]}"
  106. dak contents generate -a "${public_archives[*]}"
  107. }
  108. dinstall_stage_dists() {
  109. # run pdiff
  110. echo "Generating pdiff files"
  111. rm -fr "${pdiff_tempdir}"
  112. mkdir -p "${pdiff_tempdir}"
  113. dak generate-index-diffs -d "${pdiff_tempdir}" -a "${public_archives[*]}"
  114. # run release files (OMITTED) - TODO: make this work in the CI; needs GnuPG key
  115. echo "TODO: Generating Release files"
  116. # dak generate-releases -a "${public_archives[*]}"
  117. # run cleanup (OMITTED) - it removes tempfiles that we do not have
  118. }
  119. autocruft() {
  120. echo "Check for obsolete binary packages"
  121. dak auto-decruft -s unstable
  122. dak auto-decruft -s experimental --if-newer-version-in unstable --if-newer-version-in-rm-msg "NVIU"
  123. dak auto-decruft -s testing-proposed-updates --if-newer-version-in testing --if-newer-version-in-rm-msg "NVIT" --decruft-equal-versions
  124. }
  125. get_archiveroot() {
  126. local archivename="$1"
  127. local query="SELECT path FROM archive WHERE name='${archivename}'"
  128. local archiveroot="$(psql -tAc "${query}")"
  129. if [[ -z ${archiveroot} ]]; then
  130. echo "get_archiveroot: couldn't get archiveroot for '${archivename}'" >&2
  131. return 1
  132. fi
  133. echo "${archiveroot}"
  134. }
  135. mpfm() {
  136. local archiveroot
  137. echo "Generating package / file mapping"
  138. for archive in "${public_archives[@]}"; do
  139. echo " archive: ${archive}"
  140. archiveroot="$(get_archiveroot "${archive}")"
  141. mkdir -p "${archiveroot}/indices"
  142. dak make-pkg-file-mapping "${archive}" | bzip2 -9 > "${archiveroot}/indices/package-file.map.bz2"
  143. done
  144. }