diff options
author | V3n3RiX <venerix@koprulu.sector> | 2023-04-07 21:29:53 +0100 |
---|---|---|
committer | V3n3RiX <venerix@koprulu.sector> | 2023-04-07 21:29:53 +0100 |
commit | 9a58956bf3491dd492e1d7cdac4da21f847fb8e9 (patch) | |
tree | ac94d0a6ee686adf2881430e37db115295029257 | |
parent | c1f682729399414e88cac4d5a740b05242657312 (diff) |
rewrite update
-rw-r--r-- | src/backend/install.py | 4 | ||||
-rw-r--r-- | src/backend/search.py | 2 | ||||
-rw-r--r-- | src/backend/update.py | 41 | ||||
-rw-r--r-- | src/backend/upgrade.py | 4 | ||||
-rwxr-xr-x | src/frontend/cli/sisyphus-cli.py | 2 | ||||
-rw-r--r-- | src/frontend/gui/sisyphus-gui.py | 2 |
6 files changed, 23 insertions, 32 deletions
diff --git a/src/backend/install.py b/src/backend/install.py index 83f26f6..16779c5 100644 --- a/src/backend/install.py +++ b/src/backend/install.py @@ -18,7 +18,7 @@ import sisyphus.update def start(pkgname): if sisyphus.checkenv.root(): - sisyphus.update.start() + sisyphus.update.start(gfx_ui=False) sisyphus.solvedeps.start(pkgname) bin_list, src_list, need_cfg = pickle.load( open(os.path.join(sisyphus.getfs.p_mtd_dir, "sisyphus_pkgdeps.pickle"), "rb")) @@ -72,7 +72,7 @@ def start(pkgname): def estart(pkgname): if sisyphus.checkenv.root(): - sisyphus.update.start() + sisyphus.update.start(gfx_ui=False) sisyphus.solvedeps.start(pkgname) bin_list, src_list, need_cfg = pickle.load( open(os.path.join(sisyphus.getfs.p_mtd_dir, "sisyphus_pkgdeps.pickle"), "rb")) diff --git a/src/backend/search.py b/src/backend/search.py index ab6ffa2..588f9cd 100644 --- a/src/backend/search.py +++ b/src/backend/search.py @@ -146,7 +146,7 @@ def srch_rslt(filter, cat, pn, desc, single): def start(filter, cat, pn, desc, single): if sisyphus.checkenv.root(): - sisyphus.update.start() + sisyphus.update.start(gfx_ui=False) else: print(sisyphus.getcolor.bright_red + "\nYou don't have root permissions, cannot update the database!\n" + sisyphus.getcolor.reset + sisyphus.getcolor.bright_yellow + "\nSearch results may be inaccurate" + sisyphus.getcolor.reset) diff --git a/src/backend/update.py b/src/backend/update.py index dc16d4c..54e07e3 100644 --- a/src/backend/update.py +++ b/src/backend/update.py @@ -19,7 +19,7 @@ def sync_evrth(): @animation.wait('fetching updates') -def start(): +def start(gfx_ui=False): actv_brch = sisyphus.getenv.sys_brch() bhst_addr = sisyphus.getenv.bhst_addr() is_sane = sisyphus.checkenv.sanity() @@ -33,31 +33,22 @@ def start(): else: print(sisyphus.getcolor.green + "\n\nActive branch:" + " " + sisyphus.getcolor.reset + "'" + actv_brch + "'" + " " + "(testing)" + " " + sisyphus.getcolor.green + "\nActive binhost:" + " " + sisyphus.getcolor.reset + "'" + bhst_addr + "'" + " " + "(stable)") - sys.exit(sisyphus.getcolor.bright_red + "\n\nInvalid configuration!" + sisyphus.getcolor.reset + sisyphus.getcolor.bright_yellow + "\nUse" + - sisyphus.getcolor.reset + " " + "'" + "sisyphus branch --help" + "'" + " " + sisyphus.getcolor.bright_yellow + "for help" + sisyphus.getcolor.reset) + if gfx_ui: + print("\n\nInvalid configuration!") + print("Use 'sisyphus branch --help' for help\n") + t = 10 + while t > 0: + mins, secs = divmod(t, 60) + timer = '{:02d}:{:02d}'.format(mins, secs) + print(timer, end='\r') + time.sleep(1) + t -= 1 -def xstart(): - actv_brch = sisyphus.getenv.sys_brch() - bhst_addr = sisyphus.getenv.bhst_addr() - is_sane = sisyphus.checkenv.sanity() + print('Time is up!') + sys.exit() - if is_sane == 1: - sync_evrth() - else: - if "packages-next" in bhst_addr: - print("\n\nActive branch:" + " " + "'" + actv_brch + "'" + " " + "(stable)" + - "\nActive binhost:" + " " + "'" + bhst_addr + "'" + " " + "(testing)") else: - print("\n\nActive branch:" + " " + "'" + actv_brch + "'" + " " + "(testing)" + - "\nActive binhost:" + " " + "'" + bhst_addr + "'" + " " + "(stable)") - print("\n\nInvalid configuration!" + - "\nUse 'sisyphus branch --help' for help\n") - t = int(10) - while t: - mins, secs = divmod(t, 60) - timer = '{:02d}:{:02d}'.format(mins, secs) - print(timer, end="\r") - time.sleep(1) - t -= 1 - sys.exit() + print(sisyphus.getcolor.bright_red + "\n\nInvalid configuration!" + sisyphus.getcolor.reset + sisyphus.getcolor.bright_yellow + "\nUse" + + sisyphus.getcolor.reset + " " + "'" + "sisyphus branch --help" + "'" + " " + sisyphus.getcolor.bright_yellow + "for help" + sisyphus.getcolor.reset) + sys.exit() diff --git a/src/backend/upgrade.py b/src/backend/upgrade.py index 376872d..bffcf2d 100644 --- a/src/backend/upgrade.py +++ b/src/backend/upgrade.py @@ -18,7 +18,7 @@ import sisyphus.update def start(): if sisyphus.checkenv.root(): - sisyphus.update.start() + sisyphus.update.start(gfx_ui=False) sisyphus.solvedeps.start() bin_list, src_list, need_cfg = pickle.load( open(os.path.join(sisyphus.getfs.p_mtd_dir, "sisyphus_worlddeps.pickle"), "rb")) @@ -72,7 +72,7 @@ def start(): def estart(): if sisyphus.checkenv.root(): - sisyphus.update.start() + sisyphus.update.start(gfx_ui=False) sisyphus.solvedeps.start() bin_list, src_list, need_cfg = pickle.load( open(os.path.join(sisyphus.getfs.p_mtd_dir, "sisyphus_worlddeps.pickle"), "rb")) diff --git a/src/frontend/cli/sisyphus-cli.py b/src/frontend/cli/sisyphus-cli.py index 6b3a351..634cb5f 100755 --- a/src/frontend/cli/sisyphus-cli.py +++ b/src/frontend/cli/sisyphus-cli.py @@ -186,7 +186,7 @@ def autoclean(): def update(): """Update the Portage tree, the Redcore Overlay(s), Portage configs and Sisyphus's package database.""" if sisyphus.checkenv.root(): - sisyphus.update.start() + sisyphus.update.start(gfx_ui=False) else: sys.exit("\nYou need root permissions to do this, exiting!\n") diff --git a/src/frontend/gui/sisyphus-gui.py b/src/frontend/gui/sisyphus-gui.py index 8c55772..3cee61c 100644 --- a/src/frontend/gui/sisyphus-gui.py +++ b/src/frontend/gui/sisyphus-gui.py @@ -391,7 +391,7 @@ class MainWorker(QtCore.QObject): def startUpdate(self): self.started.emit() sisyphus.setjobs.start() - sisyphus.update.xstart() + sisyphus.update.start(gfx_ui=True) self.finished.emit() @QtCore.pyqtSlot() |