summaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/check.py20
-rw-r--r--src/backend/update.py56
2 files changed, 52 insertions, 24 deletions
diff --git a/src/backend/check.py b/src/backend/check.py
index b2d8206..2c4cedb 100644
--- a/src/backend/check.py
+++ b/src/backend/check.py
@@ -2,11 +2,31 @@
import os
import subprocess
+import sisyphus.binhost
import sisyphus.filesystem
def root():
return True if os.getuid() == 0 else False
+def branch():
+ branchRepoMissmatch = int()
+ binhostURL = sisyphus.binhost.getURL()
+ localBranch = subprocess.check_output(['git', 'rev-parse', '--abbrev-ref', 'HEAD'])
+
+ os.chdir(sisyphus.filesystem.portageRepoDir)
+ if "packages-next" in binhostURL:
+ if localBranch.decode().strip() == "next":
+ branchRepoMissmatch = int(0)
+ else:
+ branchRepoMissmatch = int(1)
+ else:
+ if localBranch.decode().strip() == "master":
+ branchRepoMissmatch = int(0)
+ else:
+ branchRepoMissmatch = int(1)
+
+ return branchRepoMissmatch,localBranch
+
def portage():
if os.path.isdir(os.path.join(sisyphus.filesystem.portageRepoDir, '.git')):
os.chdir(sisyphus.filesystem.portageRepoDir)
diff --git a/src/backend/update.py b/src/backend/update.py
index 902c398..655b705 100644
--- a/src/backend/update.py
+++ b/src/backend/update.py
@@ -1,7 +1,9 @@
#!/usr/bin/python3
import animation
+import sys
import sisyphus.cache
+import sisyphus.binhost
import sisyphus.check
import sisyphus.database
import sisyphus.metadata
@@ -11,28 +13,34 @@ import sisyphus.sync
def start():
sisyphus.cache.clean()
- needsPortage = sisyphus.check.portage()
- needsOverlay = sisyphus.check.overlay()
+ binhostURL = sisyphus.binhost.getURL()
+ branchRepoMissmatch,localBranch = sisyphus.check.branch()
- 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()
+ 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()
+ else:
+ sys.exit("\n" + "Branch :" + " '" + localBranch.decode().strip() + "' " + "\n" + "Repository :" + " '" + binhostURL + "' " + "\n" + "Branch - Repository missmatch; Quitting.")