diff options
author | V3n3RiX <venerix@koprulu.sector> | 2022-09-17 19:12:53 +0100 |
---|---|---|
committer | V3n3RiX <venerix@koprulu.sector> | 2022-09-17 19:12:53 +0100 |
commit | e1562a71d6483021d332bccbfc5a3086688bc58c (patch) | |
tree | 6be3d468e0aadd6c4de6c4dbd7a58ebe9fd59cbb /src/backend/updateAll.py | |
parent | 0cf2c9f8ec52b1ae276c1573210d252ab0c4577b (diff) |
rearrange the backend
Diffstat (limited to 'src/backend/updateAll.py')
-rw-r--r-- | src/backend/updateAll.py | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/src/backend/updateAll.py b/src/backend/updateAll.py new file mode 100644 index 0000000..e981da2 --- /dev/null +++ b/src/backend/updateAll.py @@ -0,0 +1,55 @@ +#!/usr/bin/python3 + +import animation +import sys +import time +import sisyphus.getBinhost +import sisyphus.checkEnvironment +import sisyphus.syncDatabase +import sisyphus.purgeEnvironment +import sisyphus.syncEnvironment + +def syncAll(): + sisyphus.purgeEnvironment.cache() + sisyphus.syncEnvironment.syncStage1() + sisyphus.syncEnvironment.syncStage2() + sisyphus.syncEnvironment.syncStage3() + sisyphus.syncDatabase.syncRemote() + +@animation.wait('fetching updates') +def start(): + activeBranch = sisyphus.checkEnvironment.branch() + isBinhost = sisyphus.getBinhost.start() + isSane = sisyphus.checkEnvironment.sanity() + + if isSane == 1: + syncAll() + else: + if "packages-next" in isBinhost: + print("\nCurrent branch: '" + activeBranch + "' (stable)" + "\nCurrent binhost: '" + isBinhost + "' (testing)") + else: + print("\nCurrent branch: '" + activeBranch + "' (testing)" + "\nCurrent binhost: '" + isBinhost + "' (stable)") + sys.exit("\nInvalid branch - binhost pairing; Use 'sisyphus branch --help' for help; Quitting.") + +def startqt(): + activeBranch = sisyphus.checkEnvironment.branch() + isBinhost = sisyphus.getBinhost.start() + isSane = sisyphus.checkEnvironment.sanity() + + if isSane == 1: + syncAll() + else: + if "packages-next" in isBinhost: + print("\nCurrent branch: '" + activeBranch + "' (stable)" + "\nCurrent binhost: '" + isBinhost + "' (testing)") + else: + print("\nCurrent branch: '" + activeBranch + "' (testing)" + "\nCurrent binhost: '" + isBinhost + "' (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() |