summaryrefslogtreecommitdiff
path: root/src/backend/check.py
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2021-02-02 02:09:50 +0000
committerV3n3RiX <venerix@redcorelinux.org>2021-02-02 02:09:50 +0000
commite8e43274a6dda2257f3a43dc2a20572f7779cce5 (patch)
tree61e8175d49c2fef900b2ffb5e9877ea1c98f96fe /src/backend/check.py
parent164772a639ba052169a95c102d38577eb46e285f (diff)
make this code more pretty
Diffstat (limited to 'src/backend/check.py')
-rw-r--r--src/backend/check.py34
1 files changed, 18 insertions, 16 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')):