From d7cd57ef0934be4830fe1518ed35841550398f7e Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Tue, 20 Nov 2018 16:43:00 +0000 Subject: libsisyphus : make use of tuples to get all dependency (binary,source) information in one go, thus improving dependency resolution time by 100% --- src/backend/libsisyphus.py | 40 ++++++++++++---------------------------- src/frontend/gui/sisyphus-gui.py | 4 ++-- 2 files changed, 14 insertions(+), 30 deletions(-) diff --git a/src/backend/libsisyphus.py b/src/backend/libsisyphus.py index 2510ec6..fc91131 100644 --- a/src/backend/libsisyphus.py +++ b/src/backend/libsisyphus.py @@ -65,49 +65,37 @@ def getRemoteDscsURL(): remoteDscsURL = str(portageOutput.rstrip().split("=")[1].strip('\"').replace('packages', 'csv') + 'remoteDescriptionsPre.csv') return remoteDscsURL -@animation.wait('resolving binary dependencies') -def getPkgBinaryDeps(pkgList): +@animation.wait('resolving dependencies') +def getPackageDeps(pkgList): binaryDeps = [] + sourceDeps = [] portageExec = subprocess.Popen(['emerge', '--quiet', '--pretend', '--getbinpkg', '--rebuilt-binaries', '--misspell-suggestion=n', '--fuzzy-search=n'] + pkgList, stdout=subprocess.PIPE) for portageOutput in io.TextIOWrapper(portageExec.stdout, encoding="utf-8"): if "binary" in portageOutput.rstrip(): binaryDep = str(portageOutput.rstrip().split("]")[1].split("[")[0].strip("\ ")) binaryDeps.append(binaryDep) - return binaryDeps -@animation.wait('resolving source dependencies') -def getPkgSourceDeps(pkgList): - sourceDeps = [] - portageExec = subprocess.Popen(['emerge', '--quiet', '--pretend', '--getbinpkg', '--rebuilt-binaries', '--misspell-suggestion=n', '--fuzzy-search=n'] + pkgList, stdout=subprocess.PIPE) - - for portageOutput in io.TextIOWrapper(portageExec.stdout, encoding="utf-8"): if "ebuild" in portageOutput.rstrip(): sourceDep = str(portageOutput.rstrip().split("]")[1].split("[")[0].strip("\ ")) sourceDeps.append(sourceDep) - return sourceDeps + return binaryDeps,sourceDeps -@animation.wait('resolving binary dependencies') -def getWorldBinaryDeps(): +@animation.wait('resolving dependencies') +def getWorldDeps(): binaryDeps = [] + sourceDeps = [] portageExec = subprocess.Popen(['emerge', '--quiet', '--update', '--deep', '--newuse', '--pretend', '--getbinpkg', '--rebuilt-binaries', '--backtrack=100', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n', '@world'], stdout=subprocess.PIPE) for portageOutput in io.TextIOWrapper(portageExec.stdout, encoding="utf-8"): if "binary" in portageOutput.rstrip(): binaryDep = str(portageOutput.rstrip().split("]")[1].split("[")[0].strip("\ ")) binaryDeps.append(binaryDep) - return binaryDeps -@animation.wait('resolving source dependencies') -def getWorldSourceDeps(): - sourceDeps = [] - portageExec = subprocess.Popen(['emerge', '--quiet', '--update', '--deep', '--newuse', '--pretend', '--getbinpkg', '--rebuilt-binaries', '--backtrack=100', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n', '@world'], stdout=subprocess.PIPE) - - for portageOutput in io.TextIOWrapper(portageExec.stdout, encoding="utf-8"): if "ebuild" in portageOutput.rstrip(): sourceDep = str(portageOutput.rstrip().split("]")[1].split("[")[0].strip("\ ")) sourceDeps.append(sourceDep) - return sourceDeps + return binaryDeps,sourceDeps def fetchRemoteDatabase(): remotePkgsURL = getRemotePkgsURL() @@ -222,8 +210,7 @@ def startInstall(pkgList): syncAll() binhostURL = getBinhostURL() - binaryDeps = getPkgBinaryDeps(pkgList) - sourceDeps = getPkgSourceDeps(pkgList) + binaryDeps,sourceDeps = getPackageDeps(pkgList) binaryPkgs = [] if len(sourceDeps) == 0: @@ -268,8 +255,7 @@ def startHybridInstall(pkgList): syncAll() binhostURL = getBinhostURL() - binaryDeps = getPkgBinaryDeps(pkgList) - sourceDeps = getPkgSourceDeps(pkgList) + binaryDeps,sourceDeps = getPackageDeps(pkgList) binaryPkgs = [] if len(sourceDeps) == 0: @@ -354,8 +340,7 @@ def startUpgrade(): syncAll() binhostURL = getBinhostURL() - binaryDeps = getWorldBinaryDeps() - sourceDeps = getWorldSourceDeps() + binaryDeps,sourceDeps = getWorldDeps() binaryPkgs = [] if len(sourceDeps) == 0: @@ -400,8 +385,7 @@ def startHybridUpgrade(): syncAll() binhostURL = getBinhostURL() - binaryDeps = getWorldBinaryDeps() - sourceDeps = getWorldSourceDeps() + binaryDeps,sourceDeps = getWorldDeps() binaryPkgs = [] if len(sourceDeps) == 0: diff --git a/src/frontend/gui/sisyphus-gui.py b/src/frontend/gui/sisyphus-gui.py index 29f3ee6..f69a164 100644 --- a/src/frontend/gui/sisyphus-gui.py +++ b/src/frontend/gui/sisyphus-gui.py @@ -366,7 +366,7 @@ class MainWorker(QtCore.QObject): pkgList = Sisyphus.pkgList binhostURL = getBinhostURL() - binaryDeps = getPkgBinaryDeps(pkgList) + binaryDeps,sourceDeps = getPackageDeps(pkgList) binaryPkgs = [] os.chdir(portageCache) @@ -427,7 +427,7 @@ class MainWorker(QtCore.QObject): self.started.emit() binhostURL = getBinhostURL() - binaryDeps = getWorldBinaryDeps() + binaryDeps,sourceDeps = getWorldDeps() binaryPkgs = [] os.chdir(portageCache) -- cgit v1.2.3