From b0a34a77c6b347397449b2339abb3ffacf70c4b2 Mon Sep 17 00:00:00 2001 From: Fabio Erculiani Date: Sat, 31 Jul 2010 13:10:30 +0200 Subject: [PATCH] [equo] text_ui: always acquire entropy lock before doing anything --- client/text_ui.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/client/text_ui.py b/client/text_ui.py index 550d11ed9..ba448f3e7 100644 --- a/client/text_ui.py +++ b/client/text_ui.py @@ -26,7 +26,8 @@ from entropy.output import red, blue, brown, darkred, bold, darkgreen, bold, \ from entropy.client.interfaces import Client from entropy.client.interfaces.package import Package as ClientPkg from entropy.i18n import _ -from text_tools import countdown, enlightenatom +from text_tools import countdown, enlightenatom, acquire_entropy_locks, \ + release_entropy_locks import entropy.tools import entropy.dump @@ -138,8 +139,13 @@ def package(options): myopts = _myopts entropy_client = None + acquired = False try: entropy_client = Client() + acquired = acquire_entropy_locks(entropy_client) + if not acquired: + print_error(darkgreen(_("Another Entropy is currently running."))) + return 1 if cmd == "deptest": rc, garbage = _dependencies_test(entropy_client) @@ -269,6 +275,8 @@ def package(options): show_config_files_to_update(entropy_client) finally: + if acquired and (entropy_client is not None): + release_entropy_locks(entropy_client) if entropy_client is not None: entropy_client.shutdown()