summaryrefslogtreecommitdiff
path: root/src/backend/update.py
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2021-02-02 01:07:55 +0000
committerV3n3RiX <venerix@redcorelinux.org>2021-02-02 01:07:55 +0000
commited3747e4ff721914d1df6b62788a91a1e8b3f741 (patch)
tree25f2987643c99657eb8f7945d1f68c19c9cfa2bf /src/backend/update.py
parentfb13a317b1468c6070f4c6131a6526ffbf284511 (diff)
* better explain some used terms
* update the help menu and CLI documentation * remove animations from setjobs module (it takes less than a second, so it's pointless) * make some error messages less cryptic && offer help to understand them * don't kill the graphical interface right away if there is a missmatch, display the error, offer help && and then die in 10 seconds
Diffstat (limited to 'src/backend/update.py')
-rw-r--r--src/backend/update.py85
1 files changed, 55 insertions, 30 deletions
diff --git a/src/backend/update.py b/src/backend/update.py
index 655b705..63624f5 100644
--- a/src/backend/update.py
+++ b/src/backend/update.py
@@ -2,6 +2,7 @@
import animation
import sys
+import time
import sisyphus.cache
import sisyphus.binhost
import sisyphus.check
@@ -9,38 +10,62 @@ import sisyphus.database
import sisyphus.metadata
import sisyphus.sync
+def dosync():
+ sisyphus.sync.portage()
+ sisyphus.sync.overlay()
+ sisyphus.sync.portageCfg()
+ sisyphus.database.syncRemote()
+ sisyphus.metadata.regenSilent()
+
+def checksync():
+ sisyphus.cache.clean()
+
+ needsPortage = sisyphus.check.portage()
+ needsOverlay = sisyphus.check.overlay()
+
+ if needsPortage == 1:
+ if needsOverlay == 1:
+ dosync()
+ elif not needsOverlay == 1:
+ dosync()
+ elif not needsPortage == 1:
+ if needsOverlay == 1:
+ dosync()
+ elif not needsOverlay == 1:
+ sisyphus.sync.portageCfg()
+
@animation.wait('fetching updates')
def start():
- sisyphus.cache.clean()
+ binhostURL = sisyphus.binhost.getURL()
+ branchBinhostMatch,localBranch = sisyphus.check.branch()
+
+ if branchBinhostMatch == 1:
+ checksync()
+ else:
+ if "packages-next" in binhostURL:
+ print("\nCurrent branch: '" + localBranch.decode().strip() + "' (stable)" + "\nCurrent binhost: '" + binhostURL + "' (testing)")
+ else:
+ print("\nCurrent branch: '" + localBranch.decode().strip() + "' (testing)" + "\nCurrent binhost: '" + binhostURL + "' (stable)")
+ sys.exit("\nInvalid branch - binhost pairing; Use 'sisyphus branch --help' for help; Quitting.")
+def startqt():
binhostURL = sisyphus.binhost.getURL()
- branchRepoMissmatch,localBranch = sisyphus.check.branch()
-
- if branchRepoMissmatch == 0:
- needsPortage = sisyphus.check.portage()
- needsOverlay = sisyphus.check.overlay()
-
- if needsPortage == 1:
- if needsOverlay == 1:
- sisyphus.sync.portage()
- sisyphus.sync.overlay()
- sisyphus.sync.portageCfg()
- sisyphus.database.syncRemote()
- sisyphus.metadata.regenSilent()
- elif not needsOverlay == 1:
- sisyphus.sync.portage()
- sisyphus.sync.overlay()
- sisyphus.sync.portageCfg()
- sisyphus.database.syncRemote()
- sisyphus.metadata.regenSilent()
- elif not needsPortage == 1:
- if needsOverlay == 1:
- sisyphus.sync.portage()
- sisyphus.sync.overlay()
- sisyphus.sync.portageCfg()
- sisyphus.database.syncRemote()
- sisyphus.metadata.regenSilent()
- elif not needsOverlay == 1:
- sisyphus.sync.portageCfg()
+ branchBinhostMatch,localBranch = sisyphus.check.branch()
+
+ if branchBinhostMatch == 1:
+ checksync()
else:
- sys.exit("\n" + "Branch :" + " '" + localBranch.decode().strip() + "' " + "\n" + "Repository :" + " '" + binhostURL + "' " + "\n" + "Branch - Repository missmatch; Quitting.")
+ if "packages-next" in binhostURL:
+ print("\nCurrent branch: '" + localBranch.decode().strip() + "' (stable)" + "\nCurrent binhost: '" + binhostURL + "' (testing)")
+ else:
+ print("\nCurrent branch: '" + localBranch.decode().strip() + "' (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()