From a1067ff82a989fb6d7d8026bd16992ab9fb13898 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sat, 6 Mar 2021 21:43:18 +0000 Subject: backend: * drop some checks we had in place due to expensive metadata regen * less time checking -> more time working -> faster sisyphus --- src/backend/check.py | 36 +----------------------------------- src/backend/sync.py | 8 +++++++- src/backend/update.py | 28 ++++------------------------ src/frontend/cli/sisyphus-cli.py | 1 - src/frontend/gui/sisyphus-gui.py | 1 - 5 files changed, 12 insertions(+), 62 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)") diff --git a/src/frontend/cli/sisyphus-cli.py b/src/frontend/cli/sisyphus-cli.py index eb385d1..f38fddb 100755 --- a/src/frontend/cli/sisyphus-cli.py +++ b/src/frontend/cli/sisyphus-cli.py @@ -286,6 +286,5 @@ def mirrorset(index: int): if __name__ == "__main__": if len(sys.argv) > 1 and not '--help' in sys.argv: - sisyphus.check.update() sisyphus.setjobs.start() app() diff --git a/src/frontend/gui/sisyphus-gui.py b/src/frontend/gui/sisyphus-gui.py index 67d3f1f..d18875e 100644 --- a/src/frontend/gui/sisyphus-gui.py +++ b/src/frontend/gui/sisyphus-gui.py @@ -383,7 +383,6 @@ class MainWorker(QtCore.QObject): @QtCore.pyqtSlot() def startUpdate(self): self.started.emit() - sisyphus.check.update() sisyphus.setjobs.start() sisyphus.update.startqt() self.finished.emit() -- cgit v1.2.3