diff options
Diffstat (limited to 'src/backend')
-rw-r--r-- | src/backend/download.py | 2 | ||||
-rw-r--r-- | src/backend/install.py | 27 | ||||
-rw-r--r-- | src/backend/solvedeps.py | 13 | ||||
-rw-r--r-- | src/backend/upgrade.py | 2 |
4 files changed, 34 insertions, 10 deletions
diff --git a/src/backend/download.py b/src/backend/download.py index 2150a25..ce089ad 100644 --- a/src/backend/download.py +++ b/src/backend/download.py @@ -29,7 +29,7 @@ def start(dl_world=False, gfx_ui=False): sisyphus.getfs.p_mtd_dir, "sisyphus_pkgdeps.pickle") with open(file_path, "rb") as f: - bin_list, src_list, need_cfg = pickle.load(f) + bin_list, src_list, is_vague, need_cfg = pickle.load(f) dl_list = [f'={package}' for package in bin_list] diff --git a/src/backend/install.py b/src/backend/install.py index b742708..ae04384 100644 --- a/src/backend/install.py +++ b/src/backend/install.py @@ -36,10 +36,29 @@ def start(pkgname, ebuild=False, gfx_ui=False, oneshot=False): sisyphus.update.start(gfx_ui=False) sisyphus.solvedeps.start(pkgname) - bin_list, src_list, need_cfg = pickle.load( + bin_list, src_list, is_vague, need_cfg = pickle.load( open(os.path.join(sisyphus.getfs.p_mtd_dir, "sisyphus_pkgdeps.pickle"), "rb")) - if need_cfg != 0: # catch aliens + if is_vague != 0: # catch ambiguous packages + p_exe = subprocess.Popen(['emerge', '--quiet', '--pretend', '--getbinpkg', '--rebuilt-binaries', + '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n'] + list(pkgname)) + try: + p_exe.wait() + except KeyboardInterrupt: + p_exe.terminate() + try: + p_exe.wait(1) + except subprocess.TimeoutExpired: + p_exe.kill() + sys.exit() + if gfx_ui: + pass # GUI always calls <category>/<pkgname>, no ambiguity + else: + print(sisyphus.getcolor.bright_red + + "\nCannot proceed!\n" + sisyphus.getcolor.reset) + sys.exit() + + elif need_cfg != 0: # catch aliens p_exe = subprocess.Popen(['emerge', '--quiet', '--pretend', '--getbinpkg', '--rebuilt-binaries', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n'] + list(pkgname)) try: @@ -54,7 +73,7 @@ def start(pkgname, ebuild=False, gfx_ui=False, oneshot=False): if gfx_ui: print("\nCannot proceed!\n") print( - "Apply the above changes to your portage configuration files and try again") + "Apply the above changes to your portage configuration files and try again!") for i in range(9, 0, -1): print(f"Killing application in : {i} seconds!") @@ -65,7 +84,7 @@ def start(pkgname, ebuild=False, gfx_ui=False, oneshot=False): print(sisyphus.getcolor.bright_red + "\nCannot proceed!\n" + sisyphus.getcolor.reset) print(sisyphus.getcolor.bright_yellow + - "Apply the above changes to your portage configuration files and try again" + sisyphus.getcolor.reset) + "Apply the above changes to your portage configuration files and try again!" + sisyphus.getcolor.reset) sys.exit() else: if len(bin_list) == 0 and len(src_list) == 0: diff --git a/src/backend/solvedeps.py b/src/backend/solvedeps.py index 3f2053d..24d4613 100644 --- a/src/backend/solvedeps.py +++ b/src/backend/solvedeps.py @@ -20,6 +20,7 @@ signal.signal(signal.SIGINT, sigint_handler) def start(pkgname=None): bin_list = [] src_list = [] + is_vague = int() need_cfg = int() if pkgname: @@ -35,6 +36,10 @@ def start(pkgname=None): stdout, stderr = p_exe.communicate() for p_out in stderr.decode('utf-8').splitlines(): + if pkgname: + if "The short ebuild name" + " " + ', '.join(f'"{package}"' for package in pkgname) + " " + "is ambiguous." in p_out: + is_vague = int(1) + if any(key in p_out for key in ["The following keyword changes are necessary to proceed:", "The following mask changes are necessary to proceed:", "The following USE changes are necessary to proceed:", @@ -52,11 +57,11 @@ def start(pkgname=None): src_list.append(is_src) if pkgname: - pickle.dump([bin_list, src_list, need_cfg], open(os.path.join( - sisyphus.getfs.p_mtd_dir, "sisyphus_pkgdeps.pickle"), "wb")) + pickle.dump([bin_list, src_list, is_vague, need_cfg], open( + os.path.join(sisyphus.getfs.p_mtd_dir, "sisyphus_pkgdeps.pickle"), "wb")) else: - pickle.dump([bin_list, src_list, need_cfg], open(os.path.join( - sisyphus.getfs.p_mtd_dir, "sisyphus_worlddeps.pickle"), "wb")) + pickle.dump([bin_list, src_list, is_vague, need_cfg], open( + os.path.join(sisyphus.getfs.p_mtd_dir, "sisyphus_worlddeps.pickle"), "wb")) except KeyboardInterrupt: p_exe.terminate() try: diff --git a/src/backend/upgrade.py b/src/backend/upgrade.py index bf2c1e7..67f92ae 100644 --- a/src/backend/upgrade.py +++ b/src/backend/upgrade.py @@ -36,7 +36,7 @@ def start(ebuild=False, gfx_ui=False): sisyphus.update.start(gfx_ui=False) sisyphus.solvedeps.start() - bin_list, src_list, need_cfg = pickle.load( + bin_list, src_list, is_vague, need_cfg = pickle.load( open(os.path.join(sisyphus.getfs.p_mtd_dir, "sisyphus_worlddeps.pickle"), "rb")) if need_cfg != 0: # catch aliens |