[Piuparts-commits] [piuparts] 07/12: dwke: acquire a global "dwke.lock"
Holger Levsen
holger at layer-acht.org
Wed Oct 11 14:58:44 UTC 2017
This is an automated email from the git hooks/post-receive script.
holger pushed a commit to branch develop
in repository piuparts.
commit e85b66d5ca2eea747c91f2ec9b92b763fcca4289
Author: Andreas Beckmann <anbe at debian.org>
Date: Wed Oct 4 04:54:42 2017 +0200
dwke: acquire a global "dwke.lock"
Signed-off-by: Andreas Beckmann <anbe at debian.org>
Signed-off-by: Holger Levsen <holger at layer-acht.org>
---
master-bin/detect_well_known_errors.py | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/master-bin/detect_well_known_errors.py b/master-bin/detect_well_known_errors.py
index 8ba7e04..4708b6c 100644
--- a/master-bin/detect_well_known_errors.py
+++ b/master-bin/detect_well_known_errors.py
@@ -25,6 +25,7 @@ import sys
import time
import logging
import argparse
+import fcntl
import piupartslib
from piupartslib.conf import MissingSection
@@ -140,7 +141,12 @@ caching the problems found, by package, into ".kpr" files.
conf = WKE_Config()
conf.read(CONFIG_FILE)
- if True:
+ with open(os.path.join(conf['master-directory'], "dwke.lock"), "we") as lock:
+ try:
+ fcntl.flock(lock, fcntl.LOCK_EX | fcntl.LOCK_NB)
+ except IOError:
+ sys.exit("another detect_well_known_errors process is already running")
+
sections = args.sections
if not sections:
sections = conf['sections'].split()
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/piuparts/piuparts.git
More information about the Piuparts-commits
mailing list