From 103aa455aee322549c77aad205ce9e92dd7e6b52 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sun, 30 Oct 2022 15:23:53 +0000 Subject: move updateAll -> update --- src/backend/update.py | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 src/backend/update.py (limited to 'src/backend/update.py') diff --git a/src/backend/update.py b/src/backend/update.py new file mode 100644 index 0000000..5a6a6cd --- /dev/null +++ b/src/backend/update.py @@ -0,0 +1,55 @@ +#!/usr/bin/python3 + +import animation +import sys +import time +import sisyphus.checkenv +import sisyphus.getenv +import sisyphus.purgeenv +import sisyphus.syncdb +import sisyphus.syncenv + +def syncAll(): + sisyphus.purgeenv.cache() + sisyphus.syncenv.gentooRepo() + sisyphus.syncenv.redcoreRepo() + sisyphus.syncenv.portageConfigRepo() + sisyphus.syncdb.remoteTable() + +@animation.wait('fetching updates') +def cliExec(): + activeBranch = sisyphus.checkenv.branch() + binhostURL = sisyphus.getenv.binhostURL() + isSane = sisyphus.checkenv.sanity() + + if isSane == 1: + syncAll() + else: + if "packages-next" in binhostURL: + print("\nCurrent branch: '" + activeBranch + "' (stable)" + "\nCurrent binhost: '" + binhostURL + "' (testing)") + else: + print("\nCurrent branch: '" + activeBranch + "' (testing)" + "\nCurrent binhost: '" + binhostURL + "' (stable)") + sys.exit("\nInvalid branch - binhost pairing; Use 'sisyphus branch --help' for help; Quitting.") + +def guiExec(): + activeBranch = sisyphus.checkenv.branch() + binhostURL = sisyphus.getenv.binhostURL() + isSane = sisyphus.checkenv.sanity() + + if isSane == 1: + syncAll() + else: + if "packages-next" in binhostURL: + print("\nCurrent branch: '" + activeBranch + "' (stable)" + "\nCurrent binhost: '" + binhostURL + "' (testing)") + else: + print("\nCurrent branch: '" + activeBranch + "' (testing)" + "\nCurrent binhost: '" + binhostURL + "' (stable)") + print("\nInvalid branch - binhost pairing; Use 'sisyphus branch --help' for help; Quitting in 10 seconds.\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() -- cgit v1.2.3