summaryrefslogtreecommitdiff
path: root/src/backend/update.py
diff options
context:
space:
mode:
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()