From 7d32051b5114160c66c354972f8a64a00d331c6c Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sun, 25 Feb 2024 21:35:12 +0000 Subject: rename some functions --- src/backend/__init__.py | 16 +- src/backend/autoremove.py | 50 ------ src/backend/autormpkgsrc.py | 50 ++++++ src/backend/dlbinpkg.py | 59 +++++++ src/backend/dlpkg.py | 59 ------- src/backend/install.py | 367 --------------------------------------- src/backend/instpkgsrc.py | 367 +++++++++++++++++++++++++++++++++++++++ src/backend/mirrors.py | 72 -------- src/backend/rmpkgsrc.py | 107 ++++++++++++ src/backend/searchdb.py | 4 +- src/backend/setbranch.py | 10 +- src/backend/setmirror.py | 72 ++++++++ src/backend/solverdeps.py | 41 ----- src/backend/solverevdeps.py | 41 +++++ src/backend/syncall.py | 88 ++++++++++ src/backend/sysupgrade.py | 353 +++++++++++++++++++++++++++++++++++++ src/backend/uninstall.py | 107 ------------ src/backend/update.py | 88 ---------- src/backend/upgrade.py | 353 ------------------------------------- src/frontend/cli/sisyphus-cli.py | 20 +-- src/frontend/gui/sisyphus-gui.py | 14 +- 21 files changed, 1169 insertions(+), 1169 deletions(-) delete mode 100644 src/backend/autoremove.py create mode 100644 src/backend/autormpkgsrc.py create mode 100644 src/backend/dlbinpkg.py delete mode 100644 src/backend/dlpkg.py delete mode 100644 src/backend/install.py create mode 100644 src/backend/instpkgsrc.py delete mode 100644 src/backend/mirrors.py create mode 100644 src/backend/rmpkgsrc.py create mode 100644 src/backend/setmirror.py delete mode 100644 src/backend/solverdeps.py create mode 100644 src/backend/solverevdeps.py create mode 100644 src/backend/syncall.py create mode 100644 src/backend/sysupgrade.py delete mode 100644 src/backend/uninstall.py delete mode 100644 src/backend/update.py delete mode 100644 src/backend/upgrade.py (limited to 'src') diff --git a/src/backend/__init__.py b/src/backend/__init__.py index b820950..6da1678 100644 --- a/src/backend/__init__.py +++ b/src/backend/__init__.py @@ -1,24 +1,24 @@ -from .autoremove import * +from .autormpkgsrc import * from .checkenv import * -from .dlpkg import * +from .dlbinpkg import * from .getclr import * from .getenv import * from .getfs import * -from .install import * +from .instpkgsrc import * from .killemerge import * -from .mirrors import * from .purgeenv import * from .recoverdb import * +from .rmpkgsrc import * from .solvedeps import * -from .solverdeps import * +from .solverevdeps import * from .searchdb import * from .setbranch import * from .setjobs import * +from .setmirror import * from .setprofile import * +from .syncall import * from .syncdb import * from .syncenv import * from .syncspm import * from .sysinfo import * -from .uninstall import * -from .update import * -from .upgrade import * +from .sysupgrade import * diff --git a/src/backend/autoremove.py b/src/backend/autoremove.py deleted file mode 100644 index 3f0c852..0000000 --- a/src/backend/autoremove.py +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/python3 - -import atexit -import io -import signal -import subprocess -import sys -import sisyphus.checkenv -import sisyphus.getclr -import sisyphus.killemerge -import sisyphus.syncdb - - -def sigint_handler(signal, frame): - sys.exit(0) - - -signal.signal(signal.SIGINT, sigint_handler) - - -def start(gfx_ui=False): - args = ['--quiet', '--depclean'] - - if sisyphus.checkenv.root() and not gfx_ui: - p_exe = subprocess.Popen(['emerge'] + args + ['--ask']) - try: - p_exe.wait() - sisyphus.syncdb.lcl_tbl() - except KeyboardInterrupt: - p_exe.terminate() - try: - p_exe.wait(1) - except subprocess.TimeoutExpired: - p_exe.kill() - sys.exit() - elif gfx_ui: - p_exe = subprocess.Popen( - ['emerge'] + args, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - # kill portage if the program dies or it's terminated by the user - atexit.register(sisyphus.killemerge.start, p_exe) - - for p_out in io.TextIOWrapper(p_exe.stdout, encoding="utf-8"): - print(p_out.rstrip()) - - p_exe.wait() - sisyphus.syncdb.lcl_tbl() - else: - print(sisyphus.getclr.bright_red + - "\nYou need root permissions to do this!\n" + sisyphus.getclr.reset) - sys.exit() diff --git a/src/backend/autormpkgsrc.py b/src/backend/autormpkgsrc.py new file mode 100644 index 0000000..3f0c852 --- /dev/null +++ b/src/backend/autormpkgsrc.py @@ -0,0 +1,50 @@ +#!/usr/bin/python3 + +import atexit +import io +import signal +import subprocess +import sys +import sisyphus.checkenv +import sisyphus.getclr +import sisyphus.killemerge +import sisyphus.syncdb + + +def sigint_handler(signal, frame): + sys.exit(0) + + +signal.signal(signal.SIGINT, sigint_handler) + + +def start(gfx_ui=False): + args = ['--quiet', '--depclean'] + + if sisyphus.checkenv.root() and not gfx_ui: + p_exe = subprocess.Popen(['emerge'] + args + ['--ask']) + try: + p_exe.wait() + sisyphus.syncdb.lcl_tbl() + except KeyboardInterrupt: + p_exe.terminate() + try: + p_exe.wait(1) + except subprocess.TimeoutExpired: + p_exe.kill() + sys.exit() + elif gfx_ui: + p_exe = subprocess.Popen( + ['emerge'] + args, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + # kill portage if the program dies or it's terminated by the user + atexit.register(sisyphus.killemerge.start, p_exe) + + for p_out in io.TextIOWrapper(p_exe.stdout, encoding="utf-8"): + print(p_out.rstrip()) + + p_exe.wait() + sisyphus.syncdb.lcl_tbl() + else: + print(sisyphus.getclr.bright_red + + "\nYou need root permissions to do this!\n" + sisyphus.getclr.reset) + sys.exit() diff --git a/src/backend/dlbinpkg.py b/src/backend/dlbinpkg.py new file mode 100644 index 0000000..ce089ad --- /dev/null +++ b/src/backend/dlbinpkg.py @@ -0,0 +1,59 @@ +#!/usr/bin/python3 + +import atexit +import io +import os +import signal +import subprocess +import sys +import pickle +import sisyphus.getfs +import sisyphus.killemerge + + +def sigint_handler(signal, frame): + sys.exit(0) + + +signal.signal(signal.SIGINT, sigint_handler) + + +def start(dl_world=False, gfx_ui=False): + dl_list = [] + + if dl_world: + file_path = os.path.join( + sisyphus.getfs.p_mtd_dir, "sisyphus_worlddeps.pickle") + else: + file_path = os.path.join( + sisyphus.getfs.p_mtd_dir, "sisyphus_pkgdeps.pickle") + + with open(file_path, "rb") as f: + bin_list, src_list, is_vague, need_cfg = pickle.load(f) + + dl_list = [f'={package}' for package in bin_list] + + args = ['--nodeps', '--quiet', '--verbose', '--getbinpkg', '--fetchonly', '--rebuilt-binaries', + '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n'] + list(dl_list) + + if gfx_ui: + p_exe = subprocess.Popen( + ['emerge'] + args, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + # kill portage if the program dies or it's terminated by the user + atexit.register(sisyphus.killemerge.start, p_exe) + + for p_out in io.TextIOWrapper(p_exe.stdout, encoding="utf-8"): + print(p_out.rstrip()) + + p_exe.wait() + else: + p_exe = subprocess.Popen(['emerge'] + args) + try: + p_exe.wait() + except KeyboardInterrupt: + p_exe.terminate() + try: + p_exe.wait(1) + except subprocess.TimeoutExpired: + p_exe.kill() + sys.exit() diff --git a/src/backend/dlpkg.py b/src/backend/dlpkg.py deleted file mode 100644 index ce089ad..0000000 --- a/src/backend/dlpkg.py +++ /dev/null @@ -1,59 +0,0 @@ -#!/usr/bin/python3 - -import atexit -import io -import os -import signal -import subprocess -import sys -import pickle -import sisyphus.getfs -import sisyphus.killemerge - - -def sigint_handler(signal, frame): - sys.exit(0) - - -signal.signal(signal.SIGINT, sigint_handler) - - -def start(dl_world=False, gfx_ui=False): - dl_list = [] - - if dl_world: - file_path = os.path.join( - sisyphus.getfs.p_mtd_dir, "sisyphus_worlddeps.pickle") - else: - file_path = os.path.join( - sisyphus.getfs.p_mtd_dir, "sisyphus_pkgdeps.pickle") - - with open(file_path, "rb") as f: - bin_list, src_list, is_vague, need_cfg = pickle.load(f) - - dl_list = [f'={package}' for package in bin_list] - - args = ['--nodeps', '--quiet', '--verbose', '--getbinpkg', '--fetchonly', '--rebuilt-binaries', - '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n'] + list(dl_list) - - if gfx_ui: - p_exe = subprocess.Popen( - ['emerge'] + args, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - # kill portage if the program dies or it's terminated by the user - atexit.register(sisyphus.killemerge.start, p_exe) - - for p_out in io.TextIOWrapper(p_exe.stdout, encoding="utf-8"): - print(p_out.rstrip()) - - p_exe.wait() - else: - p_exe = subprocess.Popen(['emerge'] + args) - try: - p_exe.wait() - except KeyboardInterrupt: - p_exe.terminate() - try: - p_exe.wait(1) - except subprocess.TimeoutExpired: - p_exe.kill() - sys.exit() diff --git a/src/backend/install.py b/src/backend/install.py deleted file mode 100644 index 6a95bee..0000000 --- a/src/backend/install.py +++ /dev/null @@ -1,367 +0,0 @@ -#!/usr/bin/python3 - -import atexit -import fcntl -import io -import os -import pickle -import selectors -import signal -import subprocess -import sys -import time -import sisyphus.checkenv -import sisyphus.dlpkg -import sisyphus.getclr -import sisyphus.getfs -import sisyphus.killemerge -import sisyphus.solvedeps -import sisyphus.syncdb -import sisyphus.update - - -def set_nonblocking(fd): - flags = fcntl.fcntl(fd, fcntl.F_GETFL) - fcntl.fcntl(fd, fcntl.F_SETFL, flags | os.O_NONBLOCK) - - -def spinner_animation(): - spinner = ['-', '\\', '|', '/'] - sel = selectors.DefaultSelector() - sel.register(sys.stdin, selectors.EVENT_READ) - - for _ in range(10): - for char in spinner: - sys.stdout.write('\b' + char) - sys.stdout.flush() - events = sel.select(timeout=0.1) - if events: - return - sys.stdout.write('\b') - - -def sigint_handler(signal, frame): - sys.exit(0) - - -signal.signal(signal.SIGINT, sigint_handler) - - -def start(pkgname, ebuild=False, gfx_ui=False, oneshot=False): - if not sisyphus.checkenv.root(): - print(sisyphus.getclr.bright_red + - "\nYou need root permissions to do this!\n" + sisyphus.getclr.reset) - sys.exit() - else: - if gfx_ui: - sisyphus.solvedeps.start.__wrapped__(pkgname) # undecorate - else: - sisyphus.update.start(gfx_ui=False) - sisyphus.solvedeps.start(pkgname) - - bin_list, src_list, is_vague, need_cfg = pickle.load( - open(os.path.join(sisyphus.getfs.p_mtd_dir, "sisyphus_pkgdeps.pickle"), "rb")) - - if is_vague != 0: # catch ambiguous packages - p_exe = subprocess.Popen(['emerge', '--quiet', '--pretend', '--getbinpkg', '--rebuilt-binaries', - '--with-bdeps=y', '--misspell-suggestion=y', '--fuzzy-search=y'] + 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 /, no ambiguity - else: - 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: - p_exe.wait() - except KeyboardInterrupt: - p_exe.terminate() - try: - p_exe.wait(1) - except subprocess.TimeoutExpired: - p_exe.kill() - sys.exit() - if gfx_ui: - print("\nCannot proceed!\n") - print( - "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!") - time.sleep(1) - - sys.exit(app.exec_()) # kill GUI window - else: - print(sisyphus.getclr.bright_red + - "\nCannot proceed!\n" + sisyphus.getclr.reset) - print(sisyphus.getclr.bright_yellow + - "Apply the above changes to your portage configuration files and try again!" + sisyphus.getclr.reset) - sys.exit() - else: - if len(bin_list) == 0 and len(src_list) == 0: - print(sisyphus.getclr.bright_red + - "\nNo package found!\n" + sisyphus.getclr.reset) - sys.exit() - - if ebuild: # ebuild mode - if len(bin_list) == 0 and len(src_list) != 0: # source mode, ignore aliens - print("\n" + sisyphus.getclr.green + - "These are the source packages that would be merged, in order:" + sisyphus.getclr.reset + "\n") - print("\n" + sisyphus.getclr.green + - ", ".join(src_list) + sisyphus.getclr.reset + "\n") - print("\n" + sisyphus.getclr.bright_white + "Total:" + " " + str( - len(src_list)) + " " + "source package(s)" + sisyphus.getclr.reset + "\n") - while True: - user_input = input(sisyphus.getclr.bright_white + "Would you like to proceed?" + sisyphus.getclr.reset + " " + - "[" + sisyphus.getclr.bright_green + "Yes" + sisyphus.getclr.reset + "/" + sisyphus.getclr.bright_red + "No" + sisyphus.getclr.reset + "]" + " ") - if user_input.lower() in ['yes', 'y', '']: - p_exe = subprocess.Popen(['emerge', '--quiet', '--verbose', '--with-bdeps=y', '--misspell-suggestion=n', - '--fuzzy-search=n'] + (['--oneshot'] if oneshot else []) + list(pkgname)) - try: - set_nonblocking(sys.stdout.fileno()) - spinner_animation() - - sel = selectors.DefaultSelector() - sel.register(sys.stdin, selectors.EVENT_READ) - - while True: - events = sel.select(timeout=0.1) - for key, mask in events: - if key.fileobj == sys.stdin: - line = sys.stdin.readline().strip() - if line.lower() == 'q': - sys.exit() - if p_exe.poll() is not None: - break - except KeyboardInterrupt: - p_exe.terminate() - try: - p_exe.wait(1) - except subprocess.TimeoutExpired: - p_exe.kill() - sys.exit() - finally: - p_exe.wait() - sisyphus.syncdb.lcl_tbl() - break - elif user_input.lower() in ['no', 'n']: - break - else: - print("\nSorry, response" + " " + "'" + - user_input + "'" + " " + "not understood.\n") - continue - elif len(bin_list) != 0 and len(src_list) != 0: # hybrid mode, ignore aliens - print("\n" + sisyphus.getclr.green + - "These are the binary packages that would be merged, in order:" + sisyphus.getclr.reset + "\n") - print("\n" + sisyphus.getclr.magenta + - ", ".join(bin_list) + sisyphus.getclr.reset + "\n") - print("\n" + sisyphus.getclr.bright_white + "Total:" + " " + str( - len(bin_list)) + " " + "binary package(s)" + sisyphus.getclr.reset + "\n") - - print("\n" + sisyphus.getclr.green + - "These are the source packages that would be merged, in order:" + sisyphus.getclr.reset + "\n") - print("\n" + sisyphus.getclr.green + - ", ".join(src_list) + sisyphus.getclr.reset + "\n") - print("\n" + sisyphus.getclr.bright_white + "Total:" + " " + str( - len(src_list)) + " " + "source package(s)" + sisyphus.getclr.reset + "\n") - while True: - user_input = input(sisyphus.getclr.bright_white + "Would you like to proceed?" + sisyphus.getclr.reset + " " + - "[" + sisyphus.getclr.bright_green + "Yes" + sisyphus.getclr.reset + "/" + sisyphus.getclr.bright_red + "No" + sisyphus.getclr.reset + "]" + " ") - if user_input.lower() in ['yes', 'y', '']: - sisyphus.dlpkg.start(dl_world=False, gfx_ui=False) - os.chdir(sisyphus.getfs.p_cch_dir) - p_exe = subprocess.Popen(['emerge', '--quiet', '--verbose', '--usepkg', '--rebuilt-binaries', '--with-bdeps=y', - '--misspell-suggestion=n', '--fuzzy-search=n'] + (['--oneshot'] if oneshot else []) + list(pkgname)) - try: - set_nonblocking(sys.stdout.fileno()) - spinner_animation() - - sel = selectors.DefaultSelector() - sel.register(sys.stdin, selectors.EVENT_READ) - - while True: - events = sel.select(timeout=0.1) - for key, mask in events: - if key.fileobj == sys.stdin: - line = sys.stdin.readline().strip() - if line.lower() == 'q': - sys.exit() - if p_exe.poll() is not None: - break - except KeyboardInterrupt: - p_exe.terminate() - try: - p_exe.wait(1) - except subprocess.TimeoutExpired: - p_exe.kill() - sys.exit() - finally: - p_exe.wait() - sisyphus.syncdb.lcl_tbl() - break - elif user_input.lower() in ['no', 'n']: - break - else: - print("\nSorry, response" + " " + "'" + - user_input + "'" + " " + "not understood.\n") - continue - elif len(bin_list) != 0 and len(src_list) == 0: # binary mode, fallback - print("\n" + sisyphus.getclr.green + - "These are the binary packages that would be merged, in order:" + sisyphus.getclr.reset + "\n") - print("\n" + sisyphus.getclr.magenta + - ", ".join(bin_list) + sisyphus.getclr.reset + "\n") - print("\n" + sisyphus.getclr.bright_white + "Total:" + " " + str( - len(bin_list)) + " " + "binary package(s)" + sisyphus.getclr.reset + "\n") - while True: - user_input = input(sisyphus.getclr.bright_white + "Would you like to proceed?" + sisyphus.getclr.reset + " " + - "[" + sisyphus.getclr.bright_green + "Yes" + sisyphus.getclr.reset + "/" + sisyphus.getclr.bright_red + "No" + sisyphus.getclr.reset + "]" + " ") - if user_input.lower() in ['yes', 'y', '']: - sisyphus.dlpkg.start(dl_world=False, gfx_ui=False) - os.chdir(sisyphus.getfs.p_cch_dir) - p_exe = subprocess.Popen(['emerge', '--quiet', '--verbose', '--usepkg', '--usepkgonly', '--rebuilt-binaries', - '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n'] + (['--oneshot'] if oneshot else []) + list(pkgname)) - try: - set_nonblocking(sys.stdout.fileno()) - spinner_animation() - - sel = selectors.DefaultSelector() - sel.register(sys.stdin, selectors.EVENT_READ) - - while True: - events = sel.select(timeout=0.1) - for key, mask in events: - if key.fileobj == sys.stdin: - line = sys.stdin.readline().strip() - if line.lower() == 'q': - sys.exit() - if p_exe.poll() is not None: - break - except KeyboardInterrupt: - p_exe.terminate() - try: - p_exe.wait(1) - except subprocess.TimeoutExpired: - p_exe.kill() - sys.exit() - finally: - p_exe.wait() - sisyphus.syncdb.lcl_tbl() - break - elif user_input.lower() in ['no', 'n']: - break - else: - print("\nSorry, response" + " " + "'" + - user_input + "'" + " " + "not understood.\n") - continue - else: # non-ebuild mode - if len(bin_list) == 0 and len(src_list) != 0: # source mode (noop), catch aliens - if gfx_ui: - print("\nSource package(s) found in the mix!\n") - print("Use sisyphus CLI:" + " " + "'" + "sisyphus install" + - " " + " ".join(pkgname) + "--ebuild" + "'") - - for i in range(9, 0, -1): - print(f"Killing application in : {i} seconds!") - time.sleep(1) - - sys.exit(app.exec_()) # kill GUI window - else: - print(sisyphus.getclr.bright_red + - "\nSource package(s) found in the mix!\n" + sisyphus.getclr.reset) - print(sisyphus.getclr.bright_yellow + "Use" + sisyphus.getclr.reset + " " + - "'" + "sisyphus install" + " " + " ".join(pkgname) + " " + "--ebuild" + "'") - sys.exit() - elif len(bin_list) != 0 and len(src_list) != 0: # hybrid mode (noop), catch aliens - if gfx_ui: - print("\nSource package(s) found in the mix!\n") - print("Use sisyphus CLI:" + " " + "'" + "sisyphus install" + - " " + " ".join(pkgname) + "--ebuild" + "'") - - for i in range(9, 0, -1): - print(f"Killing application in : {i} seconds!") - time.sleep(1) - - sys.exit(app.exec_()) # kill GUI window - else: - print(sisyphus.getclr.bright_red + - "\nSource package(s) found in the mix!\n" + sisyphus.getclr.reset) - print(sisyphus.getclr.bright_yellow + "Use" + sisyphus.getclr.reset + " " + - "'" + "sisyphus install" + " " + " ".join(pkgname) + " " + "--ebuild" + "'") - sys.exit() - elif len(bin_list) != 0 and len(src_list) == 0: # binary mode - if gfx_ui: - print( - "\n" + "These are the binary packages that will be merged, in order:" + "\n") - print("\n" + ", ".join(bin_list) + "\n\n" + "Total:" + " " + - str(len(bin_list)) + " " + "binary package(s)" + "\n\n") - sisyphus.dlpkg.start(dl_world=False, gfx_ui=True) - os.chdir(sisyphus.getfs.p_cch_dir) - p_exe = subprocess.Popen(['emerge', '--quiet', '--verbose', '--usepkg', '--usepkgonly', '--rebuilt-binaries', '--with-bdeps=y', - '--misspell-suggestion=n', '--fuzzy-search=n'] + pkgname, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - # kill portage if the program dies or it's terminated by the user - atexit.register(sisyphus.killemerge.start, p_exe) - - for p_out in io.TextIOWrapper(p_exe.stdout, encoding="utf-8"): - print(p_out.rstrip()) - - p_exe.wait() - sisyphus.syncdb.lcl_tbl() - else: - print("\n" + sisyphus.getclr.green + - "These are the binary packages that would be merged, in order:" + sisyphus.getclr.reset + "\n") - print("\n" + sisyphus.getclr.magenta + - ", ".join(bin_list) + sisyphus.getclr.reset + "\n") - print("\n" + sisyphus.getclr.bright_white + "Total:" + " " + str( - len(bin_list)) + " " + "binary package(s)" + sisyphus.getclr.reset + "\n") - while True: - user_input = input(sisyphus.getclr.bright_white + "Would you like to proceed?" + sisyphus.getclr.reset + " " + - "[" + sisyphus.getclr.bright_green + "Yes" + sisyphus.getclr.reset + "/" + sisyphus.getclr.bright_red + "No" + sisyphus.getclr.reset + "]" + " ") - if user_input.lower() in ['yes', 'y', '']: - sisyphus.dlpkg.start( - dl_world=False, gfx_ui=False) - os.chdir(sisyphus.getfs.p_cch_dir) - p_exe = subprocess.Popen(['emerge', '--quiet', '--verbose', '--usepkg', '--usepkgonly', '--rebuilt-binaries', - '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n'] + (['--oneshot'] if oneshot else []) + list(pkgname)) - try: - set_nonblocking(sys.stdout.fileno()) - spinner_animation() - - sel = selectors.DefaultSelector() - sel.register(sys.stdin, selectors.EVENT_READ) - - while True: - events = sel.select(timeout=0.1) - for key, mask in events: - if key.fileobj == sys.stdin: - line = sys.stdin.readline().strip() - if line.lower() == 'q': - sys.exit() - if p_exe.poll() is not None: - break - except KeyboardInterrupt: - p_exe.terminate() - try: - p_exe.wait(1) - except subprocess.TimeoutExpired: - p_exe.kill() - sys.exit() - finally: - p_exe.wait() - sisyphus.syncdb.lcl_tbl() - break - elif user_input.lower() in ['no', 'n']: - break - else: - print("\nSorry, response" + " " + "'" + - user_input + "'" + " " + "not understood.\n") - continue diff --git a/src/backend/instpkgsrc.py b/src/backend/instpkgsrc.py new file mode 100644 index 0000000..26e5132 --- /dev/null +++ b/src/backend/instpkgsrc.py @@ -0,0 +1,367 @@ +#!/usr/bin/python3 + +import atexit +import fcntl +import io +import os +import pickle +import selectors +import signal +import subprocess +import sys +import time +import sisyphus.checkenv +import sisyphus.dlbinpkg +import sisyphus.getclr +import sisyphus.getfs +import sisyphus.killemerge +import sisyphus.solvedeps +import sisyphus.syncdb +import sisyphus.syncall + + +def set_nonblocking(fd): + flags = fcntl.fcntl(fd, fcntl.F_GETFL) + fcntl.fcntl(fd, fcntl.F_SETFL, flags | os.O_NONBLOCK) + + +def spinner_animation(): + spinner = ['-', '\\', '|', '/'] + sel = selectors.DefaultSelector() + sel.register(sys.stdin, selectors.EVENT_READ) + + for _ in range(10): + for char in spinner: + sys.stdout.write('\b' + char) + sys.stdout.flush() + events = sel.select(timeout=0.1) + if events: + return + sys.stdout.write('\b') + + +def sigint_handler(signal, frame): + sys.exit(0) + + +signal.signal(signal.SIGINT, sigint_handler) + + +def start(pkgname, ebuild=False, gfx_ui=False, oneshot=False): + if not sisyphus.checkenv.root(): + print(sisyphus.getclr.bright_red + + "\nYou need root permissions to do this!\n" + sisyphus.getclr.reset) + sys.exit() + else: + if gfx_ui: + sisyphus.solvedeps.start.__wrapped__(pkgname) # undecorate + else: + sisyphus.syncall.start(gfx_ui=False) + sisyphus.solvedeps.start(pkgname) + + bin_list, src_list, is_vague, need_cfg = pickle.load( + open(os.path.join(sisyphus.getfs.p_mtd_dir, "sisyphus_pkgdeps.pickle"), "rb")) + + if is_vague != 0: # catch ambiguous packages + p_exe = subprocess.Popen(['emerge', '--quiet', '--pretend', '--getbinpkg', '--rebuilt-binaries', + '--with-bdeps=y', '--misspell-suggestion=y', '--fuzzy-search=y'] + 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 /, no ambiguity + else: + 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: + p_exe.wait() + except KeyboardInterrupt: + p_exe.terminate() + try: + p_exe.wait(1) + except subprocess.TimeoutExpired: + p_exe.kill() + sys.exit() + if gfx_ui: + print("\nCannot proceed!\n") + print( + "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!") + time.sleep(1) + + sys.exit(app.exec_()) # kill GUI window + else: + print(sisyphus.getclr.bright_red + + "\nCannot proceed!\n" + sisyphus.getclr.reset) + print(sisyphus.getclr.bright_yellow + + "Apply the above changes to your portage configuration files and try again!" + sisyphus.getclr.reset) + sys.exit() + else: + if len(bin_list) == 0 and len(src_list) == 0: + print(sisyphus.getclr.bright_red + + "\nNo package found!\n" + sisyphus.getclr.reset) + sys.exit() + + if ebuild: # ebuild mode + if len(bin_list) == 0 and len(src_list) != 0: # source mode, ignore aliens + print("\n" + sisyphus.getclr.green + + "These are the source packages that would be merged, in order:" + sisyphus.getclr.reset + "\n") + print("\n" + sisyphus.getclr.green + + ", ".join(src_list) + sisyphus.getclr.reset + "\n") + print("\n" + sisyphus.getclr.bright_white + "Total:" + " " + str( + len(src_list)) + " " + "source package(s)" + sisyphus.getclr.reset + "\n") + while True: + user_input = input(sisyphus.getclr.bright_white + "Would you like to proceed?" + sisyphus.getclr.reset + " " + + "[" + sisyphus.getclr.bright_green + "Yes" + sisyphus.getclr.reset + "/" + sisyphus.getclr.bright_red + "No" + sisyphus.getclr.reset + "]" + " ") + if user_input.lower() in ['yes', 'y', '']: + p_exe = subprocess.Popen(['emerge', '--quiet', '--verbose', '--with-bdeps=y', '--misspell-suggestion=n', + '--fuzzy-search=n'] + (['--oneshot'] if oneshot else []) + list(pkgname)) + try: + set_nonblocking(sys.stdout.fileno()) + spinner_animation() + + sel = selectors.DefaultSelector() + sel.register(sys.stdin, selectors.EVENT_READ) + + while True: + events = sel.select(timeout=0.1) + for key, mask in events: + if key.fileobj == sys.stdin: + line = sys.stdin.readline().strip() + if line.lower() == 'q': + sys.exit() + if p_exe.poll() is not None: + break + except KeyboardInterrupt: + p_exe.terminate() + try: + p_exe.wait(1) + except subprocess.TimeoutExpired: + p_exe.kill() + sys.exit() + finally: + p_exe.wait() + sisyphus.syncdb.lcl_tbl() + break + elif user_input.lower() in ['no', 'n']: + break + else: + print("\nSorry, response" + " " + "'" + + user_input + "'" + " " + "not understood.\n") + continue + elif len(bin_list) != 0 and len(src_list) != 0: # hybrid mode, ignore aliens + print("\n" + sisyphus.getclr.green + + "These are the binary packages that would be merged, in order:" + sisyphus.getclr.reset + "\n") + print("\n" + sisyphus.getclr.magenta + + ", ".join(bin_list) + sisyphus.getclr.reset + "\n") + print("\n" + sisyphus.getclr.bright_white + "Total:" + " " + str( + len(bin_list)) + " " + "binary package(s)" + sisyphus.getclr.reset + "\n") + + print("\n" + sisyphus.getclr.green + + "These are the source packages that would be merged, in order:" + sisyphus.getclr.reset + "\n") + print("\n" + sisyphus.getclr.green + + ", ".join(src_list) + sisyphus.getclr.reset + "\n") + print("\n" + sisyphus.getclr.bright_white + "Total:" + " " + str( + len(src_list)) + " " + "source package(s)" + sisyphus.getclr.reset + "\n") + while True: + user_input = input(sisyphus.getclr.bright_white + "Would you like to proceed?" + sisyphus.getclr.reset + " " + + "[" + sisyphus.getclr.bright_green + "Yes" + sisyphus.getclr.reset + "/" + sisyphus.getclr.bright_red + "No" + sisyphus.getclr.reset + "]" + " ") + if user_input.lower() in ['yes', 'y', '']: + sisyphus.dlbinpkg.start(dl_world=False, gfx_ui=False) + os.chdir(sisyphus.getfs.p_cch_dir) + p_exe = subprocess.Popen(['emerge', '--quiet', '--verbose', '--usepkg', '--rebuilt-binaries', '--with-bdeps=y', + '--misspell-suggestion=n', '--fuzzy-search=n'] + (['--oneshot'] if oneshot else []) + list(pkgname)) + try: + set_nonblocking(sys.stdout.fileno()) + spinner_animation() + + sel = selectors.DefaultSelector() + sel.register(sys.stdin, selectors.EVENT_READ) + + while True: + events = sel.select(timeout=0.1) + for key, mask in events: + if key.fileobj == sys.stdin: + line = sys.stdin.readline().strip() + if line.lower() == 'q': + sys.exit() + if p_exe.poll() is not None: + break + except KeyboardInterrupt: + p_exe.terminate() + try: + p_exe.wait(1) + except subprocess.TimeoutExpired: + p_exe.kill() + sys.exit() + finally: + p_exe.wait() + sisyphus.syncdb.lcl_tbl() + break + elif user_input.lower() in ['no', 'n']: + break + else: + print("\nSorry, response" + " " + "'" + + user_input + "'" + " " + "not understood.\n") + continue + elif len(bin_list) != 0 and len(src_list) == 0: # binary mode, fallback + print("\n" + sisyphus.getclr.green + + "These are the binary packages that would be merged, in order:" + sisyphus.getclr.reset + "\n") + print("\n" + sisyphus.getclr.magenta + + ", ".join(bin_list) + sisyphus.getclr.reset + "\n") + print("\n" + sisyphus.getclr.bright_white + "Total:" + " " + str( + len(bin_list)) + " " + "binary package(s)" + sisyphus.getclr.reset + "\n") + while True: + user_input = input(sisyphus.getclr.bright_white + "Would you like to proceed?" + sisyphus.getclr.reset + " " + + "[" + sisyphus.getclr.bright_green + "Yes" + sisyphus.getclr.reset + "/" + sisyphus.getclr.bright_red + "No" + sisyphus.getclr.reset + "]" + " ") + if user_input.lower() in ['yes', 'y', '']: + sisyphus.dlbinpkg.start(dl_world=False, gfx_ui=False) + os.chdir(sisyphus.getfs.p_cch_dir) + p_exe = subprocess.Popen(['emerge', '--quiet', '--verbose', '--usepkg', '--usepkgonly', '--rebuilt-binaries', + '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n'] + (['--oneshot'] if oneshot else []) + list(pkgname)) + try: + set_nonblocking(sys.stdout.fileno()) + spinner_animation() + + sel = selectors.DefaultSelector() + sel.register(sys.stdin, selectors.EVENT_READ) + + while True: + events = sel.select(timeout=0.1) + for key, mask in events: + if key.fileobj == sys.stdin: + line = sys.stdin.readline().strip() + if line.lower() == 'q': + sys.exit() + if p_exe.poll() is not None: + break + except KeyboardInterrupt: + p_exe.terminate() + try: + p_exe.wait(1) + except subprocess.TimeoutExpired: + p_exe.kill() + sys.exit() + finally: + p_exe.wait() + sisyphus.syncdb.lcl_tbl() + break + elif user_input.lower() in ['no', 'n']: + break + else: + print("\nSorry, response" + " " + "'" + + user_input + "'" + " " + "not understood.\n") + continue + else: # non-ebuild mode + if len(bin_list) == 0 and len(src_list) != 0: # source mode (noop), catch aliens + if gfx_ui: + print("\nSource package(s) found in the mix!\n") + print("Use sisyphus CLI:" + " " + "'" + "sisyphus install" + + " " + " ".join(pkgname) + "--ebuild" + "'") + + for i in range(9, 0, -1): + print(f"Killing application in : {i} seconds!") + time.sleep(1) + + sys.exit(app.exec_()) # kill GUI window + else: + print(sisyphus.getclr.bright_red + + "\nSource package(s) found in the mix!\n" + sisyphus.getclr.reset) + print(sisyphus.getclr.bright_yellow + "Use" + sisyphus.getclr.reset + " " + + "'" + "sisyphus install" + " " + " ".join(pkgname) + " " + "--ebuild" + "'") + sys.exit() + elif len(bin_list) != 0 and len(src_list) != 0: # hybrid mode (noop), catch aliens + if gfx_ui: + print("\nSource package(s) found in the mix!\n") + print("Use sisyphus CLI:" + " " + "'" + "sisyphus install" + + " " + " ".join(pkgname) + "--ebuild" + "'") + + for i in range(9, 0, -1): + print(f"Killing application in : {i} seconds!") + time.sleep(1) + + sys.exit(app.exec_()) # kill GUI window + else: + print(sisyphus.getclr.bright_red + + "\nSource package(s) found in the mix!\n" + sisyphus.getclr.reset) + print(sisyphus.getclr.bright_yellow + "Use" + sisyphus.getclr.reset + " " + + "'" + "sisyphus install" + " " + " ".join(pkgname) + " " + "--ebuild" + "'") + sys.exit() + elif len(bin_list) != 0 and len(src_list) == 0: # binary mode + if gfx_ui: + print( + "\n" + "These are the binary packages that will be merged, in order:" + "\n") + print("\n" + ", ".join(bin_list) + "\n\n" + "Total:" + " " + + str(len(bin_list)) + " " + "binary package(s)" + "\n\n") + sisyphus.dlbinpkg.start(dl_world=False, gfx_ui=True) + os.chdir(sisyphus.getfs.p_cch_dir) + p_exe = subprocess.Popen(['emerge', '--quiet', '--verbose', '--usepkg', '--usepkgonly', '--rebuilt-binaries', '--with-bdeps=y', + '--misspell-suggestion=n', '--fuzzy-search=n'] + pkgname, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + # kill portage if the program dies or it's terminated by the user + atexit.register(sisyphus.killemerge.start, p_exe) + + for p_out in io.TextIOWrapper(p_exe.stdout, encoding="utf-8"): + print(p_out.rstrip()) + + p_exe.wait() + sisyphus.syncdb.lcl_tbl() + else: + print("\n" + sisyphus.getclr.green + + "These are the binary packages that would be merged, in order:" + sisyphus.getclr.reset + "\n") + print("\n" + sisyphus.getclr.magenta + + ", ".join(bin_list) + sisyphus.getclr.reset + "\n") + print("\n" + sisyphus.getclr.bright_white + "Total:" + " " + str( + len(bin_list)) + " " + "binary package(s)" + sisyphus.getclr.reset + "\n") + while True: + user_input = input(sisyphus.getclr.bright_white + "Would you like to proceed?" + sisyphus.getclr.reset + " " + + "[" + sisyphus.getclr.bright_green + "Yes" + sisyphus.getclr.reset + "/" + sisyphus.getclr.bright_red + "No" + sisyphus.getclr.reset + "]" + " ") + if user_input.lower() in ['yes', 'y', '']: + sisyphus.dlbinpkg.start( + dl_world=False, gfx_ui=False) + os.chdir(sisyphus.getfs.p_cch_dir) + p_exe = subprocess.Popen(['emerge', '--quiet', '--verbose', '--usepkg', '--usepkgonly', '--rebuilt-binaries', + '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n'] + (['--oneshot'] if oneshot else []) + list(pkgname)) + try: + set_nonblocking(sys.stdout.fileno()) + spinner_animation() + + sel = selectors.DefaultSelector() + sel.register(sys.stdin, selectors.EVENT_READ) + + while True: + events = sel.select(timeout=0.1) + for key, mask in events: + if key.fileobj == sys.stdin: + line = sys.stdin.readline().strip() + if line.lower() == 'q': + sys.exit() + if p_exe.poll() is not None: + break + except KeyboardInterrupt: + p_exe.terminate() + try: + p_exe.wait(1) + except subprocess.TimeoutExpired: + p_exe.kill() + sys.exit() + finally: + p_exe.wait() + sisyphus.syncdb.lcl_tbl() + break + elif user_input.lower() in ['no', 'n']: + break + else: + print("\nSorry, response" + " " + "'" + + user_input + "'" + " " + "not understood.\n") + continue diff --git a/src/backend/mirrors.py b/src/backend/mirrors.py deleted file mode 100644 index 83d83f1..0000000 --- a/src/backend/mirrors.py +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/python3 - -import sisyphus.getfs - - -def getList(): - mirrorList = [] - - with open(sisyphus.getfs.mirrorCfg) as mirrorFile: - for line in mirrorFile.readlines(): - if 'PORTAGE_BINHOST=' in line: - url = line.split("=")[1].replace('"', '').rstrip() - mirror = {'isActive': True, 'Url': url} - if line.startswith('#'): - mirror['isActive'] = False - mirrorList.append(mirror) - mirrorFile.close() - - return mirrorList - - -def printList(): - mirrorList = getList() - - for i, line in enumerate(mirrorList): - if line['isActive']: - print(i + 1, '*', line['Url']) - else: - print(i + 1, ' ', line['Url']) - - -def writeList(mirrorList): - with open(sisyphus.getfs.mirrorCfg, 'w+') as mirrorFile: - mirrorFile.write( - "#######################################################\n") - mirrorFile.write( - "# Support for multiple mirrors is somewhat incomplete #\n") - mirrorFile.write( - "#######################################################\n") - mirrorFile.write( - "# Please avoid using the Main Repository #\n") - mirrorFile.write( - "# http://mirrors.redcorelinux.org/redcorelinux #\n") - mirrorFile.write( - "# as the bandwidth is limited, use mirrors instead #\n") - mirrorFile.write( - "#######################################################\n") - mirrorFile.write( - "# Uncomment only one mirror from the list bellow #\n") - mirrorFile.write( - "#######################################################\n") - mirrorFile.write("\n") - for line in mirrorList: - mirror = 'PORTAGE_BINHOST=' + '"' + line['Url'] + '"' - if not line['isActive']: - mirror = '# ' + mirror - mirrorFile.write(mirror + "\n") - mirrorFile.write("\n") - - -def setActive(mirror): - mirrorList = getList() - if mirror not in range(1, len(mirrorList) + 1): - print("\n" + "Mirror index is wrong, please check with sisyphus mirror list" + "\n") - else: - for i in range(0, len(mirrorList)): - indx = i + 1 - if indx == mirror: - mirrorList[i]['isActive'] = True - else: - mirrorList[i]['isActive'] = False - writeList(mirrorList) diff --git a/src/backend/rmpkgsrc.py b/src/backend/rmpkgsrc.py new file mode 100644 index 0000000..17d5a12 --- /dev/null +++ b/src/backend/rmpkgsrc.py @@ -0,0 +1,107 @@ +#!/usr/bin/python3 + +import atexit +import io +import os +import pickle +import signal +import subprocess +import sys +import sisyphus.checkenv +import sisyphus.getclr +import sisyphus.getfs +import sisyphus.killemerge +import sisyphus.solverevdeps +import sisyphus.syncdb + + +def sigint_handler(signal, frame): + sys.exit(0) + + +signal.signal(signal.SIGINT, sigint_handler) + + +def start(pkgname, depclean=False, gfx_ui=False, unmerge=False): + args = ['--quiet', '--depclean'] + + if not sisyphus.checkenv.root() and (unmerge or depclean): + print(sisyphus.getclr.bright_red + + "\nYou need root permissions to do this!\n" + sisyphus.getclr.reset) + sys.exit() + else: + if gfx_ui: + sisyphus.solverevdeps.start.__wrapped__(pkgname) + else: + sisyphus.solverevdeps.start(pkgname) + + is_needed = pickle.load( + open(os.path.join(sisyphus.getfs.p_mtd_dir, "sisyphus_pkgrevdeps.pickle"), "rb")) + + if is_needed != 0: + if gfx_ui: + p_exe = subprocess.Popen(['emerge'] + args + ['--pretend', '--verbose'] + list( + pkgname), stdout=subprocess.PIPE, stderr=subprocess.PIPE) + # kill portage if the program dies or it's terminated by the user + atexit.register(sisyphus.killemerge.start, p_exe) + + for p_out in io.TextIOWrapper(p_exe.stdout, encoding="utf-8"): + print(p_out.rstrip()) + + p_exe.wait() + print("\nWon't uninstall! Other packages depend on " + str(pkgname)) + else: + p_exe = subprocess.Popen( + ['emerge'] + args + ['--pretend', '--verbose'] + list(pkgname)) + try: + p_exe.wait() + except KeyboardInterrupt: + p_exe.terminate() + try: + p_exe.wait(1) + except subprocess.TimeoutExpired: + p_exe.kill() + sys.exit() + print(sisyphus.getclr.bright_red + + "\nWon't uninstall! Other packages depend on " + sisyphus.getclr.reset + str(pkgname)) + print(sisyphus.getclr.bright_red + "Use the " + sisyphus.getclr.reset + sisyphus.getclr.green + "'--force'" + + sisyphus.getclr.reset + sisyphus.getclr.bright_red + " option to override at your own risk!\n" + sisyphus.getclr.reset) + else: + if unmerge: + p_exe = subprocess.Popen( + ['emerge', '--quiet', '--unmerge', '--ask'] + list(pkgname)) + try: + p_exe.wait() + sisyphus.syncdb.lcl_tbl() + except KeyboardInterrupt: + p_exe.terminate() + try: + p_exe.wait(1) + except subprocess.TimeoutExpired: + p_exe.kill() + sys.exit() + elif depclean: + if gfx_ui: + p_exe = subprocess.Popen( + ['emerge'] + args + pkgname, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + # kill portage if the program dies or it's terminated by the user + atexit.register(sisyphus.killemerge.start, p_exe) + + for p_out in io.TextIOWrapper(p_exe.stdout, encoding="utf-8"): + print(p_out.rstrip()) + + p_exe.wait() + sisyphus.syncdb.lcl_tbl() + else: + p_exe = subprocess.Popen( + ['emerge'] + args + ['--ask'] + list(pkgname)) + try: + p_exe.wait() + sisyphus.syncdb.lcl_tbl() + except KeyboardInterrupt: + p_exe.terminate() + try: + p_exe.wait(1) + except subprocess.TimeoutExpired: + p_exe.kill() + sys.exit() diff --git a/src/backend/searchdb.py b/src/backend/searchdb.py index e344cb2..a99a471 100644 --- a/src/backend/searchdb.py +++ b/src/backend/searchdb.py @@ -6,7 +6,7 @@ import subprocess import sisyphus.checkenv import sisyphus.getclr import sisyphus.getfs -import sisyphus.update +import sisyphus.syncall def sigint_handler(signal, frame): @@ -162,7 +162,7 @@ def start(filter, cat, pn, desc, single): user_input = input(sisyphus.getclr.bright_white + "Would you like to proceed?" + sisyphus.getclr.reset + " " + "[" + sisyphus.getclr.bright_green + "Yes" + sisyphus.getclr.reset + "/" + sisyphus.getclr.bright_red + "No" + sisyphus.getclr.reset + "]" + " ") if user_input.lower() in ['yes', 'y', '']: - sisyphus.update.start(gfx_ui=False) + sisyphus.syncall.start(gfx_ui=False) break elif user_input.lower() in ['no', 'n']: print(sisyphus.getclr.bright_red + diff --git a/src/backend/setbranch.py b/src/backend/setbranch.py index 05b6c5c..4763b60 100644 --- a/src/backend/setbranch.py +++ b/src/backend/setbranch.py @@ -9,9 +9,9 @@ import sys import sisyphus.checkenv import sisyphus.getclr import sisyphus.getfs -import sisyphus.mirrors import sisyphus.purgeenv import sisyphus.setjobs +import sisyphus.setmirror import sisyphus.setprofile @@ -82,17 +82,17 @@ def ins_p_cfg_repo(branch, remote): def set_brch_master_index(): - mirrorList = sisyphus.mirrors.getList() + mirrorList = sisyphus.setmirror.getList() odd_indices = [i + 1 for i in range(len(mirrorList)) if (i + 1) % 2 == 1] chosen_index = random.choice(odd_indices) - sisyphus.mirrors.setActive(chosen_index) + sisyphus.setmirror.setActive(chosen_index) def set_brch_next_index(): - mirrorList = sisyphus.mirrors.getList() + mirrorList = sisyphus.setmirror.getList() even_indices = [i + 1 for i in range(len(mirrorList)) if (i + 1) % 2 == 0] chosen_index = random.choice(even_indices) - sisyphus.mirrors.setActive(chosen_index) + sisyphus.setmirror.setActive(chosen_index) def set_bhst_index(branch, remote): diff --git a/src/backend/setmirror.py b/src/backend/setmirror.py new file mode 100644 index 0000000..83d83f1 --- /dev/null +++ b/src/backend/setmirror.py @@ -0,0 +1,72 @@ +#!/usr/bin/python3 + +import sisyphus.getfs + + +def getList(): + mirrorList = [] + + with open(sisyphus.getfs.mirrorCfg) as mirrorFile: + for line in mirrorFile.readlines(): + if 'PORTAGE_BINHOST=' in line: + url = line.split("=")[1].replace('"', '').rstrip() + mirror = {'isActive': True, 'Url': url} + if line.startswith('#'): + mirror['isActive'] = False + mirrorList.append(mirror) + mirrorFile.close() + + return mirrorList + + +def printList(): + mirrorList = getList() + + for i, line in enumerate(mirrorList): + if line['isActive']: + print(i + 1, '*', line['Url']) + else: + print(i + 1, ' ', line['Url']) + + +def writeList(mirrorList): + with open(sisyphus.getfs.mirrorCfg, 'w+') as mirrorFile: + mirrorFile.write( + "#######################################################\n") + mirrorFile.write( + "# Support for multiple mirrors is somewhat incomplete #\n") + mirrorFile.write( + "#######################################################\n") + mirrorFile.write( + "# Please avoid using the Main Repository #\n") + mirrorFile.write( + "# http://mirrors.redcorelinux.org/redcorelinux #\n") + mirrorFile.write( + "# as the bandwidth is limited, use mirrors instead #\n") + mirrorFile.write( + "#######################################################\n") + mirrorFile.write( + "# Uncomment only one mirror from the list bellow #\n") + mirrorFile.write( + "#######################################################\n") + mirrorFile.write("\n") + for line in mirrorList: + mirror = 'PORTAGE_BINHOST=' + '"' + line['Url'] + '"' + if not line['isActive']: + mirror = '# ' + mirror + mirrorFile.write(mirror + "\n") + mirrorFile.write("\n") + + +def setActive(mirror): + mirrorList = getList() + if mirror not in range(1, len(mirrorList) + 1): + print("\n" + "Mirror index is wrong, please check with sisyphus mirror list" + "\n") + else: + for i in range(0, len(mirrorList)): + indx = i + 1 + if indx == mirror: + mirrorList[i]['isActive'] = True + else: + mirrorList[i]['isActive'] = False + writeList(mirrorList) diff --git a/src/backend/solverdeps.py b/src/backend/solverdeps.py deleted file mode 100644 index 97d19dd..0000000 --- a/src/backend/solverdeps.py +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/python3 - -import animation -import os -import pickle -import signal -import subprocess -import sys -import sisyphus.getfs - - -def sigint_handler(signal, frame): - sys.exit(0) - - -signal.signal(signal.SIGINT, sigint_handler) - - -@animation.wait('resolving reverse dependencies') -def start(pkgname=None): - 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_pkgrdeps.pickle"), "wb")) - except KeyboardInterrupt: - p_exe.terminate() - try: - p_exe.wait(1) - except subprocess.TimeoutExpired: - p_exe.kill() - sys.exit() diff --git a/src/backend/solverevdeps.py b/src/backend/solverevdeps.py new file mode 100644 index 0000000..bd90e2f --- /dev/null +++ b/src/backend/solverevdeps.py @@ -0,0 +1,41 @@ +#!/usr/bin/python3 + +import animation +import os +import pickle +import signal +import subprocess +import sys +import sisyphus.getfs + + +def sigint_handler(signal, frame): + sys.exit(0) + + +signal.signal(signal.SIGINT, sigint_handler) + + +@animation.wait('resolving reverse dependencies') +def start(pkgname=None): + 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() + try: + p_exe.wait(1) + except subprocess.TimeoutExpired: + p_exe.kill() + sys.exit() diff --git a/src/backend/syncall.py b/src/backend/syncall.py new file mode 100644 index 0000000..d6db8ff --- /dev/null +++ b/src/backend/syncall.py @@ -0,0 +1,88 @@ +#!/usr/bin/python3 + +import animation +import signal +import sys +import time +import sisyphus.checkenv +import sisyphus.getclr +import sisyphus.getenv +import sisyphus.purgeenv +import sisyphus.syncdb +import sisyphus.syncenv + + +def sigint_handler(signal, frame): + sys.exit(0) + + +signal.signal(signal.SIGINT, sigint_handler) + + +def sync_evrth(): + sisyphus.syncenv.g_repo() + sisyphus.syncenv.r_repo() + sisyphus.syncenv.p_cfg_repo() + sisyphus.syncdb.rmt_tbl() + + +@animation.wait('fetching updates') +def start(gfx_ui=False): + actv_brch = sisyphus.getenv.sys_brch() + bhst_addr = sisyphus.getenv.bhst_addr() + is_sane = sisyphus.checkenv.sanity() + is_online = sisyphus.checkenv.connectivity() + + if is_online != 1: + if gfx_ui: + print("\n\nNo internet connection; Aborting!\n") + for i in range(9, 0, -1): + print(f"Killing application in : {i} seconds!") + time.sleep(1) + + sys.exit(app.exec_()) # kill GUI window + else: + print(sisyphus.getclr.bright_red + + "\n\nNo internet connection; Aborting!\n" + sisyphus.getclr.reset) + sys.exit() + else: + if is_sane == 1: + sync_evrth() + else: + if gfx_ui: + if "packages-next" in bhst_addr: + print("\n\nActive branch:" + " " + "'" + + actv_brch + "'" + " " + "(stable)") + print("\n\nActive binhost:" + " " + "'" + + bhst_addr + "'" + " " + "(testing)") + else: + print("\n\nActive branch:" + " " + "'" + + actv_brch + "'" + " " + "(testing)") + print("\n\nActive binhost:" + " " + "'" + + bhst_addr + "'" + " " + "(stable)") + + print("\n\nInvalid configuration!") + print("\nUse 'sisyphus branch --help' for help\n") + for i in range(9, 0, -1): + print(f"Killing application in : {i} seconds!") + time.sleep(1) + + sys.exit(app.exec_()) # kill GUI window + else: + if "packages-next" in bhst_addr: + print(sisyphus.getclr.green + "\n\nActive branch:" + " " + + sisyphus.getclr.reset + "'" + actv_brch + "'" + " " + "(stable)") + print(sisyphus.getclr.green + "\nActive binhost:" + " " + + sisyphus.getclr.reset + "'" + bhst_addr + "'" + " " + "(testing)") + else: + print(sisyphus.getclr.green + "\n\nActive branch:" + " " + + sisyphus.getclr.reset + "'" + actv_brch + "'" + " " + "(testing)") + print(sisyphus.getclr.green + "\nActive binhost:" + " " + + sisyphus.getclr.reset + "'" + bhst_addr + "'" + " " + "(stable)") + + print(sisyphus.getclr.bright_red + + "\n\nInvalid configuration!" + sisyphus.getclr.reset) + print(sisyphus.getclr.bright_yellow + "\nUse" + sisyphus.getclr.reset + " " + "'" + + "sisyphus branch --help" + "'" + " " + sisyphus.getclr.bright_yellow + "for help" + sisyphus.getclr.reset) + time.sleep(1) + sys.exit() diff --git a/src/backend/sysupgrade.py b/src/backend/sysupgrade.py new file mode 100644 index 0000000..f85b2a6 --- /dev/null +++ b/src/backend/sysupgrade.py @@ -0,0 +1,353 @@ +#!/usr/bin/python3 + +import atexit +import fcntl +import io +import os +import pickle +import selectors +import signal +import subprocess +import sys +import time +import sisyphus.checkenv +import sisyphus.dlbinpkg +import sisyphus.getclr +import sisyphus.getfs +import sisyphus.killemerge +import sisyphus.solvedeps +import sisyphus.syncdb +import sisyphus.syncall + + +def set_nonblocking(fd): + flags = fcntl.fcntl(fd, fcntl.F_GETFL) + fcntl.fcntl(fd, fcntl.F_SETFL, flags | os.O_NONBLOCK) + + +def spinner_animation(): + spinner = ['-', '\\', '|', '/'] + sel = selectors.DefaultSelector() + sel.register(sys.stdin, selectors.EVENT_READ) + + for _ in range(10): + for char in spinner: + sys.stdout.write('\b' + char) + sys.stdout.flush() + events = sel.select(timeout=0.1) + if events: + return + sys.stdout.write('\b') + + +def sigint_handler(signal, frame): + sys.exit(0) + + +signal.signal(signal.SIGINT, sigint_handler) + + +def start(ebuild=False, gfx_ui=False): + if not sisyphus.checkenv.root(): + print(sisyphus.getclr.bright_red + + "\nYou need root permissions to do this!\n" + sisyphus.getclr.reset) + sys.exit() + else: + if gfx_ui: + sisyphus.solvedeps.start.__wrapped__() # undecorate + else: + sisyphus.syncall.start(gfx_ui=False) + sisyphus.solvedeps.start() + + 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 + p_exe = subprocess.Popen(['emerge', '--quiet', '--update', '--deep', '--newuse', '--pretend', '--getbinpkg', + '--rebuilt-binaries', '--backtrack=100', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n', '@world']) + 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: + print("\nCannot proceed!\n") + print( + "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!") + time.sleep(1) + + sys.exit(app.exec_()) # kill GUI window + else: + print(sisyphus.getclr.bright_red + + "\nCannot proceed!\n" + sisyphus.getclr.reset) + print(sisyphus.getclr.bright_yellow + + "Apply the above changes to your portage configuration files and try again" + sisyphus.getclr.reset) + sys.exit() + else: + if len(bin_list) == 0 and len(src_list) == 0: + if gfx_ui: + print("\nNo package upgrades found!\n") + else: + print(sisyphus.getclr.bright_red + + "\nNo package upgrades found!\n" + sisyphus.getclr.reset) + sys.exit() + + if ebuild: # ebuild mode + if len(bin_list) == 0 and len(src_list) != 0: # source mode, ignore aliens + print("\n" + sisyphus.getclr.green + + "These are the source packages that would be merged, in order:" + sisyphus.getclr.reset + "\n") + print("\n" + sisyphus.getclr.green + + ", ".join(src_list) + sisyphus.getclr.reset + "\n") + print("\n" + sisyphus.getclr.bright_white + "Total:" + " " + str( + len(src_list)) + " " + "source package(s)" + sisyphus.getclr.reset + "\n") + while True: + user_input = input(sisyphus.getclr.bright_white + "Would you like to proceed?" + sisyphus.getclr.reset + " " + + "[" + sisyphus.getclr.bright_green + "Yes" + sisyphus.getclr.reset + "/" + sisyphus.getclr.bright_red + "No" + sisyphus.getclr.reset + "]" + " ") + if user_input.lower() in ['yes', 'y', '']: + p_exe = subprocess.Popen(['emerge', '--quiet', '--verbose', '--update', '--deep', '--newuse', + '--backtrack=100', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n', '@world']) + try: + set_nonblocking(sys.stdout.fileno()) + spinner_animation() + + sel = selectors.DefaultSelector() + sel.register(sys.stdin, selectors.EVENT_READ) + + while True: + events = sel.select(timeout=0.1) + for key, mask in events: + if key.fileobj == sys.stdin: + line = sys.stdin.readline().strip() + if line.lower() == 'q': + sys.exit() + if p_exe.poll() is not None: + break + except KeyboardInterrupt: + p_exe.terminate() + try: + p_exe.wait(1) + except subprocess.TimeoutExpired: + p_exe.kill() + sys.exit() + finally: + p_exe.wait() + sisyphus.syncdb.lcl_tbl() + break + elif user_input.lower() in ['no', 'n']: + break + else: + print("\nSorry, response" + " " + "'" + + user_input + "'" + " " + "not understood.\n") + continue + elif len(bin_list) != 0 and len(src_list) != 0: # hybrid mode, ignore aliens + print("\n" + sisyphus.getclr.green + + "These are the binary packages that would be merged, in order:" + sisyphus.getclr.reset + "\n") + print("\n" + sisyphus.getclr.magenta + + ", ".join(bin_list) + sisyphus.getclr.reset + "\n") + print("\n" + sisyphus.getclr.bright_white + "Total:" + " " + str( + len(bin_list)) + " " + "binary package(s)" + sisyphus.getclr.reset + "\n") + + print("\n" + sisyphus.getclr.green + + "These are the source packages that would be merged, in order:" + sisyphus.getclr.reset + "\n") + print("\n" + sisyphus.getclr.green + + ", ".join(src_list) + sisyphus.getclr.reset + "\n") + print("\n" + sisyphus.getclr.bright_white + "Total:" + " " + str( + len(src_list)) + " " + "source package(s)" + sisyphus.getclr.reset + "\n") + while True: + user_input = input(sisyphus.getclr.bright_white + "Would you like to proceed?" + sisyphus.getclr.reset + " " + + "[" + sisyphus.getclr.bright_green + "Yes" + sisyphus.getclr.reset + "/" + sisyphus.getclr.bright_red + "No" + sisyphus.getclr.reset + "]" + " ") + if user_input.lower() in ['yes', 'y', '']: + sisyphus.dlbinpkg.start(dl_world=True, gfx_ui=False) + os.chdir(sisyphus.getfs.p_cch_dir) + p_exe = subprocess.Popen(['emerge', '--quiet', '--verbose', '--update', '--deep', '--newuse', '--usepkg', + '--rebuilt-binaries', '--backtrack=100', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n', '@world']) + try: + set_nonblocking(sys.stdout.fileno()) + spinner_animation() + + sel = selectors.DefaultSelector() + sel.register(sys.stdin, selectors.EVENT_READ) + + while True: + events = sel.select(timeout=0.1) + for key, mask in events: + if key.fileobj == sys.stdin: + line = sys.stdin.readline().strip() + if line.lower() == 'q': + sys.exit() + if p_exe.poll() is not None: + break + except KeyboardInterrupt: + p_exe.terminate() + try: + p_exe.wait(1) + except subprocess.TimeoutExpired: + p_exe.kill() + sys.exit() + finally: + p_exe.wait() + sisyphus.syncdb.lcl_tbl() + break + elif user_input.lower() in ['no', 'n']: + break + else: + print("\nSorry, response" + " " + "'" + + user_input + "'" + " " + "not understood.\n") + continue + elif len(bin_list) != 0 and len(src_list) == 0: # binary mode, fallback + print("\n" + sisyphus.getclr.green + + "These are the binary packages that would be merged, in order:" + sisyphus.getclr.reset + "\n") + print("\n" + sisyphus.getclr.magenta + + ", ".join(bin_list) + sisyphus.getclr.reset + "\n") + print("\n" + sisyphus.getclr.bright_white + "Total:" + " " + str( + len(bin_list)) + " " + "binary package(s)" + sisyphus.getclr.reset + "\n") + while True: + user_input = input(sisyphus.getclr.bright_white + "Would you like to proceed?" + sisyphus.getclr.reset + " " + + "[" + sisyphus.getclr.bright_green + "Yes" + sisyphus.getclr.reset + "/" + sisyphus.getclr.bright_red + "No" + sisyphus.getclr.reset + "]" + " ") + if user_input.lower() in ['yes', 'y', '']: + sisyphus.dlbinpkg.start(dl_world=True, gfx_ui=False) + os.chdir(sisyphus.getfs.p_cch_dir) + p_exe = subprocess.Popen(['emerge', '--quiet', '--verbose', '--update', '--deep', '--newuse', '--usepkg', '--usepkgonly', + '--rebuilt-binaries', '--backtrack=100', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n', '@world']) + try: + set_nonblocking(sys.stdout.fileno()) + spinner_animation() + + sel = selectors.DefaultSelector() + sel.register(sys.stdin, selectors.EVENT_READ) + + while True: + events = sel.select(timeout=0.1) + for key, mask in events: + if key.fileobj == sys.stdin: + line = sys.stdin.readline().strip() + if line.lower() == 'q': + sys.exit() + if p_exe.poll() is not None: + break + except KeyboardInterrupt: + p_exe.terminate() + try: + p_exe.wait(1) + except subprocess.TimeoutExpired: + p_exe.kill() + sys.exit() + finally: + p_exe.wait() + sisyphus.syncdb.lcl_tbl() + break + elif user_input.lower() in ['no', 'n']: + break + else: + print("\nSorry, response" + " " + "'" + + user_input + "'" + " " + "not understood.\n") + continue + else: # non-ebuild mode + if len(bin_list) == 0 and len(src_list) != 0: # source mode (noop), catch aliens + if gfx_ui: + print("\nSource package(s) found in the mix!\n") + print("Use sisyphus CLI:" + " " + "'" + "sisyphus upgrade --ebuild" + + "'" + " " + "to perform the upgrade;" + " " + "Aborting.") + + for i in range(9, 0, -1): + print(f"Killing application in : {i} seconds!") + time.sleep(1) + + sys.exit(app.exec_()) # kill GUI window + else: + print(sisyphus.getclr.bright_red + + "\nSource package(s) found in the mix!\n" + sisyphus.getclr.reset) + print(sisyphus.getclr.bright_yellow + "Use" + + sisyphus.getclr.reset + " " + "'" + "sisyphus upgrade --ebuild" + "'") + sys.exit() + elif len(bin_list) != 0 and len(src_list) != 0: # hybrid mode (noop), catch aliens + if gfx_ui: + print("\nSource package(s) found in the mix!\n") + print("Use sisyphus CLI:" + " " + "'" + "sisyphus upgrade --ebuild" + + "'" + " " + "to perform the upgrade;" + " " + "Aborting.") + + for i in range(9, 0, -1): + print(f"Killing application in : {i} seconds!") + time.sleep(1) + + sys.exit(app.exec_()) # kill GUI window + else: + print(sisyphus.getclr.bright_red + + "\nSource package(s) found in the mix!\n" + sisyphus.getclr.reset) + print(sisyphus.getclr.bright_yellow + "Use" + + sisyphus.getclr.reset + " " + "'" + "sisyphus upgrade --ebuild" + "'") + sys.exit() + elif len(bin_list) != 0 and len(src_list) == 0: # binary mode + if gfx_ui: + print( + "\n" + "These are the binary packages that will be merged, in order:" + "\n") + print("\n" + ", ".join(bin_list) + "\n\n" + "Total:" + " " + + str(len(bin_list)) + " " + "binary package(s)" + "\n\n") + sisyphus.dlbinpkg.start(dl_world=True, gfx_ui=True) + os.chdir(sisyphus.getfs.p_cch_dir) + p_exe = subprocess.Popen(['emerge', '--quiet', '--verbose', '--update', '--deep', '--newuse', '--usepkg', '--usepkgonly', '--rebuilt-binaries', + '--backtrack=100', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n', '@world'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + # kill portage if the program dies or it's terminated by the user + atexit.register(sisyphus.killemerge.start, p_exe) + + for p_out in io.TextIOWrapper(p_exe.stdout, encoding="utf-8"): + print(p_out.rstrip()) + + p_exe.wait() + sisyphus.syncdb.lcl_tbl() + else: + print("\n" + sisyphus.getclr.green + + "These are the binary packages that would be merged, in order:" + sisyphus.getclr.reset + "\n") + print("\n" + sisyphus.getclr.magenta + + ", ".join(bin_list) + sisyphus.getclr.reset + "\n") + print("\n" + sisyphus.getclr.bright_white + "Total:" + " " + str( + len(bin_list)) + " " + "binary package(s)" + sisyphus.getclr.reset + "\n") + while True: + user_input = input(sisyphus.getclr.bright_white + "Would you like to proceed?" + sisyphus.getclr.reset + " " + + "[" + sisyphus.getclr.bright_green + "Yes" + sisyphus.getclr.reset + "/" + sisyphus.getclr.bright_red + "No" + sisyphus.getclr.reset + "]" + " ") + if user_input.lower() in ['yes', 'y', '']: + sisyphus.dlbinpkg.start( + dl_world=True, gfx_ui=False) + os.chdir(sisyphus.getfs.p_cch_dir) + p_exe = subprocess.Popen(['emerge', '--quiet', '--verbose', '--update', '--deep', '--newuse', '--usepkg', '--usepkgonly', + '--rebuilt-binaries', '--backtrack=100', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n', '@world']) + try: + set_nonblocking(sys.stdout.fileno()) + spinner_animation() + + sel = selectors.DefaultSelector() + sel.register(sys.stdin, selectors.EVENT_READ) + + while True: + events = sel.select(timeout=0.1) + for key, mask in events: + if key.fileobj == sys.stdin: + line = sys.stdin.readline().strip() + if line.lower() == 'q': + sys.exit() + if p_exe.poll() is not None: + break + except KeyboardInterrupt: + p_exe.terminate() + try: + p_exe.wait(1) + except subprocess.TimeoutExpired: + p_exe.kill() + sys.exit() + finally: + p_exe.wait() + sisyphus.syncdb.lcl_tbl() + break + elif user_input.lower() in ['no', 'n']: + break + else: + print("\nSorry, response" + " " + "'" + + user_input + "'" + " " + "not understood.\n") + continue diff --git a/src/backend/uninstall.py b/src/backend/uninstall.py deleted file mode 100644 index e3e6135..0000000 --- a/src/backend/uninstall.py +++ /dev/null @@ -1,107 +0,0 @@ -#!/usr/bin/python3 - -import atexit -import io -import os -import pickle -import signal -import subprocess -import sys -import sisyphus.checkenv -import sisyphus.getclr -import sisyphus.getfs -import sisyphus.killemerge -import sisyphus.solverdeps -import sisyphus.syncdb - - -def sigint_handler(signal, frame): - sys.exit(0) - - -signal.signal(signal.SIGINT, sigint_handler) - - -def start(pkgname, depclean=False, gfx_ui=False, unmerge=False): - args = ['--quiet', '--depclean'] - - if not sisyphus.checkenv.root() and (unmerge or depclean): - print(sisyphus.getclr.bright_red + - "\nYou need root permissions to do this!\n" + sisyphus.getclr.reset) - sys.exit() - else: - if gfx_ui: - sisyphus.solverdeps.start.__wrapped__(pkgname) - else: - sisyphus.solverdeps.start(pkgname) - - is_needed = pickle.load( - open(os.path.join(sisyphus.getfs.p_mtd_dir, "sisyphus_pkgrdeps.pickle"), "rb")) - - if is_needed != 0: - if gfx_ui: - p_exe = subprocess.Popen(['emerge'] + args + ['--pretend', '--verbose'] + list( - pkgname), stdout=subprocess.PIPE, stderr=subprocess.PIPE) - # kill portage if the program dies or it's terminated by the user - atexit.register(sisyphus.killemerge.start, p_exe) - - for p_out in io.TextIOWrapper(p_exe.stdout, encoding="utf-8"): - print(p_out.rstrip()) - - p_exe.wait() - print("\nWon't uninstall! Other packages depend on " + str(pkgname)) - else: - p_exe = subprocess.Popen( - ['emerge'] + args + ['--pretend', '--verbose'] + list(pkgname)) - try: - p_exe.wait() - except KeyboardInterrupt: - p_exe.terminate() - try: - p_exe.wait(1) - except subprocess.TimeoutExpired: - p_exe.kill() - sys.exit() - print(sisyphus.getclr.bright_red + - "\nWon't uninstall! Other packages depend on " + sisyphus.getclr.reset + str(pkgname)) - print(sisyphus.getclr.bright_red + "Use the " + sisyphus.getclr.reset + sisyphus.getclr.green + "'--force'" + - sisyphus.getclr.reset + sisyphus.getclr.bright_red + " option to override at your own risk!\n" + sisyphus.getclr.reset) - else: - if unmerge: - p_exe = subprocess.Popen( - ['emerge', '--quiet', '--unmerge', '--ask'] + list(pkgname)) - try: - p_exe.wait() - sisyphus.syncdb.lcl_tbl() - except KeyboardInterrupt: - p_exe.terminate() - try: - p_exe.wait(1) - except subprocess.TimeoutExpired: - p_exe.kill() - sys.exit() - elif depclean: - if gfx_ui: - p_exe = subprocess.Popen( - ['emerge'] + args + pkgname, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - # kill portage if the program dies or it's terminated by the user - atexit.register(sisyphus.killemerge.start, p_exe) - - for p_out in io.TextIOWrapper(p_exe.stdout, encoding="utf-8"): - print(p_out.rstrip()) - - p_exe.wait() - sisyphus.syncdb.lcl_tbl() - else: - p_exe = subprocess.Popen( - ['emerge'] + args + ['--ask'] + list(pkgname)) - try: - p_exe.wait() - sisyphus.syncdb.lcl_tbl() - except KeyboardInterrupt: - p_exe.terminate() - try: - p_exe.wait(1) - except subprocess.TimeoutExpired: - p_exe.kill() - sys.exit() diff --git a/src/backend/update.py b/src/backend/update.py deleted file mode 100644 index d6db8ff..0000000 --- a/src/backend/update.py +++ /dev/null @@ -1,88 +0,0 @@ -#!/usr/bin/python3 - -import animation -import signal -import sys -import time -import sisyphus.checkenv -import sisyphus.getclr -import sisyphus.getenv -import sisyphus.purgeenv -import sisyphus.syncdb -import sisyphus.syncenv - - -def sigint_handler(signal, frame): - sys.exit(0) - - -signal.signal(signal.SIGINT, sigint_handler) - - -def sync_evrth(): - sisyphus.syncenv.g_repo() - sisyphus.syncenv.r_repo() - sisyphus.syncenv.p_cfg_repo() - sisyphus.syncdb.rmt_tbl() - - -@animation.wait('fetching updates') -def start(gfx_ui=False): - actv_brch = sisyphus.getenv.sys_brch() - bhst_addr = sisyphus.getenv.bhst_addr() - is_sane = sisyphus.checkenv.sanity() - is_online = sisyphus.checkenv.connectivity() - - if is_online != 1: - if gfx_ui: - print("\n\nNo internet connection; Aborting!\n") - for i in range(9, 0, -1): - print(f"Killing application in : {i} seconds!") - time.sleep(1) - - sys.exit(app.exec_()) # kill GUI window - else: - print(sisyphus.getclr.bright_red + - "\n\nNo internet connection; Aborting!\n" + sisyphus.getclr.reset) - sys.exit() - else: - if is_sane == 1: - sync_evrth() - else: - if gfx_ui: - if "packages-next" in bhst_addr: - print("\n\nActive branch:" + " " + "'" + - actv_brch + "'" + " " + "(stable)") - print("\n\nActive binhost:" + " " + "'" + - bhst_addr + "'" + " " + "(testing)") - else: - print("\n\nActive branch:" + " " + "'" + - actv_brch + "'" + " " + "(testing)") - print("\n\nActive binhost:" + " " + "'" + - bhst_addr + "'" + " " + "(stable)") - - print("\n\nInvalid configuration!") - print("\nUse 'sisyphus branch --help' for help\n") - for i in range(9, 0, -1): - print(f"Killing application in : {i} seconds!") - time.sleep(1) - - sys.exit(app.exec_()) # kill GUI window - else: - if "packages-next" in bhst_addr: - print(sisyphus.getclr.green + "\n\nActive branch:" + " " + - sisyphus.getclr.reset + "'" + actv_brch + "'" + " " + "(stable)") - print(sisyphus.getclr.green + "\nActive binhost:" + " " + - sisyphus.getclr.reset + "'" + bhst_addr + "'" + " " + "(testing)") - else: - print(sisyphus.getclr.green + "\n\nActive branch:" + " " + - sisyphus.getclr.reset + "'" + actv_brch + "'" + " " + "(testing)") - print(sisyphus.getclr.green + "\nActive binhost:" + " " + - sisyphus.getclr.reset + "'" + bhst_addr + "'" + " " + "(stable)") - - print(sisyphus.getclr.bright_red + - "\n\nInvalid configuration!" + sisyphus.getclr.reset) - print(sisyphus.getclr.bright_yellow + "\nUse" + sisyphus.getclr.reset + " " + "'" + - "sisyphus branch --help" + "'" + " " + sisyphus.getclr.bright_yellow + "for help" + sisyphus.getclr.reset) - time.sleep(1) - sys.exit() diff --git a/src/backend/upgrade.py b/src/backend/upgrade.py deleted file mode 100644 index 31e3463..0000000 --- a/src/backend/upgrade.py +++ /dev/null @@ -1,353 +0,0 @@ -#!/usr/bin/python3 - -import atexit -import fcntl -import io -import os -import pickle -import selectors -import signal -import subprocess -import sys -import time -import sisyphus.checkenv -import sisyphus.dlpkg -import sisyphus.getclr -import sisyphus.getfs -import sisyphus.killemerge -import sisyphus.solvedeps -import sisyphus.syncdb -import sisyphus.update - - -def set_nonblocking(fd): - flags = fcntl.fcntl(fd, fcntl.F_GETFL) - fcntl.fcntl(fd, fcntl.F_SETFL, flags | os.O_NONBLOCK) - - -def spinner_animation(): - spinner = ['-', '\\', '|', '/'] - sel = selectors.DefaultSelector() - sel.register(sys.stdin, selectors.EVENT_READ) - - for _ in range(10): - for char in spinner: - sys.stdout.write('\b' + char) - sys.stdout.flush() - events = sel.select(timeout=0.1) - if events: - return - sys.stdout.write('\b') - - -def sigint_handler(signal, frame): - sys.exit(0) - - -signal.signal(signal.SIGINT, sigint_handler) - - -def start(ebuild=False, gfx_ui=False): - if not sisyphus.checkenv.root(): - print(sisyphus.getclr.bright_red + - "\nYou need root permissions to do this!\n" + sisyphus.getclr.reset) - sys.exit() - else: - if gfx_ui: - sisyphus.solvedeps.start.__wrapped__() # undecorate - else: - sisyphus.update.start(gfx_ui=False) - sisyphus.solvedeps.start() - - 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 - p_exe = subprocess.Popen(['emerge', '--quiet', '--update', '--deep', '--newuse', '--pretend', '--getbinpkg', - '--rebuilt-binaries', '--backtrack=100', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n', '@world']) - 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: - print("\nCannot proceed!\n") - print( - "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!") - time.sleep(1) - - sys.exit(app.exec_()) # kill GUI window - else: - print(sisyphus.getclr.bright_red + - "\nCannot proceed!\n" + sisyphus.getclr.reset) - print(sisyphus.getclr.bright_yellow + - "Apply the above changes to your portage configuration files and try again" + sisyphus.getclr.reset) - sys.exit() - else: - if len(bin_list) == 0 and len(src_list) == 0: - if gfx_ui: - print("\nNo package upgrades found!\n") - else: - print(sisyphus.getclr.bright_red + - "\nNo package upgrades found!\n" + sisyphus.getclr.reset) - sys.exit() - - if ebuild: # ebuild mode - if len(bin_list) == 0 and len(src_list) != 0: # source mode, ignore aliens - print("\n" + sisyphus.getclr.green + - "These are the source packages that would be merged, in order:" + sisyphus.getclr.reset + "\n") - print("\n" + sisyphus.getclr.green + - ", ".join(src_list) + sisyphus.getclr.reset + "\n") - print("\n" + sisyphus.getclr.bright_white + "Total:" + " " + str( - len(src_list)) + " " + "source package(s)" + sisyphus.getclr.reset + "\n") - while True: - user_input = input(sisyphus.getclr.bright_white + "Would you like to proceed?" + sisyphus.getclr.reset + " " + - "[" + sisyphus.getclr.bright_green + "Yes" + sisyphus.getclr.reset + "/" + sisyphus.getclr.bright_red + "No" + sisyphus.getclr.reset + "]" + " ") - if user_input.lower() in ['yes', 'y', '']: - p_exe = subprocess.Popen(['emerge', '--quiet', '--verbose', '--update', '--deep', '--newuse', - '--backtrack=100', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n', '@world']) - try: - set_nonblocking(sys.stdout.fileno()) - spinner_animation() - - sel = selectors.DefaultSelector() - sel.register(sys.stdin, selectors.EVENT_READ) - - while True: - events = sel.select(timeout=0.1) - for key, mask in events: - if key.fileobj == sys.stdin: - line = sys.stdin.readline().strip() - if line.lower() == 'q': - sys.exit() - if p_exe.poll() is not None: - break - except KeyboardInterrupt: - p_exe.terminate() - try: - p_exe.wait(1) - except subprocess.TimeoutExpired: - p_exe.kill() - sys.exit() - finally: - p_exe.wait() - sisyphus.syncdb.lcl_tbl() - break - elif user_input.lower() in ['no', 'n']: - break - else: - print("\nSorry, response" + " " + "'" + - user_input + "'" + " " + "not understood.\n") - continue - elif len(bin_list) != 0 and len(src_list) != 0: # hybrid mode, ignore aliens - print("\n" + sisyphus.getclr.green + - "These are the binary packages that would be merged, in order:" + sisyphus.getclr.reset + "\n") - print("\n" + sisyphus.getclr.magenta + - ", ".join(bin_list) + sisyphus.getclr.reset + "\n") - print("\n" + sisyphus.getclr.bright_white + "Total:" + " " + str( - len(bin_list)) + " " + "binary package(s)" + sisyphus.getclr.reset + "\n") - - print("\n" + sisyphus.getclr.green + - "These are the source packages that would be merged, in order:" + sisyphus.getclr.reset + "\n") - print("\n" + sisyphus.getclr.green + - ", ".join(src_list) + sisyphus.getclr.reset + "\n") - print("\n" + sisyphus.getclr.bright_white + "Total:" + " " + str( - len(src_list)) + " " + "source package(s)" + sisyphus.getclr.reset + "\n") - while True: - user_input = input(sisyphus.getclr.bright_white + "Would you like to proceed?" + sisyphus.getclr.reset + " " + - "[" + sisyphus.getclr.bright_green + "Yes" + sisyphus.getclr.reset + "/" + sisyphus.getclr.bright_red + "No" + sisyphus.getclr.reset + "]" + " ") - if user_input.lower() in ['yes', 'y', '']: - sisyphus.dlpkg.start(dl_world=True, gfx_ui=False) - os.chdir(sisyphus.getfs.p_cch_dir) - p_exe = subprocess.Popen(['emerge', '--quiet', '--verbose', '--update', '--deep', '--newuse', '--usepkg', - '--rebuilt-binaries', '--backtrack=100', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n', '@world']) - try: - set_nonblocking(sys.stdout.fileno()) - spinner_animation() - - sel = selectors.DefaultSelector() - sel.register(sys.stdin, selectors.EVENT_READ) - - while True: - events = sel.select(timeout=0.1) - for key, mask in events: - if key.fileobj == sys.stdin: - line = sys.stdin.readline().strip() - if line.lower() == 'q': - sys.exit() - if p_exe.poll() is not None: - break - except KeyboardInterrupt: - p_exe.terminate() - try: - p_exe.wait(1) - except subprocess.TimeoutExpired: - p_exe.kill() - sys.exit() - finally: - p_exe.wait() - sisyphus.syncdb.lcl_tbl() - break - elif user_input.lower() in ['no', 'n']: - break - else: - print("\nSorry, response" + " " + "'" + - user_input + "'" + " " + "not understood.\n") - continue - elif len(bin_list) != 0 and len(src_list) == 0: # binary mode, fallback - print("\n" + sisyphus.getclr.green + - "These are the binary packages that would be merged, in order:" + sisyphus.getclr.reset + "\n") - print("\n" + sisyphus.getclr.magenta + - ", ".join(bin_list) + sisyphus.getclr.reset + "\n") - print("\n" + sisyphus.getclr.bright_white + "Total:" + " " + str( - len(bin_list)) + " " + "binary package(s)" + sisyphus.getclr.reset + "\n") - while True: - user_input = input(sisyphus.getclr.bright_white + "Would you like to proceed?" + sisyphus.getclr.reset + " " + - "[" + sisyphus.getclr.bright_green + "Yes" + sisyphus.getclr.reset + "/" + sisyphus.getclr.bright_red + "No" + sisyphus.getclr.reset + "]" + " ") - if user_input.lower() in ['yes', 'y', '']: - sisyphus.dlpkg.start(dl_world=True, gfx_ui=False) - os.chdir(sisyphus.getfs.p_cch_dir) - p_exe = subprocess.Popen(['emerge', '--quiet', '--verbose', '--update', '--deep', '--newuse', '--usepkg', '--usepkgonly', - '--rebuilt-binaries', '--backtrack=100', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n', '@world']) - try: - set_nonblocking(sys.stdout.fileno()) - spinner_animation() - - sel = selectors.DefaultSelector() - sel.register(sys.stdin, selectors.EVENT_READ) - - while True: - events = sel.select(timeout=0.1) - for key, mask in events: - if key.fileobj == sys.stdin: - line = sys.stdin.readline().strip() - if line.lower() == 'q': - sys.exit() - if p_exe.poll() is not None: - break - except KeyboardInterrupt: - p_exe.terminate() - try: - p_exe.wait(1) - except subprocess.TimeoutExpired: - p_exe.kill() - sys.exit() - finally: - p_exe.wait() - sisyphus.syncdb.lcl_tbl() - break - elif user_input.lower() in ['no', 'n']: - break - else: - print("\nSorry, response" + " " + "'" + - user_input + "'" + " " + "not understood.\n") - continue - else: # non-ebuild mode - if len(bin_list) == 0 and len(src_list) != 0: # source mode (noop), catch aliens - if gfx_ui: - print("\nSource package(s) found in the mix!\n") - print("Use sisyphus CLI:" + " " + "'" + "sisyphus upgrade --ebuild" + - "'" + " " + "to perform the upgrade;" + " " + "Aborting.") - - for i in range(9, 0, -1): - print(f"Killing application in : {i} seconds!") - time.sleep(1) - - sys.exit(app.exec_()) # kill GUI window - else: - print(sisyphus.getclr.bright_red + - "\nSource package(s) found in the mix!\n" + sisyphus.getclr.reset) - print(sisyphus.getclr.bright_yellow + "Use" + - sisyphus.getclr.reset + " " + "'" + "sisyphus upgrade --ebuild" + "'") - sys.exit() - elif len(bin_list) != 0 and len(src_list) != 0: # hybrid mode (noop), catch aliens - if gfx_ui: - print("\nSource package(s) found in the mix!\n") - print("Use sisyphus CLI:" + " " + "'" + "sisyphus upgrade --ebuild" + - "'" + " " + "to perform the upgrade;" + " " + "Aborting.") - - for i in range(9, 0, -1): - print(f"Killing application in : {i} seconds!") - time.sleep(1) - - sys.exit(app.exec_()) # kill GUI window - else: - print(sisyphus.getclr.bright_red + - "\nSource package(s) found in the mix!\n" + sisyphus.getclr.reset) - print(sisyphus.getclr.bright_yellow + "Use" + - sisyphus.getclr.reset + " " + "'" + "sisyphus upgrade --ebuild" + "'") - sys.exit() - elif len(bin_list) != 0 and len(src_list) == 0: # binary mode - if gfx_ui: - print( - "\n" + "These are the binary packages that will be merged, in order:" + "\n") - print("\n" + ", ".join(bin_list) + "\n\n" + "Total:" + " " + - str(len(bin_list)) + " " + "binary package(s)" + "\n\n") - sisyphus.dlpkg.start(dl_world=True, gfx_ui=True) - os.chdir(sisyphus.getfs.p_cch_dir) - p_exe = subprocess.Popen(['emerge', '--quiet', '--verbose', '--update', '--deep', '--newuse', '--usepkg', '--usepkgonly', '--rebuilt-binaries', - '--backtrack=100', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n', '@world'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) - # kill portage if the program dies or it's terminated by the user - atexit.register(sisyphus.killemerge.start, p_exe) - - for p_out in io.TextIOWrapper(p_exe.stdout, encoding="utf-8"): - print(p_out.rstrip()) - - p_exe.wait() - sisyphus.syncdb.lcl_tbl() - else: - print("\n" + sisyphus.getclr.green + - "These are the binary packages that would be merged, in order:" + sisyphus.getclr.reset + "\n") - print("\n" + sisyphus.getclr.magenta + - ", ".join(bin_list) + sisyphus.getclr.reset + "\n") - print("\n" + sisyphus.getclr.bright_white + "Total:" + " " + str( - len(bin_list)) + " " + "binary package(s)" + sisyphus.getclr.reset + "\n") - while True: - user_input = input(sisyphus.getclr.bright_white + "Would you like to proceed?" + sisyphus.getclr.reset + " " + - "[" + sisyphus.getclr.bright_green + "Yes" + sisyphus.getclr.reset + "/" + sisyphus.getclr.bright_red + "No" + sisyphus.getclr.reset + "]" + " ") - if user_input.lower() in ['yes', 'y', '']: - sisyphus.dlpkg.start( - dl_world=True, gfx_ui=False) - os.chdir(sisyphus.getfs.p_cch_dir) - p_exe = subprocess.Popen(['emerge', '--quiet', '--verbose', '--update', '--deep', '--newuse', '--usepkg', '--usepkgonly', - '--rebuilt-binaries', '--backtrack=100', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n', '@world']) - try: - set_nonblocking(sys.stdout.fileno()) - spinner_animation() - - sel = selectors.DefaultSelector() - sel.register(sys.stdin, selectors.EVENT_READ) - - while True: - events = sel.select(timeout=0.1) - for key, mask in events: - if key.fileobj == sys.stdin: - line = sys.stdin.readline().strip() - if line.lower() == 'q': - sys.exit() - if p_exe.poll() is not None: - break - except KeyboardInterrupt: - p_exe.terminate() - try: - p_exe.wait(1) - except subprocess.TimeoutExpired: - p_exe.kill() - sys.exit() - finally: - p_exe.wait() - sisyphus.syncdb.lcl_tbl() - break - elif user_input.lower() in ['no', 'n']: - break - else: - print("\nSorry, response" + " " + "'" + - user_input + "'" + " " + "not understood.\n") - continue diff --git a/src/frontend/cli/sisyphus-cli.py b/src/frontend/cli/sisyphus-cli.py index 82773d3..3813e25 100755 --- a/src/frontend/cli/sisyphus-cli.py +++ b/src/frontend/cli/sisyphus-cli.py @@ -123,10 +123,10 @@ def install(pkgname: List[str], sisyphus install vivaldi --oneshot --ebuild\n """ if ebuild: - sisyphus.install.start(pkgname, ebuild=True, + sisyphus.instpkgsrc.start(pkgname, ebuild=True, gfx_ui=False, oneshot=oneshot) else: - sisyphus.install.start(pkgname, ebuild=False, + sisyphus.instpkgsrc.start(pkgname, ebuild=False, gfx_ui=False, oneshot=oneshot) @@ -147,10 +147,10 @@ def uninstall(pkgname: List[str], force: bool = typer.Option(False, "--force", " sisyphus uninstall openrc -f # this will succeed, but the system will no longer boot\n """ if force: - sisyphus.uninstall.start( + sisyphus.rmpkgsrc.start( pkgname, depclean=False, gfx_ui=False, unmerge=True) else: - sisyphus.uninstall.start( + sisyphus.rmpkgsrc.start( pkgname, depclean=True, gfx_ui=False, unmerge=False) @@ -166,7 +166,7 @@ def autoremove(): * Examples:\n sisyphus autoremove\n """ - sisyphus.autoremove.start(gfx_ui=False) + sisyphus.autormpkgsrc.start(gfx_ui=False) @app.command("autoclean") @@ -192,7 +192,7 @@ def update(): sisyphus update\n """ if sisyphus.checkenv.root(): - sisyphus.update.start(gfx_ui=False) + sisyphus.syncall.start(gfx_ui=False) else: sys.exit("\nYou need root permissions to do this, exiting!\n") @@ -213,9 +213,9 @@ def upgrade( sisyphus upgrade -e\n """ if ebuild: - sisyphus.upgrade.start(ebuild=True, gfx_ui=False) + sisyphus.sysupgrade.start(ebuild=True, gfx_ui=False) else: - sisyphus.upgrade.start(ebuild=False, gfx_ui=False) + sisyphus.sysupgrade.start(ebuild=False, gfx_ui=False) @app.command("spmsync") @@ -309,7 +309,7 @@ def mirrorlist(): * Examples:\n sisyphus mirror list\n """ - sisyphus.mirrors.printList() + sisyphus.setmirror.printList() @mirrorSetup.command("set") @@ -321,7 +321,7 @@ def mirrorset(index: int): sisyphus mirror set 2\n sisyphus mirror set 5\n """ - sisyphus.mirrors.setActive(index) + sisyphus.setmirror.setActive(index) if __name__ == "__main__": diff --git a/src/frontend/gui/sisyphus-gui.py b/src/frontend/gui/sisyphus-gui.py index d5c7aff..44820f7 100644 --- a/src/frontend/gui/sisyphus-gui.py +++ b/src/frontend/gui/sisyphus-gui.py @@ -363,7 +363,7 @@ class MirrorConfiguration(QtWidgets.QMainWindow): super(MirrorConfiguration, self).__init__() uic.loadUi('/usr/share/sisyphus/ui/mirrorcfg.ui', self) self.centerOnScreen() - self.MIRRORLIST = sisyphus.mirrors.getList() + self.MIRRORLIST = sisyphus.setmirror.getList() self.updateMirrorList() self.applyButton.pressed.connect(self.mirrorCfgApply) self.applyButton.released.connect(self.mirrorCfgExit) @@ -394,7 +394,7 @@ class MirrorConfiguration(QtWidgets.QMainWindow): self.MIRRORLIST[self.ACTIVEMIRRORINDEX]['isActive'] = True def mirrorCfgApply(self): - sisyphus.mirrors.writeList(self.MIRRORLIST) + sisyphus.setmirror.writeList(self.MIRRORLIST) def mirrorCfgExit(self): self.close() @@ -434,33 +434,33 @@ class MainWorker(QtCore.QObject): def startUpdate(self): self.started.emit() sisyphus.setjobs.start() - sisyphus.update.start.__wrapped__(gfx_ui=True) # undecorate + sisyphus.syncall.start.__wrapped__(gfx_ui=True) # undecorate self.finished.emit() @QtCore.pyqtSlot() def startInstall(self): self.started.emit() pkgname = Sisyphus.pkgname - sisyphus.install.start(pkgname, ebuild=False, gfx_ui=True, oneshot=False) + sisyphus.instpkgsrc.start(pkgname, ebuild=False, gfx_ui=True, oneshot=False) self.finished.emit() @QtCore.pyqtSlot() def startUninstall(self): self.started.emit() pkgname = Sisyphus.pkgname - sisyphus.uninstall.start(pkgname, depclean=True, gfx_ui=True, unmerge=False) + sisyphus.rmpkgsrc.start(pkgname, depclean=True, gfx_ui=True, unmerge=False) self.finished.emit() @QtCore.pyqtSlot() def startUpgrade(self): self.started.emit() - sisyphus.upgrade.start(ebuild=False, gfx_ui=True) + sisyphus.sysupgrade.start(ebuild=False, gfx_ui=True) self.finished.emit() @QtCore.pyqtSlot() def startAutoremove(self): self.started.emit() - sisyphus.autoremove.start(gfx_ui=True) + sisyphus.autormpkgsrc.start(gfx_ui=True) self.finished.emit() -- cgit v1.2.3