diff options
author | V3n3RiX <venerix@koprulu.sector> | 2024-02-29 03:48:08 +0000 |
---|---|---|
committer | V3n3RiX <venerix@koprulu.sector> | 2024-03-01 07:33:34 +0000 |
commit | 5a8384b21bb066ca44f6823871ad1d0aa1aa2c28 (patch) | |
tree | 23af9daff7b1810281c8a61ce51cfc2e33fd5150 /src/backend/solverevdeps.py | |
parent | 1c1b0f57b0adf71a216e74e0fb718ed0b218c39d (diff) |
bugfix : https://bugs.redcorelinux.org/show_bug.cgi?id=156
Diffstat (limited to 'src/backend/solverevdeps.py')
-rw-r--r-- | src/backend/solverevdeps.py | 42 |
1 files changed, 38 insertions, 4 deletions
diff --git a/src/backend/solverevdeps.py b/src/backend/solverevdeps.py index 0400be9..12b4eb4 100644 --- a/src/backend/solverevdeps.py +++ b/src/backend/solverevdeps.py @@ -18,10 +18,33 @@ signal.signal(signal.SIGINT, sigint_handler) @animation.wait('resolving reverse dependencies') def start(pkgname=None, depclean=False, unmerge=False): + is_installed = int(1) is_needed = int(0) + is_vague = int(0) if unmerge: - pass # behave like portage and ignore reverse dependencies + is_needed = int(0) + try: + p_exe = subprocess.Popen(['emerge', '--unmerge', '--quiet', '--pretend', '--verbose'] + list( + pkgname), stdout=subprocess.PIPE, stderr=subprocess.PIPE) + + stdout, stderr = p_exe.communicate() + + for p_out in stderr.decode('utf-8').splitlines(): + if any(key in p_out for key in ["Couldn't find", + "to depclean."]): + is_installed = int(0) + + if any(key in p_out for key in ["short ebuild name", + "is ambiguous"]): + is_vague = int(1) + except KeyboardInterrupt: + p_exe.terminate() + try: + p_exe.wait(1) + except subprocess.TimeoutExpired: + p_exe.kill() + sys.exit() else: try: p_exe = subprocess.Popen(['emerge', '--depclean', '--quiet', '--pretend', @@ -30,11 +53,19 @@ def start(pkgname=None, depclean=False, unmerge=False): stdout, stderr = p_exe.communicate() for p_out in stdout.decode('utf-8').splitlines(): - if any(key in p_out for key in ["pulled in by:", "required"]): + if any(key in p_out for key in ["pulled in by:", + "required"]): is_needed = int(1) - pickle.dump(is_needed, open(os.path.join( - sisyphus.getfs.p_mtd_dir, "sisyphus_pkgrevdeps.pickle"), "wb")) + for p_out in stderr.decode('utf-8').splitlines(): + if any(key in p_out for key in ["Couldn't find", + "to depclean."]): + is_installed = int(0) + + if any(key in p_out for key in ["short ebuild name", + "is ambiguous"]): + is_vague = int(1) + except KeyboardInterrupt: p_exe.terminate() try: @@ -42,3 +73,6 @@ def start(pkgname=None, depclean=False, unmerge=False): except subprocess.TimeoutExpired: p_exe.kill() sys.exit() + + pickle.dump([is_installed, is_needed, is_vague], open(os.path.join( + sisyphus.getfs.p_mtd_dir, "sisyphus_pkgrevdeps.pickle"), "wb")) |