summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2019-09-08 15:14:19 +0100
committerV3n3RiX <venerix@redcorelinux.org>2019-09-08 15:14:19 +0100
commit05622c425f532dc3767105ff75c463483a7acf88 (patch)
treebf7bd5948c0f72e6aef120e4c488f7c970671649 /src
parent276c3ea5993e600766322d0ef5452fe73908a2f3 (diff)
More bugfixesv3.1909.0
* backend : * make sync more reliable and future proof (in case we will have more branches) * while the bugfix commit 12c2d64d475552f7ccfb078613a8fbfcea1efaba fixed a long stading bug * it also slowed us down considerably triggering metadata refresh when it wasn't actually * needed. Rework the code to trigger metadata refresh only when absolutely needed * this will speed up things considerably, specially dependency resolution
Diffstat (limited to 'src')
-rw-r--r--src/backend/libsisyphus.py78
1 files changed, 52 insertions, 26 deletions
diff --git a/src/backend/libsisyphus.py b/src/backend/libsisyphus.py
index 8af5bf7..5ce9129 100644
--- a/src/backend/libsisyphus.py
+++ b/src/backend/libsisyphus.py
@@ -180,38 +180,59 @@ def syncLocalDatabase():
sisyphusdb.commit()
sisyphusdb.close()
+def checkPortageTree():
+ os.chdir(gentooEbuildDir)
+ needsPortageTreeSync = 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}'])
+
+ subprocess.call(['git', 'fetch', '--depth=1', 'origin'] + localBranch.decode().strip().split() + ['--quiet'])
+
+ if not localHash.decode().strip() == remoteHash.decode().strip():
+ needsPortageTreeSync = int(1)
+
+ return needsPortageTreeSync
+
+def checkOverlayTree():
+ os.chdir(redcoreEbuildDir)
+ needsOverlayTreeSync = 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}'])
+
+ subprocess.call(['git', 'fetch', '--depth=1', 'origin'] + localBranch.decode().strip().split() + ['--quiet'])
+
+ if not localHash.decode().strip() == remoteHash.decode().strip():
+ needsOverlayTreeSync = int(1)
+
+ return needsOverlayTreeSync
+
def syncPortageTree():
os.chdir(gentooEbuildDir)
- currentBranch = subprocess.check_output(['git', 'rev-parse', '--abbrev-ref', 'HEAD'])
+ localBranch = subprocess.check_output(['git', 'rev-parse', '--abbrev-ref', 'HEAD'])
+ remoteBranch = subprocess.check_output(['git', 'rev-parse', '--symbolic-full-name', '@{u}'])
- if currentBranch.decode().strip() is 'master':
- subprocess.call(['git', 'fetch', '--depth=1', 'origin', 'master', '--quiet'])
- subprocess.call(['git', 'reset', '--hard', 'origin/master', '--quiet'])
- elif currentBranch.decode().strip() is 'next':
- subprocess.call(['git', 'fetch', '--depth=1', 'origin', 'next', '--quiet'])
- subprocess.call(['git', 'reset', '--hard', 'origin/next', '--quiet'])
+ subprocess.call(['git', 'fetch', '--depth=1', 'origin'] + localBranch.decode().strip().split() + ['--quiet'])
+ subprocess.call(['git', 'reset', '--hard'] + remoteBranch.decode().strip().replace('refs/remotes/','').split() + ['--quiet'])
def syncOverlayTree():
os.chdir(redcoreEbuildDir)
- currentBranch = subprocess.check_output(['git', 'rev-parse', '--abbrev-ref', 'HEAD'])
+ localBranch = subprocess.check_output(['git', 'rev-parse', '--abbrev-ref', 'HEAD'])
+ remoteBranch = subprocess.check_output(['git', 'rev-parse', '--symbolic-full-name', '@{u}'])
- if currentBranch.decode().strip() is 'master':
- subprocess.call(['git', 'fetch', '--depth=1', 'origin', 'master', '--quiet'])
- subprocess.call(['git', 'reset', '--hard', 'origin/master', '--quiet'])
- elif currentBranch.decode().strip() is 'next':
- subprocess.call(['git', 'fetch', '--depth=1', 'origin', 'next', '--quiet'])
- subprocess.call(['git', 'reset', '--hard', 'origin/next', '--quiet'])
+ subprocess.call(['git', 'fetch', '--depth=1', 'origin'] + localBranch.decode().strip().split() + ['--quiet'])
+ subprocess.call(['git', 'reset', '--hard'] + remoteBranch.decode().strip().replace('refs/remotes/','').split() + ['--quiet'])
def syncPortageCfg():
os.chdir(portageConfigDir)
- currentBranch = subprocess.check_output(['git', 'rev-parse', '--abbrev-ref', 'HEAD'])
+ localBranch = subprocess.check_output(['git', 'rev-parse', '--abbrev-ref', 'HEAD'])
+ remoteBranch = subprocess.check_output(['git', 'rev-parse', '--symbolic-full-name', '@{u}'])
- if currentBranch.decode().strip() is 'master':
- subprocess.call(['git', 'fetch', '--depth=1', 'origin', 'master', '--quiet'])
- subprocess.call(['git', 'reset', '--hard', 'origin/master', '--quiet'])
- elif currentBranch.decode().strip() is 'next':
- subprocess.call(['git', 'fetch', '--depth=1', 'origin', 'next', '--quiet'])
- subprocess.call(['git', 'reset', '--hard', 'origin/next', '--quiet'])
+ subprocess.call(['git', 'fetch', '--depth=1', 'origin'] + localBranch.decode().strip().split() + ['--quiet'])
+ subprocess.call(['git', 'reset', '--hard'] + remoteBranch.decode().strip().replace('refs/remotes/','').split() + ['--quiet'])
def syncPortageMtd():
if os.path.isdir(portageMetadataDir):
@@ -239,11 +260,16 @@ def cleanCacheDir():
def startUpdate():
checkRoot()
cleanCacheDir()
- syncPortageTree()
- syncOverlayTree()
- syncPortageCfg()
- syncPortageMtd()
- syncRemoteDatabase()
+
+ needsPortageTreeSync = checkPortageTree()
+ needsOverlayTreeSync = checkOverlayTree()
+
+ if (needsPortageTreeSync == 1) or (needsOverlayTreeSync == 1):
+ syncPortageTree()
+ syncOverlayTree()
+ syncPortageCfg()
+ syncPortageMtd()
+ syncRemoteDatabase()
@animation.wait('syncing spm changes')
def startSyncSPM():