From d49c1756c0f509430cb03d1a4c2cf9c908487929 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Fri, 5 Jul 2019 01:49:38 +0100 Subject: bugfix : fix extraction error when two (or more) binary packages have the exact same name but they aZre in different categories (e.g.: acct-group/mail-0.tbz2 && acct-user/mail-0.tbz2) --- src/frontend/gui/sisyphus-gui.py | 52 +++++++++++++++++----------------------- 1 file changed, 22 insertions(+), 30 deletions(-) (limited to 'src/frontend') diff --git a/src/frontend/gui/sisyphus-gui.py b/src/frontend/gui/sisyphus-gui.py index b391414..1e4d409 100644 --- a/src/frontend/gui/sisyphus-gui.py +++ b/src/frontend/gui/sisyphus-gui.py @@ -390,32 +390,28 @@ class MainWorker(QtCore.QObject): binhostURL = getBinhostURL() areBinaries,areSources,needsConfig = getPackageDeps.__wrapped__(pkgList) #undecorate - binaryPkgs = [] os.chdir(portageCacheDir) self.workerOutput.emit("\n" + "These are the binary packages that will be merged, in order:" + "\n\n" + str(areBinaries) + "\n\n" + "Total:" + " " + str(len(areBinaries)) + " " + "binary package(s)" + "\n\n") - for index, url in enumerate([binhostURL + package + '.tbz2' for package in areBinaries]): - self.workerOutput.emit(">>> Fetching" + " " + url) - wget.download(url) + for index, binary in enumerate([package + '.tbz2' for package in areBinaries]): + self.workerOutput.emit(">>> Fetching" + " " + binhostURL + binary) + wget.download(binhostURL + binary) self.workerOutput.emit("\n") - for index, binpkg in enumerate(areBinaries): - binaryPkg = str(binpkg.rstrip().split("/")[1]) - binaryPkgs.append(binaryPkg) + subprocess.call(['qtbz2', '-x'] + binary.rstrip().split("/")[1].split()) + CATEGORY = subprocess.check_output(['qxpak', '-x', '-O'] + binary.rstrip().split("/")[1].replace('tbz2', 'xpak').split() + ['CATEGORY']) - for index, binpkg in enumerate(binaryPkgs): - subprocess.call(['qtbz2', '-x'] + str(binpkg + '.tbz2').split()) - CATEGORY = subprocess.check_output(['qxpak', '-x', '-O'] + str(binpkg + '.xpak').split() + ['CATEGORY']) - os.remove(str(binpkg + '.xpak')) + if os.path.exists(binary.rstrip().split("/")[1].replace('tbz2', 'xpak')): + os.remove(binary.rstrip().split("/")[1].replace('tbz2', 'xpak')) if os.path.isdir(os.path.join(portageCacheDir, CATEGORY.decode().strip())): - shutil.move(str(binpkg + '.tbz2'), os.path.join(os.path.join(portageCacheDir, CATEGORY.decode().strip()), os.path.basename(str(binpkg + '.tbz2')))) + shutil.move(binary.rstrip().split("/")[1], os.path.join(os.path.join(portageCacheDir, CATEGORY.decode().strip()), os.path.basename(binary.rstrip().split("/")[1]))) else: os.makedirs(os.path.join(portageCacheDir, CATEGORY.decode().strip())) - shutil.move(str(binpkg + '.tbz2'), os.path.join(os.path.join(portageCacheDir, CATEGORY.decode().strip()), os.path.basename(str(binpkg + '.tbz2')))) + shutil.move(binary.rstrip().split("/")[1], os.path.join(os.path.join(portageCacheDir, CATEGORY.decode().strip()), os.path.basename(binary.rstrip().split("/")[1]))) - if os.path.exists(str(binpkg + '.tbz2')): - os.remove(str(binpkg + '.tbz2')) + if os.path.exists(binary.rstrip().split("/")[1]): + os.remove(binary.rstrip().split("/")[1]) portageExec = subprocess.Popen(['emerge', '--usepkg', '--usepkgonly', '--rebuilt-binaries', '--misspell-suggestion=n', '--fuzzy-search=n'] + pkgList, stdout=subprocess.PIPE) @@ -451,7 +447,6 @@ class MainWorker(QtCore.QObject): binhostURL = getBinhostURL() areBinaries,areSources,needsConfig = getWorldDeps.__wrapped__() #undecorate - binaryPkgs = [] if not len(areSources) == 0: self.workerOutput.emit("\n" + "Source package upgrades detected; Use sisyphus CLI to perform the upgrade; Aborting." + "\n") @@ -459,28 +454,25 @@ class MainWorker(QtCore.QObject): if not len(areBinaries) == 0: self.workerOutput.emit("\n" + "These are the binary packages that will be merged, in order:" + "\n\n" + str(areBinaries) + "\n\n" + "Total:" + " " + str(len(areBinaries)) + " " + "binary package(s)" + "\n\n") os.chdir(portageCacheDir) - for index, url in enumerate([binhostURL + package + '.tbz2' for package in areBinaries]): - self.workerOutput.emit(">>> Fetching" + " " + url) - wget.download(url) + for index, binary in enumerate([package + '.tbz2' for package in areBinaries]): + self.workerOutput.emit(">>> Fetching" + " " + binhostURL + binary) + wget.download(binhostURL + binary) self.workerOutput.emit("\n") - for index, binpkg in enumerate(areBinaries): - binaryPkg = str(binpkg.rstrip().split("/")[1]) - binaryPkgs.append(binaryPkg) + subprocess.call(['qtbz2', '-x'] + binary.rstrip().split("/")[1].split()) + CATEGORY = subprocess.check_output(['qxpak', '-x', '-O'] + binary.rstrip().split("/")[1].replace('tbz2', 'xpak').split() + ['CATEGORY']) - for index, binpkg in enumerate(binaryPkgs): - subprocess.call(['qtbz2', '-x'] + str(binpkg + '.tbz2').split()) - CATEGORY = subprocess.check_output(['qxpak', '-x', '-O'] + str(binpkg + '.xpak').split() + ['CATEGORY']) - os.remove(str(binpkg + '.xpak')) + if os.path.exists(binary.rstrip().split("/")[1].replace('tbz2', 'xpak')): + os.remove(binary.rstrip().split("/")[1].replace('tbz2', 'xpak')) if os.path.isdir(os.path.join(portageCacheDir, CATEGORY.decode().strip())): - shutil.move(str(binpkg + '.tbz2'), os.path.join(os.path.join(portageCacheDir, CATEGORY.decode().strip()), os.path.basename(str(binpkg + '.tbz2')))) + shutil.move(binary.rstrip().split("/")[1], os.path.join(os.path.join(portageCacheDir, CATEGORY.decode().strip()), os.path.basename(binary.rstrip().split("/")[1]))) else: os.makedirs(os.path.join(portageCacheDir, CATEGORY.decode().strip())) - shutil.move(str(binpkg + '.tbz2'), os.path.join(os.path.join(portageCacheDir, CATEGORY.decode().strip()), os.path.basename(str(binpkg + '.tbz2')))) + shutil.move(binary.rstrip().split("/")[1], os.path.join(os.path.join(portageCacheDir, CATEGORY.decode().strip()), os.path.basename(binary.rstrip().split("/")[1]))) - if os.path.exists(str(binpkg + '.tbz2')): - os.remove(str(binpkg + '.tbz2')) + if os.path.exists(binary.rstrip().split("/")[1]): + os.remove(binary.rstrip().split("/")[1]) portageExec = subprocess.Popen(['emerge', '--update', '--deep', '--newuse', '--usepkg', '--usepkgonly', '--rebuilt-binaries', '--backtrack=100', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n', '@world'], stdout=subprocess.PIPE) -- cgit v1.2.3