From 8e956197e06ce7e69b910477f95a104ea29f5a94 Mon Sep 17 00:00:00 2001 From: Luca Falavigna Date: Mon, 29 Apr 2013 14:01:09 +0000 Subject: [PATCH] Generate a lock to protect changelog export runs --- config/debian/dinstall.functions | 34 ++++++++++++++++++++------------ config/debian/dinstall.variables | 3 +++ 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/config/debian/dinstall.functions b/config/debian/dinstall.functions index f6287a8d..1cfdf28b 100644 --- a/config/debian/dinstall.functions +++ b/config/debian/dinstall.functions @@ -9,6 +9,11 @@ function remove_daily_lock() { rm -f $LOCK_DAILY } +# Remove changelog lock +function remove_changelog_lock() { + rm -f $LOCK_CHANGELOG +} + # Remove all locks function remove_all_locks() { rm -f $LOCK_DAILY $LOCK_ACCEPTED @@ -614,19 +619,22 @@ EOF # extract changelogs and stuff function changelogs() { - log "Extracting changelogs" - dak make-changelog -e -a ftp-master - [ -f ${exportdir}/changelogs/filelist.yaml ] && xz -f ${exportdir}/changelogs/filelist.yaml - mkdir -p ${exportpublic}/changelogs - cd ${exportpublic}/changelogs - rsync -aHW --delete --delete-after --ignore-errors ${exportdir}/changelogs/. . - sudo -H -u staticsync /usr/local/bin/static-update-component ftp-master.metadata.debian.org >/dev/null 2>&1 & - - #dak make-changelog -e -a backports - #[ -f /srv/backports-master.debian.org/export/changelogs/filelist.yaml ] && xz -f /srv/backports-master.debian.org/export/changelogs/filelist.yaml - #mkdir -p /srv/backports-master.debian.org/rsync/export/changelogs - #cd /srv/backports-master.debian.org/rsync/export/changelogs - #rsync -aHW --delete --delete-after --ignore-errors /srv/backports-master.debian.org/export/changelogs/. . + if lockfile -r3 $LOCK_CHANGELOG; then + log "Extracting changelogs" + dak make-changelog -e -a ftp-master + [ -f ${exportdir}/changelogs/filelist.yaml ] && xz -f ${exportdir}/changelogs/filelist.yaml + mkdir -p ${exportpublic}/changelogs + cd ${exportpublic}/changelogs + rsync -aHW --delete --delete-after --ignore-errors ${exportdir}/changelogs/. . + sudo -H -u staticsync /usr/local/bin/static-update-component ftp-master.metadata.debian.org >/dev/null 2>&1 & + + #dak make-changelog -e -a backports + #[ -f /srv/backports-master.debian.org/export/changelogs/filelist.yaml ] && xz -f /srv/backports-master.debian.org/export/changelogs/filelist.yaml + #mkdir -p /srv/backports-master.debian.org/rsync/export/changelogs + #cd /srv/backports-master.debian.org/rsync/export/changelogs + #rsync -aHW --delete --delete-after --ignore-errors /srv/backports-master.debian.org/export/changelogs/. . + trap remove_changelog_lock EXIT TERM HUP INT QUIT + fi } function gitpdiff() { diff --git a/config/debian/dinstall.variables b/config/debian/dinstall.variables index 81a651d8..f2f88f8d 100644 --- a/config/debian/dinstall.variables +++ b/config/debian/dinstall.variables @@ -40,6 +40,9 @@ LOCK_STOP="$lockdir/archive.stop" # Lock buildd updates LOCK_BUILDD="$lockdir/buildd.lock" +# Lock changelog updates +LOCK_CHANGELOG="$lockdir/changelog.lock" + # Statefile for the users DINSTALLSTATE="${webdir}/dinstall.status" -- 2.39.5