diff options
author | V3n3RiX <venerix@redcorelinux.org> | 2018-11-20 16:43:00 +0000 |
---|---|---|
committer | V3n3RiX <venerix@redcorelinux.org> | 2018-11-20 16:43:00 +0000 |
commit | d7cd57ef0934be4830fe1518ed35841550398f7e (patch) | |
tree | 48486b0c9d7c608641a2e26d865276b2bd291a14 | |
parent | 79e76651af803fd682004778b2b3d4cb37a08a8e (diff) |
libsisyphus : make use of tuples to get all dependency (binary,source) information in one go, thus improving dependency resolution time by 100%
-rw-r--r-- | src/backend/libsisyphus.py | 40 | ||||
-rw-r--r-- | 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) |