summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/backend/check.py34
-rw-r--r--src/backend/update.py8
2 files changed, 22 insertions, 20 deletions
diff --git a/src/backend/check.py b/src/backend/check.py
index d764a85..3715705 100644
--- a/src/backend/check.py
+++ b/src/backend/check.py
@@ -8,24 +8,26 @@ import sisyphus.filesystem
def root():
return True if os.getuid() == 0 else False
-def branch():
- branchBinhostMatch = 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":
- branchBinhostMatch = int(1)
- else:
- branchBinhostMatch = int(0)
- else:
- if localBranch.decode().strip() == "master":
- branchBinhostMatch = int(1)
+def match():
+ if os.path.isdir(os.path.join(sisyphus.filesystem.portageRepoDir, '.git')):
+ os.chdir(sisyphus.filesystem.portageRepoDir)
+ needsMatch = int()
+
+ binhostURL = sisyphus.binhost.getURL()
+ localBranch = subprocess.check_output(['git', 'rev-parse', '--abbrev-ref', 'HEAD'])
+
+ if "packages-next" in binhostURL:
+ if localBranch.decode().strip() == "next":
+ needsMatch = int(0)
+ else:
+ needsMatch = int(1)
else:
- branchBinhostMatch = int(0)
+ if localBranch.decode().strip() == "master":
+ needsMatch = int(0)
+ else:
+ needsMatch = int(1)
- return branchBinhostMatch,localBranch
+ return needsMatch,localBranch
def portage():
if os.path.isdir(os.path.join(sisyphus.filesystem.portageRepoDir, '.git')):
diff --git a/src/backend/update.py b/src/backend/update.py
index 63624f5..a70d0e5 100644
--- a/src/backend/update.py
+++ b/src/backend/update.py
@@ -37,9 +37,9 @@ def checksync():
@animation.wait('fetching updates')
def start():
binhostURL = sisyphus.binhost.getURL()
- branchBinhostMatch,localBranch = sisyphus.check.branch()
+ needsMatch,localBranch = sisyphus.check.match()
- if branchBinhostMatch == 1:
+ if needsMatch == 0:
checksync()
else:
if "packages-next" in binhostURL:
@@ -50,9 +50,9 @@ def start():
def startqt():
binhostURL = sisyphus.binhost.getURL()
- branchBinhostMatch,localBranch = sisyphus.check.branch()
+ needsMatch,localBranch = sisyphus.check.match()
- if branchBinhostMatch == 1:
+ if needsMatch == 0:
checksync()
else:
if "packages-next" in binhostURL: