summaryrefslogtreecommitdiff
path: root/src/backend/check.py
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2022-08-09 23:04:03 +0100
committerV3n3RiX <venerix@koprulu.sector>2022-08-09 23:04:03 +0100
commitd5f7286a28caf0a7f628c09b515e7ed59a1a85fb (patch)
treec3102c803e5007b7b38aaad5319e2724a1250c2c /src/backend/check.py
parenta5d35ec38e020ad47c47247888843052587118e1 (diff)
backend : split check.branch() function
Diffstat (limited to 'src/backend/check.py')
-rw-r--r--src/backend/check.py38
1 files changed, 25 insertions, 13 deletions
diff --git a/src/backend/check.py b/src/backend/check.py
index a159a27..7f23338 100644
--- a/src/backend/check.py
+++ b/src/backend/check.py
@@ -9,22 +9,34 @@ def root():
return True if os.getuid() == 0 else False
def branch():
+ activeBranch = None
+
if os.path.isdir(os.path.join(sisyphus.filesystem.portageRepoDir, '.git')):
os.chdir(sisyphus.filesystem.portageRepoDir)
- needsMatch = int()
-
- isBinhost = sisyphus.binhost.start()
localBranch = subprocess.check_output(['git', 'rev-parse', '--abbrev-ref', 'HEAD'])
- if "packages-next" in isBinhost:
- if localBranch.decode().strip() == "next":
- needsMatch = int(0)
- else:
- needsMatch = int(1)
+ if localBranch.decode().strip() == 'master':
+ activeBranch = str('master')
+
+ if localBranch.decode().strip() == 'next':
+ activeBranch = str('next')
+
+ return activeBranch
+
+def sanity():
+ activeBranch = branch()
+ isBinhost = sisyphus.binhost.start()
+ isSane = int()
+
+ if "packages-next" in isBinhost:
+ if activeBranch == "next":
+ isSane = int(1)
+ else:
+ isSane = int(0)
+ else:
+ if activeBranch == "master":
+ isSane = int(1)
else:
- if localBranch.decode().strip() == "master":
- needsMatch = int(0)
- else:
- needsMatch = int(1)
+ isSane = int(0)
- return needsMatch,localBranch
+ return isSane