diff options
author | V3n3RiX <venerix@koprulu.sector> | 2022-10-30 14:26:52 +0000 |
---|---|---|
committer | V3n3RiX <venerix@koprulu.sector> | 2022-10-30 14:26:52 +0000 |
commit | 02b654dc089c570ce81ce5da0c2c48d5d21d3cb8 (patch) | |
tree | 2a32a8634b59efc8b9f28ec8d8732cdd6b3b3414 /src/backend/checkenv.py | |
parent | 331cd284de1de5f7192e1588b836f89337326784 (diff) |
move getEnvironment -> getenv
Diffstat (limited to 'src/backend/checkenv.py')
-rw-r--r-- | src/backend/checkenv.py | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/backend/checkenv.py b/src/backend/checkenv.py new file mode 100644 index 0000000..feaab4b --- /dev/null +++ b/src/backend/checkenv.py @@ -0,0 +1,42 @@ +#!/usr/bin/python3 + +import os +import subprocess +import sisyphus.getenv +import sisyphus.getFilesystem + +def root(): + return True if os.getuid() == 0 else False + +def branch(): + activeBranch = None + + if os.path.isdir(os.path.join(sisyphus.getFilesystem.gentooRepoDir, '.git')): + os.chdir(sisyphus.getFilesystem.gentooRepoDir) + localBranch = subprocess.check_output(['git', 'rev-parse', '--abbrev-ref', 'HEAD']) + + if localBranch.decode().strip() == 'master': + activeBranch = str('master') + + if localBranch.decode().strip() == 'next': + activeBranch = str('next') + + return activeBranch + +def sanity(): + activeBranch = branch() + binhostURL = sisyphus.getenv.binhostURL() + isSane = int() + + if "packages-next" in binhostURL: + if activeBranch == "next": + isSane = int(1) + else: + isSane = int(0) + else: + if activeBranch == "master": + isSane = int(1) + else: + isSane = int(0) + + return isSane |