[Piuparts-commits] [piuparts] 06/12: p-r: aquire master.lock for the current section (blocking)
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 3694456509c4280b3936545a2a3022622f296b02
Author: Andreas Beckmann <anbe at debian.org>
Date: Wed Oct 4 04:49:18 2017 +0200
p-r: aquire master.lock for the current section (blocking)
Signed-off-by: Andreas Beckmann <anbe at debian.org>
Signed-off-by: Holger Levsen <holger at layer-acht.org>
---
debian/changelog | 2 ++
piuparts-report.py | 10 ++++++++--
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index 9f84a35..d6a19f5 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -9,6 +9,8 @@ piuparts (0.83) UNRELEASED; urgency=medium
- Use the actual package versions for resolving the "outdated" state.
* piuparts-report.py:
- Use global locks to allow only one running instance of each script.
+ - Acquire section locks to prevent concurrent processing of a section,
+ including piuparts-master access.
-- Holger Levsen <holger at debian.org> Sat, 07 Oct 2017 17:42:12 +0200
diff --git a/piuparts-report.py b/piuparts-report.py
index bc0e98c..0b80519 100644
--- a/piuparts-report.py
+++ b/piuparts-report.py
@@ -1790,8 +1790,14 @@ def main():
yaml.dump(section_names, default_flow_style=False))
for section_name in process_section_names:
try:
- section = Section(section_name, master_directory, doc_root, packagedb_cache=packagedb_cache)
- section.generate_output(output_directory, section_names, problem_list, web_host)
+ section_directory = os.path.join(master_directory, section_name)
+ if not os.path.exists(section_directory):
+ raise MissingSection("", section_name)
+ with open(os.path.join(section_directory, "master.lock"), "we") as lock:
+ fcntl.flock(lock, fcntl.LOCK_EX)
+
+ section = Section(section_name, master_directory, doc_root, packagedb_cache=packagedb_cache)
+ section.generate_output(output_directory, section_names, problem_list, web_host)
except MissingSection as e:
logging.error("Configuration Error in section '%s': %s" % (section_name, e))
except (HTTPError, URLError) as e:
--
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