summaryrefslogtreecommitdiff
path: root/src/backend/check.py
diff options
context:
space:
mode:
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()