diff options
author | V3n3RiX <venerix@koprulu.sector> | 2024-02-28 11:29:32 +0000 |
---|---|---|
committer | V3n3RiX <venerix@koprulu.sector> | 2024-02-28 11:29:32 +0000 |
commit | 1c1b0f57b0adf71a216e74e0fb718ed0b218c39d (patch) | |
tree | 59c4a119844ea6b6be9969e48f5c543788a7de09 /src/backend/solverevdeps.py | |
parent | 94c0bd2dfeb801087c7a03787a964b15b2a37bd8 (diff) |
behave more like portage, and don't waste time resolving reverse dependencies during force removal of a package
Diffstat (limited to 'src/backend/solverevdeps.py')
-rw-r--r-- | src/backend/solverevdeps.py | 41 |
1 files changed, 22 insertions, 19 deletions
diff --git a/src/backend/solverevdeps.py b/src/backend/solverevdeps.py index bd90e2f..0400be9 100644 --- a/src/backend/solverevdeps.py +++ b/src/backend/solverevdeps.py @@ -17,25 +17,28 @@ signal.signal(signal.SIGINT, sigint_handler) @animation.wait('resolving reverse dependencies') -def start(pkgname=None): +def start(pkgname=None, depclean=False, unmerge=False): is_needed = int(0) - p_exe = subprocess.Popen( - ['emerge', '--depclean', '--quiet', '--pretend', '--verbose'] + list(pkgname), stdout=subprocess.PIPE, stderr=subprocess.PIPE) - - try: - 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"]): - is_needed = int(1) - - pickle.dump(is_needed, open(os.path.join( - sisyphus.getfs.p_mtd_dir, "sisyphus_pkgrevdeps.pickle"), "wb")) - except KeyboardInterrupt: - p_exe.terminate() + if unmerge: + pass # behave like portage and ignore reverse dependencies + else: try: - p_exe.wait(1) - except subprocess.TimeoutExpired: - p_exe.kill() - sys.exit() + p_exe = subprocess.Popen(['emerge', '--depclean', '--quiet', '--pretend', + '--verbose'] + list(pkgname), stdout=subprocess.PIPE, stderr=subprocess.PIPE) + + 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"]): + is_needed = int(1) + + pickle.dump(is_needed, open(os.path.join( + sisyphus.getfs.p_mtd_dir, "sisyphus_pkgrevdeps.pickle"), "wb")) + except KeyboardInterrupt: + p_exe.terminate() + try: + p_exe.wait(1) + except subprocess.TimeoutExpired: + p_exe.kill() + sys.exit() |