summaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/__init__.py6
-rw-r--r--src/backend/depsolve.py (renamed from src/backend/solvedeps.py)0
-rw-r--r--src/backend/dlbinpkg.py4
-rw-r--r--src/backend/pkgadd.py12
-rw-r--r--src/backend/pkgremove.py14
-rw-r--r--src/backend/revdepsolve.py (renamed from src/backend/solverevdeps.py)0
-rw-r--r--src/backend/sysclean.py121
-rw-r--r--src/backend/sysupgrade.py10
-rw-r--r--src/backend/watchdog.py (renamed from src/backend/killemerge.py)0
9 files changed, 88 insertions, 79 deletions
diff --git a/src/backend/__init__.py b/src/backend/__init__.py
index 21dec83..6c7da46 100644
--- a/src/backend/__init__.py
+++ b/src/backend/__init__.py
@@ -1,17 +1,16 @@
from .checkenv import *
+from .depsolve import *
from .dlbinpkg import *
from .getclr import *
from .getenv import *
from .getfs import *
from .getnews import *
-from .killemerge import *
from .pkgadd import *
from .pkgremove import *
from .purgeenv import *
from .querydb import *
from .recoverdb import *
-from .solvedeps import *
-from .solverevdeps import *
+from .revdepsolve import *
from .searchdb import *
from .setbranch import *
from .setjobs import *
@@ -24,3 +23,4 @@ from .syncspm import *
from .sysclean import *
from .sysinfo import *
from .sysupgrade import *
+from .watchdog import *
diff --git a/src/backend/solvedeps.py b/src/backend/depsolve.py
index 34d70b8..34d70b8 100644
--- a/src/backend/solvedeps.py
+++ b/src/backend/depsolve.py
diff --git a/src/backend/dlbinpkg.py b/src/backend/dlbinpkg.py
index ce089ad..f579b59 100644
--- a/src/backend/dlbinpkg.py
+++ b/src/backend/dlbinpkg.py
@@ -8,7 +8,7 @@ import subprocess
import sys
import pickle
import sisyphus.getfs
-import sisyphus.killemerge
+import sisyphus.watchdog
def sigint_handler(signal, frame):
@@ -40,7 +40,7 @@ def start(dl_world=False, gfx_ui=False):
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)
+ atexit.register(sisyphus.watchdog.start, p_exe)
for p_out in io.TextIOWrapper(p_exe.stdout, encoding="utf-8"):
print(p_out.rstrip())
diff --git a/src/backend/pkgadd.py b/src/backend/pkgadd.py
index 60ecce8..a64196c 100644
--- a/src/backend/pkgadd.py
+++ b/src/backend/pkgadd.py
@@ -11,13 +11,13 @@ import subprocess
import sys
import time
import sisyphus.checkenv
+import sisyphus.depsolve
import sisyphus.dlbinpkg
import sisyphus.getclr
import sisyphus.getfs
-import sisyphus.killemerge
-import sisyphus.solvedeps
import sisyphus.syncdb
import sisyphus.syncall
+import sisyphus.watchdog
def set_nonblocking(fd):
@@ -57,14 +57,14 @@ def start(pkgname, ebuild=False, gfx_ui=False, oneshot=False, nodeps=False):
sys.exit()
else:
if gfx_ui:
- sisyphus.solvedeps.start.__wrapped__(
+ sisyphus.depsolve.start.__wrapped__(
pkgname, nodeps=False) # undecorate
else:
sisyphus.syncall.start(gfx_ui=False)
if nodeps:
- sisyphus.solvedeps.start(pkgname, nodeps=True)
+ sisyphus.depsolve.start(pkgname, nodeps=True)
else:
- sisyphus.solvedeps.start(pkgname, nodeps=False)
+ sisyphus.depsolve.start(pkgname, nodeps=False)
bin_list, src_list, is_vague, need_cfg = pickle.load(
open(os.path.join(sisyphus.getfs.p_mtd_dir, "sisyphus_pkgdeps.pickle"), "rb"))
@@ -305,7 +305,7 @@ def start(pkgname, ebuild=False, gfx_ui=False, oneshot=False, nodeps=False):
p_exe = subprocess.Popen(['emerge'] + go_args + ['--usepkg', '--usepkgonly', '--rebuilt-binaries'] + (
['--nodeps'] if nodeps else ['--with-bdeps=y']) + (['--oneshot'] if oneshot else []) + pkgname, stdout=subprocess.PIPE, stderr=subprocess.PIPE) # --nodeps && --oneshot are set to False in the graphical client
# kill portage if the program dies or it's terminated by the user
- atexit.register(sisyphus.killemerge.start, p_exe)
+ atexit.register(sisyphus.watchdog.start, p_exe)
for p_out in io.TextIOWrapper(p_exe.stdout, encoding="utf-8"):
print(p_out.rstrip())
diff --git a/src/backend/pkgremove.py b/src/backend/pkgremove.py
index ad953d5..e9b36b8 100644
--- a/src/backend/pkgremove.py
+++ b/src/backend/pkgremove.py
@@ -13,9 +13,9 @@ import time
import sisyphus.checkenv
import sisyphus.getclr
import sisyphus.getfs
-import sisyphus.killemerge
-import sisyphus.solverevdeps
+import sisyphus.revdepsolve
import sisyphus.syncdb
+import sisyphus.watchdog
def set_nonblocking(fd):
@@ -53,14 +53,14 @@ def start(pkgname, depclean=False, gfx_ui=False, unmerge=False):
sys.exit()
else:
if gfx_ui:
- sisyphus.solverevdeps.start.__wrapped__(
+ sisyphus.revdepsolve.start.__wrapped__(
pkgname, depclean=True, unmerge=False)
else:
if unmerge:
- sisyphus.solverevdeps.start.__wrapped__(
+ sisyphus.revdepsolve.start.__wrapped__(
pkgname, depclean=False, unmerge=True)
else:
- sisyphus.solverevdeps.start(
+ sisyphus.revdepsolve.start(
pkgname, depclean=True, unmerge=False)
is_installed, is_needed, is_vague, rm_list = pickle.load(
@@ -103,7 +103,7 @@ def start(pkgname, depclean=False, gfx_ui=False, unmerge=False):
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)
+ atexit.register(sisyphus.watchdog.start, p_exe)
for p_out in io.TextIOWrapper(p_exe.stdout, encoding="utf-8"):
print(p_out.rstrip())
@@ -223,7 +223,7 @@ def start(pkgname, depclean=False, gfx_ui=False, unmerge=False):
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)
+ atexit.register(sisyphus.watchdog.start, p_exe)
for p_out in io.TextIOWrapper(p_exe.stdout, encoding="utf-8"):
print(p_out.rstrip())
diff --git a/src/backend/solverevdeps.py b/src/backend/revdepsolve.py
index bba3932..bba3932 100644
--- a/src/backend/solverevdeps.py
+++ b/src/backend/revdepsolve.py
diff --git a/src/backend/sysclean.py b/src/backend/sysclean.py
index ee58db5..15dcbef 100644
--- a/src/backend/sysclean.py
+++ b/src/backend/sysclean.py
@@ -11,9 +11,9 @@ import subprocess
import sys
import sisyphus.checkenv
import sisyphus.getclr
-import sisyphus.killemerge
-import sisyphus.solverevdeps
+import sisyphus.revdepsolve
import sisyphus.syncdb
+import sisyphus.watchdog
def set_nonblocking(fd):
@@ -51,66 +51,75 @@ def start(depclean=False, gfx_ui=False):
sys.exit()
else:
if gfx_ui:
- sisyphus.solverevdeps.start.__wrapped__(depclean=True)
+ sisyphus.revdepsolve.start.__wrapped__(depclean=True)
else:
- sisyphus.solverevdeps.start(depclean=True)
+ sisyphus.revdepsolve.start(depclean=True)
is_installed, is_needed, is_vague, rm_list = pickle.load(
open(os.path.join(sisyphus.getfs.p_mtd_dir, "sisyphus_pkgrevdeps.pickle"), "rb"))
- 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)
+ if len(rm_list) == 0:
+ if gfx_ui:
+ print("\nThe system is clean; no orphaned packages found.\n")
+ else:
+ print(
+ f"{sisyphus.getclr.bright_red}\nThe system is clean; no orphaned packages found.\n{sisyphus.getclr.reset}")
+ sys.exit()
- for p_out in io.TextIOWrapper(p_exe.stdout, encoding="utf-8"):
- print(p_out.rstrip())
+ else:
+ 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.watchdog.start, p_exe)
- p_exe.wait()
- sisyphus.syncdb.lcl_tbl()
+ for p_out in io.TextIOWrapper(p_exe.stdout, encoding="utf-8"):
+ print(p_out.rstrip())
- else:
- print(f"\n{sisyphus.getclr.green}These are the orphaned packages that would be{sisyphus.getclr.reset} 'safely' {sisyphus.getclr.green}unmerged, in order:{sisyphus.getclr.reset}\n")
- print(
- f"\n{sisyphus.getclr.magenta}{', '.join(rm_list)}{sisyphus.getclr.reset}\n")
- print(
- f"\n{sisyphus.getclr.bright_white}Total: {len(rm_list)} orphaned package(s){sisyphus.getclr.reset}\n")
-
- while True:
- user_input = input(
- f"{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'] + args)
- 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()
+ p_exe.wait()
+ sisyphus.syncdb.lcl_tbl()
+
+ else:
+ print(f"\n{sisyphus.getclr.green}These are the orphaned packages that would be{sisyphus.getclr.reset} 'safely' {sisyphus.getclr.green}unmerged, in order:{sisyphus.getclr.reset}\n")
+ print(
+ f"\n{sisyphus.getclr.magenta}{', '.join(rm_list)}{sisyphus.getclr.reset}\n")
+ print(
+ f"\n{sisyphus.getclr.bright_white}Total: {len(rm_list)} orphaned package(s){sisyphus.getclr.reset}\n")
+
+ while True:
+ user_input = input(
+ f"{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'] + args)
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(
- f"\nApologies, the response '{user_input}' was not recognized.\n")
+ 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(
+ f"\nApologies, the response '{user_input}' was not recognized.\n")
diff --git a/src/backend/sysupgrade.py b/src/backend/sysupgrade.py
index c773366..32476c8 100644
--- a/src/backend/sysupgrade.py
+++ b/src/backend/sysupgrade.py
@@ -11,13 +11,13 @@ import subprocess
import sys
import time
import sisyphus.checkenv
+import sisyphus.depsolve
import sisyphus.dlbinpkg
import sisyphus.getclr
import sisyphus.getfs
-import sisyphus.killemerge
-import sisyphus.solvedeps
import sisyphus.syncdb
import sisyphus.syncall
+import sisyphus.watchdog
def set_nonblocking(fd):
@@ -57,10 +57,10 @@ def start(ebuild=False, gfx_ui=False):
sys.exit()
else:
if gfx_ui:
- sisyphus.solvedeps.start.__wrapped__() # undecorate
+ sisyphus.depsolve.start.__wrapped__() # undecorate
else:
sisyphus.syncall.start(gfx_ui=False)
- sisyphus.solvedeps.start()
+ sisyphus.depsolve.start()
bin_list, src_list, is_vague, need_cfg = pickle.load(
open(os.path.join(sisyphus.getfs.p_mtd_dir, "sisyphus_worlddeps.pickle"), "rb"))
@@ -291,7 +291,7 @@ def start(ebuild=False, gfx_ui=False):
p_exe = subprocess.Popen(['emerge'] + go_args + ['--usepkg', '--usepkgonly',
'--rebuilt-binaries', '@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)
+ atexit.register(sisyphus.watchdog.start, p_exe)
for p_out in io.TextIOWrapper(p_exe.stdout, encoding="utf-8"):
print(p_out.rstrip())
diff --git a/src/backend/killemerge.py b/src/backend/watchdog.py
index f01af6b..f01af6b 100644
--- a/src/backend/killemerge.py
+++ b/src/backend/watchdog.py