[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[dak/master] Export buildd queues to public location



The dists/ directory should be updated as atomic as possible. Therefore
buildds access a copy that can be updated with two file renames.
---
 config/debian/apache.conf-incoming   |    2 +-
 config/debian/common                 |    1 +
 scripts/debian/update-buildd-archive |   68 ++++++++++++++++++++++++++++++++++
 3 files changed, 70 insertions(+), 1 deletions(-)
 create mode 100755 scripts/debian/update-buildd-archive

diff --git a/config/debian/apache.conf-incoming b/config/debian/apache.conf-incoming
index 480ce0f..e1a65ed 100644
--- a/config/debian/apache.conf-incoming
+++ b/config/debian/apache.conf-incoming
@@ -20,7 +20,7 @@
   Alias /buildd-unstable /srv/incoming.debian.org/dists/unstable/current/
   Alias /buildd-experimental /srv/incoming.debian.org/dists/experimental/current/
 
-  <DirectoryMatch ~ "^/srv/(incoming\.debian\.org/(dists/|builddweb)|ftp\.debian\.org/mirror)">
+  <DirectoryMatch ~ "^/srv/(incoming\.debian\.org/(dists/|builddweb|debian-buildd/)|ftp\.debian\.org/mirror)">
     Order allow,deny
 
     Use DebianBuilddHostList
diff --git a/config/debian/common b/config/debian/common
index 9accda1..c6f1c2d 100644
--- a/config/debian/common
+++ b/config/debian/common
@@ -36,6 +36,7 @@ function make_buildd_dir () {
     dak manage-build-queues -a
     dak generate-packages-sources2 -a build-queues
     dak generate-releases -a build-queues >/dev/null
+    ${scriptdir}/update-buildd-archive ${base}/build-queues ${incoming}/debian-buildd
 
     for suite in unstable experimental; do
         rm -rf "$incoming/dists/$suite/buildd"
diff --git a/scripts/debian/update-buildd-archive b/scripts/debian/update-buildd-archive
new file mode 100755
index 0000000..a11b009
--- /dev/null
+++ b/scripts/debian/update-buildd-archive
@@ -0,0 +1,68 @@
+#! /bin/bash
+#
+# Copyright 2012, Ansgar Burchardt <ansgar@debian.org>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+set -e
+set -u
+
+usage() {
+  echo "usage: $0 <source> <target>"
+  echo
+  echo "Update a minimalistic mirror for buildd archives."
+  exit ${1:-0}
+}
+
+if [ $# -ne 2 ]; then
+  usage 1
+fi
+
+source="${1}"
+dest="${2}"
+
+if [ ! -d "${source}/dists" -o ! -d "${source}/pool" ]; then
+  echo "${source}: does not look like a Debian archive" >&2
+  exit 1
+fi
+
+if [ ! -d "${dest}" ]; then
+  echo "${dest}: destination does not exist or is not a directory" >&2
+  exit 1
+fi
+
+# Make sure ${dest}/dists exists to avoid a special case later
+if [ ! -d "${dest}/dists" ]; then
+  mkdir "${dest}/dists"
+fi
+for olddir in dists.new dists.old; do
+  if [ -e "${dest}/${olddir}" ]; then
+    echo "Removing old ${olddir}..."
+    rm -r "${dest}/${olddir}"
+  fi
+done
+
+# Make sure ${dest}/pool exists
+if [ ! -e "${dest}/pool" ]; then
+  # Files are only removed from the build queues once they are no longer
+  # referenced. Having a symlink should thus not cause problems.
+  ln -s "${source}/pool" "${dest}/pool"
+fi
+
+# Finally copy dists/ to dists.new/, rename it and remove old version
+cp -a "${source}/dists" "${dest}/dists.new"
+mv "${dest}/dists" "${dest}/dists.old"
+mv "${dest}/dists.new" "${dest}/dists"
+rm -r "${dest}/dists.old"
-- 
1.7.2.5


Reply to: