From e317a71524a1398e765ae0b83e059acae646c00a Mon Sep 17 00:00:00 2001 From: Fabio Erculiani Date: Fri, 6 Dec 2013 12:13:39 +0100 Subject: [PATCH] [solo.commands.deptest] add concurrency support --- client/solo/commands/deptest.py | 40 +++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/client/solo/commands/deptest.py b/client/solo/commands/deptest.py index e9d952ae9..d2bcbf473 100644 --- a/client/solo/commands/deptest.py +++ b/client/solo/commands/deptest.py @@ -83,7 +83,7 @@ Test system integrity by checking installed packages dependencies. self._quiet = nsargs.quiet self._pretend = nsargs.pretend - return self._call_locked, [self._test] + return self._call_unlocked, [self._test] def bashcomp(self, last_arg): """ @@ -96,22 +96,17 @@ Test system integrity by checking installed packages dependencies. outcome += repos return self._bashcomp(sys.stdout, last_arg, outcome) - def _test(self, entropy_client): + def _test_installed(self, entropy_client, inst_repo): """ - Command implementation. + Test the installed packages dependencies. """ - entropy_client.output( - "%s..." % (blue(_("Running dependency test")),), - header=darkred(" @@ ")) + crying_atoms = {} + found_deps = set() deps_not_matched = entropy_client.dependencies_test() if not deps_not_matched: - entropy_client.output("") - return 0 + return deps_not_matched, crying_atoms, found_deps - crying_atoms = {} - found_deps = set() - inst_repo = entropy_client.installed_repository() for dep in deps_not_matched: r_dep_id = inst_repo.searchDependency(dep) @@ -155,11 +150,32 @@ Test system integrity by checking installed packages dependencies. found_deps.add(key_slot) continue + return deps_not_matched, crying_atoms, found_deps + + def _test(self, entropy_client): + """ + Command implementation. + """ + entropy_client.output( + "%s..." % (blue(_("Running dependency test")),), + header=darkred(" @@ ")) + + inst_repo = entropy_client.installed_repository() + with inst_repo.shared(): + not_found_deps, crying_atoms, found_deps = self._test_installed( + entropy_client, inst_repo) + + if not not_found_deps: + entropy_client.output( + darkgreen(_("No missing dependencies")), + header=darkred(" @@ ")) + return 0 + entropy_client.output( "%s:" % (blue(_("These are the dependencies not found")),), header=darkred(" @@ ")) - for atom in deps_not_matched: + for atom in not_found_deps: entropy_client.output( darkred(atom), header=" # ")