提交 57955c99 编写于 作者: J Joerg Jaspert

Merge remote-tracking branch 'ansgar/pu/security-locks' into merge

* ansgar/pu/security-locks:
  debian-security: place locks around dak commands that affect packages
Signed-off-by: NJoerg Jaspert <joerg@debian.org>
...@@ -6,6 +6,8 @@ set -e ...@@ -6,6 +6,8 @@ set -e
export SCRIPTVARS=/srv/security-master.debian.org/dak/config/debian-security/vars export SCRIPTVARS=/srv/security-master.debian.org/dak/config/debian-security/vars
. $SCRIPTVARS . $SCRIPTVARS
LOCKFILE="$lockdir/unchecked.lock"
################################################################################ ################################################################################
# Fix overrides # Fix overrides
...@@ -66,10 +68,24 @@ done ...@@ -66,10 +68,24 @@ done
cd $configdir cd $configdir
dak import-keyring -L /srv/keyring.debian.org/keyrings/debian-keyring.gpg dak import-keyring -L /srv/keyring.debian.org/keyrings/debian-keyring.gpg
cleanup() {
rm -f "$LOCKFILE"
}
if ! lockfile -r100 "$LOCKFILE"; then
echo "Could not lock $LOCKFILE." >&2
exit 1
fi
trap cleanup EXIT
dak clean-queues dak clean-queues
dak clean-queues -i $disembargo dak clean-queues -i $disembargo
dak clean-suites dak clean-suites
cleanup
trap - EXIT
symlinks -d -r $ftpdir symlinks -d -r $ftpdir
pg_dump obscurity > /org/security-master.debian.org/dak-backup/dump_$(date +%Y.%m.%d-%H:%M:%S) pg_dump obscurity > /org/security-master.debian.org/dak-backup/dump_$(date +%Y.%m.%d-%H:%M:%S)
......
...@@ -15,6 +15,7 @@ reportdis=$queuedir/REPORT.disembargo ...@@ -15,6 +15,7 @@ reportdis=$queuedir/REPORT.disembargo
timestamp=$(date "+%Y-%m-%d %H:%M") timestamp=$(date "+%Y-%m-%d %H:%M")
doanything=false doanything=false
dopolicy=false dopolicy=false
LOCKFILE="$lockdir/unchecked.lock"
# So first we should go and see if any process-policy action is done # So first we should go and see if any process-policy action is done
dak process-policy embargoed | mail -a "X-Debian: DAK" -e -s "Automatically accepted from embargoed" team@security.debian.org -- -F "Debian FTP Masters" -f ftpmaster@ftp-master.debian.org dak process-policy embargoed | mail -a "X-Debian: DAK" -e -s "Automatically accepted from embargoed" team@security.debian.org -- -F "Debian FTP Masters" -f ftpmaster@ftp-master.debian.org
...@@ -24,6 +25,16 @@ dak process-policy unembargoed | mail -a "X-Debian: DAK" -e -s "Automatically ac ...@@ -24,6 +25,16 @@ dak process-policy unembargoed | mail -a "X-Debian: DAK" -e -s "Automatically ac
# in newstage mean they are (late) accepts of security stuff, need # in newstage mean they are (late) accepts of security stuff, need
# to sync to ftp-master # to sync to ftp-master
cleanup() {
rm -f "$LOCKFILE"
}
if ! lockfile -r8 "$LOCKFILE"; then
echo "aborting cron.unchecked because $LOCKFILE has already been locked"
exit 0
fi
trap cleanup EXIT
cd $newstage cd $newstage
changes=$(find . -maxdepth 1 -mindepth 1 -type f -name \*.changes | sed -e "s,./,," | xargs) changes=$(find . -maxdepth 1 -mindepth 1 -type f -name \*.changes | sed -e "s,./,," | xargs)
if [ -n "$changes" ]; then if [ -n "$changes" ]; then
...@@ -70,4 +81,7 @@ if [ "x${dopolicy}x" = "xtruex" ]; then ...@@ -70,4 +81,7 @@ if [ "x${dopolicy}x" = "xtruex" ]; then
sudo -u archvsync -H /home/archvsync/signal_security sudo -u archvsync -H /home/archvsync/signal_security
fi fi
cleanup
trap - EXIT
$configdir/cron.buildd $configdir/cron.buildd
...@@ -6,13 +6,30 @@ set -e ...@@ -6,13 +6,30 @@ set -e
export SCRIPTVARS=/srv/security-master.debian.org/dak/config/debian-security/vars export SCRIPTVARS=/srv/security-master.debian.org/dak/config/debian-security/vars
. $SCRIPTVARS . $SCRIPTVARS
LOCKFILE="$lockdir/unchecked.lock"
################################################################################ ################################################################################
# Weekly generation of release files, then pushing mirrors. # Weekly generation of release files, then pushing mirrors.
# Used as we have a "Valid-until" field in our release files of 10 days. In case # Used as we have a "Valid-until" field in our release files of 10 days. In case
# we dont have a security update in that time... # we dont have a security update in that time...
cd $configdir cd $configdir
cleanup() {
rm -f "$LOCKFILE"
}
if ! lockfile -r100 "$LOCKFILE"; then
echo "Could not lock $LOCKFILE. Assuming resigning is not needed."
exit 0
fi
trap cleanup EXIT
dak generate-releases dak generate-releases
cleanup
trap - EXIT
/srv/security-master.debian.org/dak/config/debian-security/make-mirror.sh /srv/security-master.debian.org/dak/config/debian-security/make-mirror.sh
sudo -u archvsync -H /home/archvsync/signal_security sudo -u archvsync -H /home/archvsync/signal_security
......
...@@ -95,26 +95,34 @@ def _do_Approve(): ...@@ -95,26 +95,34 @@ def _do_Approve():
print "Sync stuff for upload to ftpmaster" print "Sync stuff for upload to ftpmaster"
spawn("rsync -a -q %s/. /srv/queued/ftpmaster/." % (newstage.path)) spawn("rsync -a -q %s/. /srv/queued/ftpmaster/." % (newstage.path))
# 3. Now run process-upload in the newstage dir print "Locking unchecked"
print "Now put it into the security archive" lockfile='/srv/security-master.debian.org/lock/unchecked.lock'
spawn("dak process-upload -a -d %s" % (newstage.path)) spawn("lockfile -r8 {0}".format(lockfile))
# 4. Run all the steps that are needed to publish the changed archive try:
print "Domination" # 3. Now run process-upload in the newstage dir
spawn("dak dominate") print "Now put it into the security archive"
# print "Generating filelist for apt-ftparchive" spawn("dak process-upload -a -d %s" % (newstage.path))
# spawn("dak generate-filelist")
print "Updating Packages and Sources files... This may take a while, be patient" # 4. Run all the steps that are needed to publish the changed archive
spawn("/srv/security-master.debian.org/dak/config/debian-security/map.sh") print "Domination"
# spawn("apt-ftparchive generate %s" % (utils.which_apt_conf_file())) spawn("dak dominate")
spawn("dak generate-packages-sources2") # print "Generating filelist for apt-ftparchive"
print "Updating Release files..." # spawn("dak generate-filelist")
spawn("dak generate-releases") print "Updating Packages and Sources files... This may take a while, be patient"
print "Triggering security mirrors... (this may take a while)" spawn("/srv/security-master.debian.org/dak/config/debian-security/map.sh")
spawn("/srv/security-master.debian.org/dak/config/debian-security/make-mirror.sh") # spawn("apt-ftparchive generate %s" % (utils.which_apt_conf_file()))
spawn("sudo -u archvsync -H /home/archvsync/signal_security") spawn("dak generate-packages-sources2")
print "Triggering metadata export for packages.d.o and other consumers" print "Updating Release files..."
spawn("/srv/security-master.debian.org/dak/config/debian-security/export.sh") spawn("dak generate-releases")
print "Triggering security mirrors... (this may take a while)"
spawn("/srv/security-master.debian.org/dak/config/debian-security/make-mirror.sh")
spawn("sudo -u archvsync -H /home/archvsync/signal_security")
print "Triggering metadata export for packages.d.o and other consumers"
spawn("/srv/security-master.debian.org/dak/config/debian-security/export.sh")
finally:
os.unlink(lockfile)
print "Lock released."
######################################################################## ########################################################################
######################################################################## ########################################################################
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册