summaryrefslogtreecommitdiff
path: root/src/backend/check.py
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2020-06-10 00:12:21 +0100
committerV3n3RiX <venerix@redcorelinux.org>2020-06-10 00:12:21 +0100
commitdf5e80d63cff8acce2b510e1f2be07a7e1369415 (patch)
tree85f3127fb5f533719008edc98c97e2bfcb76ac9a /src/backend/check.py
parentc76a29a71d16e9ed512a22945d6e6b77b0d21fb6 (diff)
branchsetup : new generic module, drop old branchinject, branchmaster && branchnext modules; plug the new module into the new cli client -> works magic
Diffstat (limited to 'src/backend/check.py')
-rw-r--r--src/backend/check.py42
1 files changed, 22 insertions, 20 deletions
diff --git a/src/backend/check.py b/src/backend/check.py
index 9c0a878..a129d36 100644
--- a/src/backend/check.py
+++ b/src/backend/check.py
@@ -10,36 +10,38 @@ def root():
sys.exit("\nYou need root permissions to do this, exiting!\n")
def portage():
- os.chdir(sisyphus.filesystem.portageRepoDir)
- needsPortageSync = int()
+ if os.path.isdir(os.path.join(sisyphus.filesystem.portageRepoDir, '.git')):
+ os.chdir(sisyphus.filesystem.portageRepoDir)
+ needsPortageSync = int()
- localBranch = subprocess.check_output(['git', 'rev-parse', '--abbrev-ref', 'HEAD'])
- localHash = subprocess.check_output(['git', 'rev-parse', '@'])
- remoteHash = subprocess.check_output(['git', 'rev-parse', '@{u}'])
+ localBranch = subprocess.check_output(['git', 'rev-parse', '--abbrev-ref', 'HEAD'])
+ localHash = subprocess.check_output(['git', 'rev-parse', '@'])
+ remoteHash = subprocess.check_output(['git', 'rev-parse', '@{u}'])
- gitExec = subprocess.Popen(['git', 'fetch', '--depth=1', 'origin'] + localBranch.decode().strip().split() + ['--quiet'], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL)
+ gitExec = subprocess.Popen(['git', 'fetch', '--depth=1', 'origin'] + localBranch.decode().strip().split() + ['--quiet'], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL)
- if not localHash.decode().strip() == remoteHash.decode().strip():
- needsPortageSync = int(1)
+ if not localHash.decode().strip() == remoteHash.decode().strip():
+ needsPortageSync = int(1)
- gitExec.wait()
- return needsPortageSync
+ gitExec.wait()
+ return needsPortageSync
def overlay():
- os.chdir(sisyphus.filesystem.redcoreRepoDir)
- needsOverlaySync = int()
+ if os.path.isdir(os.path.join(sisyphus.filesystem.redcoreRepoDir, '.git')):
+ os.chdir(sisyphus.filesystem.redcoreRepoDir)
+ needsOverlaySync = int()
- localBranch = subprocess.check_output(['git', 'rev-parse', '--abbrev-ref', 'HEAD'])
- localHash = subprocess.check_output(['git', 'rev-parse', '@'])
- remoteHash = subprocess.check_output(['git', 'rev-parse', '@{u}'])
+ localBranch = subprocess.check_output(['git', 'rev-parse', '--abbrev-ref', 'HEAD'])
+ localHash = subprocess.check_output(['git', 'rev-parse', '@'])
+ remoteHash = subprocess.check_output(['git', 'rev-parse', '@{u}'])
- gitExec = subprocess.Popen(['git', 'fetch', '--depth=1', 'origin'] + localBranch.decode().strip().split() + ['--quiet'], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL)
+ gitExec = subprocess.Popen(['git', 'fetch', '--depth=1', 'origin'] + localBranch.decode().strip().split() + ['--quiet'], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL)
- if not localHash.decode().strip() == remoteHash.decode().strip():
- needsOverlaySync = int(1)
+ if not localHash.decode().strip() == remoteHash.decode().strip():
+ needsOverlaySync = int(1)
- gitExec.wait()
- return needsOverlaySync
+ gitExec.wait()
+ return needsOverlaySync
def update():
portage()