summaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/check.py36
-rw-r--r--src/backend/sync.py8
-rw-r--r--src/backend/update.py28
3 files changed, 12 insertions, 60 deletions
diff --git a/src/backend/check.py b/src/backend/check.py
index f6ef68d..a159a27 100644
--- a/src/backend/check.py
+++ b/src/backend/check.py
@@ -8,7 +8,7 @@ import sisyphus.filesystem
def root():
return True if os.getuid() == 0 else False
-def match():
+def branch():
if os.path.isdir(os.path.join(sisyphus.filesystem.portageRepoDir, '.git')):
os.chdir(sisyphus.filesystem.portageRepoDir)
needsMatch = int()
@@ -28,37 +28,3 @@ def match():
needsMatch = int(1)
return needsMatch,localBranch
-
-def portage():
- if os.path.isdir(os.path.join(sisyphus.filesystem.portageRepoDir, '.git')):
- os.chdir(sisyphus.filesystem.portageRepoDir)
- needsPortage = 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}'])
-
- 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():
- needsPortage = int(1)
-
- gitExec.wait()
- return needsPortage
-
-def overlay():
- if os.path.isdir(os.path.join(sisyphus.filesystem.redcoreRepoDir, '.git')):
- os.chdir(sisyphus.filesystem.redcoreRepoDir)
- needsOverlay = 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}'])
-
- 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():
- needsOverlay = int(1)
-
- gitExec.wait()
- return needsOverlay
diff --git a/src/backend/sync.py b/src/backend/sync.py
index ebea39c..2490c04 100644
--- a/src/backend/sync.py
+++ b/src/backend/sync.py
@@ -9,14 +9,20 @@ def portage():
localBranch = subprocess.check_output(['git', 'rev-parse', '--abbrev-ref', 'HEAD'])
remoteBranch = subprocess.check_output(['git', 'rev-parse', '--symbolic-full-name', '@{u}'])
- gitExecStage1 = subprocess.Popen(['git', 'reset', '--hard'] + remoteBranch.decode().strip().replace('refs/remotes/','').split() + ['--quiet'], stdout=subprocess.PIPE)
+ gitExecStage1 = subprocess.Popen(['git', 'fetch', '--depth=1', 'origin'] + localBranch.decode().strip().split() + ['--quiet'], stdout=subprocess.PIPE)
gitExecStage1.wait()
+ gitExecStage2 = subprocess.Popen(['git', 'reset', '--hard'] + remoteBranch.decode().strip().replace('refs/remotes/','').split() + ['--quiet'], stdout=subprocess.PIPE)
+ gitExecStage2.wait()
+
def overlay():
os.chdir(sisyphus.filesystem.redcoreRepoDir)
localBranch = subprocess.check_output(['git', 'rev-parse', '--abbrev-ref', 'HEAD'])
remoteBranch = subprocess.check_output(['git', 'rev-parse', '--symbolic-full-name', '@{u}'])
+ gitExecStage1 = subprocess.Popen(['git', 'fetch', '--depth=1', 'origin'] + localBranch.decode().strip().split() + ['--quiet'], stdout=subprocess.PIPE)
+ gitExecStage1.wait()
+
gitExecStage1 = subprocess.Popen(['git', 'reset', '--hard'] + remoteBranch.decode().strip().replace('refs/remotes/','').split() + ['--quiet'], stdout=subprocess.PIPE)
gitExecStage1.wait()
diff --git a/src/backend/update.py b/src/backend/update.py
index 2b92dbd..82281fe 100644
--- a/src/backend/update.py
+++ b/src/backend/update.py
@@ -15,33 +15,13 @@ def syncAll():
sisyphus.sync.portageCfg()
sisyphus.database.syncRemote()
-def syncCfg():
- sisyphus.sync.portageCfg()
-
-def doSync():
- sisyphus.cache.purge()
-
- needsPortage = sisyphus.check.portage()
- needsOverlay = sisyphus.check.overlay()
-
- if needsPortage == 1:
- if needsOverlay == 1:
- syncAll()
- elif not needsOverlay == 1:
- syncAll()
- elif not needsPortage == 1:
- if needsOverlay == 1:
- syncAll()
- elif not needsOverlay == 1:
- syncCfg()
-
@animation.wait('fetching updates')
def start():
isBinhost = sisyphus.binhost.start()
- needsMatch,localBranch = sisyphus.check.match()
+ needsMatch,localBranch = sisyphus.check.branch()
if needsMatch == 0:
- doSync()
+ syncAll()
else:
if "packages-next" in isBinhost:
print("\nCurrent branch: '" + localBranch.decode().strip() + "' (stable)" + "\nCurrent binhost: '" + isBinhost + "' (testing)")
@@ -51,10 +31,10 @@ def start():
def startqt():
isBinhost = sisyphus.binhost.start()
- needsMatch,localBranch = sisyphus.check.match()
+ needsMatch,localBranch = sisyphus.check.branch()
if needsMatch == 0:
- doSync()
+ syncAll()
else:
if "packages-next" in isBinhost:
print("\nCurrent branch: '" + localBranch.decode().strip() + "' (stable)" + "\nCurrent binhost: '" + isBinhost + "' (testing)")