From 5ff1132d254dd6e527c0544bdfd8709cc6351637 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Thu, 13 Jun 2019 19:29:08 +0100 Subject: make hybrid options default, this way one can install whatever he wants from the get go --- src/backend/libsisyphus.py | 112 +-------------------------------------- src/frontend/cli/sisyphus-cli.py | 12 ----- 2 files changed, 1 insertion(+), 123 deletions(-) diff --git a/src/backend/libsisyphus.py b/src/backend/libsisyphus.py index 5bf7b8f..4b73f69 100644 --- a/src/backend/libsisyphus.py +++ b/src/backend/libsisyphus.py @@ -216,63 +216,10 @@ def rescueDB(): syncLocalDatabase() def startSearch(pkgList): - subprocess.check_call(['emerge', '--search', '--getbinpkgonly'] + pkgList) - -def startHybridSearch(pkgList): subprocess.check_call(['emerge', '--search', '--getbinpkg'] + pkgList) -def startInstall(pkgList): - startUpdate() - - binhostURL = getBinhostURL() - areBinaries,areSources,needsConfig = getPackageDeps(pkgList) - binaryPkgs = [] - - if len(areSources) == 0: - if not len(areBinaries) == 0: - os.chdir(portageCacheDir) - print("\n" + "These are the binary packages that would be merged, in order:" + "\n\n" + str(areBinaries) + "\n\n" + "Total:" + " " + str(len(areBinaries)) + " " + "binary package(s)" + "\n") - if input("Would you like to proceed?" + " " + "[y/N]" + " ").lower().strip()[:1] == "y": - for index, url in enumerate([binhostURL + package + '.tbz2' for package in areBinaries]): - print(">>> Fetching" + " " + url) - wget.download(url) - print("\n") - - for index, binpkg in enumerate(areBinaries): - binaryPkg = str(binpkg.rstrip().split("/")[1]) - binaryPkgs.append(binaryPkg) - - 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.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')))) - 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')))) - - if os.path.exists(str(binpkg + '.tbz2')): - os.remove(str(binpkg + '.tbz2')) - - portageExec = subprocess.Popen(['emerge', '--usepkg', '--usepkgonly', '--rebuilt-binaries', '--misspell-suggestion=n', '--fuzzy-search=n'] + pkgList, stdout=subprocess.PIPE) - - for portageOutput in io.TextIOWrapper(portageExec.stdout, encoding="utf-8"): - if not "These are the packages that would be merged, in order:" in portageOutput.rstrip(): - if not "Calculating dependencies" in portageOutput.rstrip(): - print(portageOutput.rstrip()) - - portageExec.wait() - syncLocalDatabase() - else: - sys.exit("\n" + "Ok; Quitting." + "\n") - else: - sys.exit("\n" + "No package found; Quitting." + "\n") - else: - sys.exit("\n" + "No binary package found; Source package found; Use sisyphus --hybrid-install; Quitting." + "\n") -def startHybridInstall(pkgList): +def startInstall(pkgList): startUpdate() binhostURL = getBinhostURL() @@ -394,57 +341,6 @@ def startUpgrade(): areBinaries,areSources,needsConfig = getWorldDeps() binaryPkgs = [] - if len(areSources) == 0: - if not len(areBinaries) == 0: - os.chdir(portageCacheDir) - print("\n" + "These are the binary packages that would be merged, in order:" + "\n\n" + str(areBinaries) + "\n\n" + "Total:" + " " + str(len(areBinaries)) + " " + "binary package(s)" + "\n") - if input("Would you like to proceed?" + " " + "[y/N]" + " ").lower().strip()[:1] == "y": - for index, url in enumerate([binhostURL + package + '.tbz2' for package in areBinaries]): - print(">>> Fetching" + " " + url) - wget.download(url) - print("\n") - - for index, binpkg in enumerate(areBinaries): - binaryPkg = str(binpkg.rstrip().split("/")[1]) - binaryPkgs.append(binaryPkg) - - 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.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')))) - 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')))) - - if os.path.exists(str(binpkg + '.tbz2')): - os.remove(str(binpkg + '.tbz2')) - - 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) - - for portageOutput in io.TextIOWrapper(portageExec.stdout, encoding="utf-8"): - if not "These are the packages that would be merged, in order:" in portageOutput.rstrip(): - if not "Calculating dependencies" in portageOutput.rstrip(): - print(portageOutput.rstrip()) - - portageExec.wait() - syncLocalDatabase() - else: - sys.exit("\n" + "Ok; Quitting." + "\n") - else: - sys.exit("\n" + "No package upgrades found; Quitting." + "\n") - else: - sys.exit("\n" + "No binary package upgrades found; Source package upgrades found; Use sisyphus --hybrid-upgrade; Quitting." + "\n") - -def startHybridUpgrade(): - startUpdate() - - binhostURL = getBinhostURL() - areBinaries,areSources,needsConfig = getWorldDeps() - binaryPkgs = [] - if needsConfig == 0: if len(areSources) == 0: if not len(areBinaries) == 0: @@ -624,8 +520,6 @@ def showHelp(): print("Debian/RedHat-based systems to Gentoo." + "\n") print("Commands :" + "\n") print("--install") - print("* Install binary packages" + "\n") - print("--hybrid-install") print("* Install binary and/or ebuild (source) packages" + "\n") print("--uninstall") print("* Uninstall packages *SAFELY* by checking for reverse dependencies") @@ -645,12 +539,8 @@ def showHelp(): print("--update") print("* Update the Portage tree, Overlay(s), Portage config files && Sisyphus's package database" + "\n") print("--upgrade") - print("* Upgrade the system using binary packages" + "\n") - print("--hybrid-upgrade") print("* Upgrade the system using binary and/or ebuild (source) packages" + "\n") print("--search") - print("* Search for binary packages" + "\n") - print("--hybrid-search") print("* Search for binary and/or ebuild (source) packages" + "\n") print("--spmsync") print("* Sync Sisyphus's package database with Portage's package database") diff --git a/src/frontend/cli/sisyphus-cli.py b/src/frontend/cli/sisyphus-cli.py index b1636db..5ec0504 100755 --- a/src/frontend/cli/sisyphus-cli.py +++ b/src/frontend/cli/sisyphus-cli.py @@ -12,11 +12,6 @@ if "__main__" == __name__: sys.exit("\n" + "Nothing to install, please provide at least one package name; quitting" + "\n") else: startInstall(pkgList) - elif "--hybrid-install" in sys.argv[1:]: - if not pkgList: - sys.exit("\n" + "Nothing to install, please provide at least one package name; quitting" + "\n") - else: - startHybridInstall(pkgList) elif "--uninstall" in sys.argv[1:]: if not pkgList: sys.exit("\n" + "Nothing to uninstall, please provide at least one package name; quitting" + "\n") @@ -33,18 +28,11 @@ if "__main__" == __name__: startUpdate() elif "--upgrade" in sys.argv[1:]: startUpgrade() - elif "--hybrid-upgrade" in sys.argv[1:]: - startHybridUpgrade() elif "--search" in sys.argv[1:]: if not pkgList: sys.exit("\n" + "Nothing to search, please provide at least one package name; quitting" + "\n") else: startSearch(pkgList) - elif "--hybrid-search" in sys.argv[1:]: - if not pkgList: - sys.exit("\n" + "Nothing to search, please provide at least one package name; quitting" + "\n") - else: - startHybridSearch(pkgList) elif "--spmsync" in sys.argv[1:]: startSyncSPM() elif "--rescue" in sys.argv[1:]: -- cgit v1.2.3