From 38d5b810cb5e8400919e1d72c7d3806ee1156a23 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sat, 20 Jun 2020 10:55:55 +0100 Subject: backend : adjust to changed options --- src/backend/__init__.py | 4 +- src/backend/installebuild.py | 121 ++++++++++++++++++++++++++++++++++++++ src/backend/installhybrid.py | 121 -------------------------------------- src/backend/upgradeebuild.py | 122 +++++++++++++++++++++++++++++++++++++++ src/backend/upgradehybrid.py | 122 --------------------------------------- src/frontend/cli/sisyphus-cli.py | 11 ++-- 6 files changed, 249 insertions(+), 252 deletions(-) create mode 100644 src/backend/installebuild.py delete mode 100644 src/backend/installhybrid.py create mode 100644 src/backend/upgradeebuild.py delete mode 100644 src/backend/upgradehybrid.py diff --git a/src/backend/__init__.py b/src/backend/__init__.py index ec1e6b0..493819a 100644 --- a/src/backend/__init__.py +++ b/src/backend/__init__.py @@ -9,7 +9,7 @@ from .database import * from .filesystem import * from .help import * from .install import * -from .installhybrid import * +from .installebuild import * from .killportage import * from .metadata import * from .mirror import * @@ -25,4 +25,4 @@ from .uninstallforce import * from .uninstall import * from .update import * from .upgrade import * -from .upgradehybrid import * +from .upgradeebuild import * diff --git a/src/backend/installebuild.py b/src/backend/installebuild.py new file mode 100644 index 0000000..36704f3 --- /dev/null +++ b/src/backend/installebuild.py @@ -0,0 +1,121 @@ +#!/usr/bin/python3 + +import os +import shutil +import subprocess +import sys +import io +import wget +import sisyphus.binhost +import sisyphus.database +import sisyphus.filesystem +import sisyphus.solvedeps +import sisyphus.update + +def start(pkgname): + sisyphus.update.start() + + binhostURL = sisyphus.binhost.getURL() + areBinaries,areSources,needsConfig = sisyphus.solvedeps.package(pkgname) + + if needsConfig == 0: + if len(areSources) == 0: + if not len(areBinaries) == 0: + os.chdir(sisyphus.filesystem.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, binary in enumerate([package + '.tbz2' for package in areBinaries]): + print(">>> Fetching" + " " + binhostURL + binary) + wget.download(binhostURL + binary) + print("\n") + + 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']) + + 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(sisyphus.filesystem.portageCacheDir, CATEGORY.decode().strip())): + shutil.move(binary.rstrip().split("/")[1], os.path.join(os.path.join(sisyphus.filesystem.portageCacheDir, CATEGORY.decode().strip()), os.path.basename(binary.rstrip().split("/")[1]))) + else: + os.makedirs(os.path.join(sisyphus.filesystem.portageCacheDir, CATEGORY.decode().strip())) + shutil.move(binary.rstrip().split("/")[1], os.path.join(os.path.join(sisyphus.filesystem.portageCacheDir, CATEGORY.decode().strip()), os.path.basename(binary.rstrip().split("/")[1]))) + + 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'] + list(pkgname), 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() + sisyphus.database.syncLocal() + else: + sys.exit("\n" + "Ok; Quitting." + "\n") + else: + sys.exit("\n" + "No package found; Quitting." + "\n") + else: + if not len(areBinaries) == 0: + os.chdir(sisyphus.filesystem.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") + print("\n" + "These are the source packages that would be merged, in order:" + "\n\n" + str(areSources) + "\n\n" + "Total:" + " " + str(len(areSources)) + " " + "source package(s)" + "\n") + if input("Would you like to proceed?" + " " + "[y/N]" + " ").lower().strip()[:1] == "y": + for index, binary in enumerate([package + '.tbz2' for package in areBinaries]): + print(">>> Fetching" + " " + binhostURL + binary) + wget.download(binhostURL + binary) + print("\n") + + 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']) + + 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(sisyphus.filesystem.portageCacheDir, CATEGORY.decode().strip())): + shutil.move(binary.rstrip().split("/")[1], os.path.join(os.path.join(sisyphus.filesystem.portageCacheDir, CATEGORY.decode().strip()), os.path.basename(binary.rstrip().split("/")[1]))) + else: + os.makedirs(os.path.join(sisyphus.filesystem.portageCacheDir, CATEGORY.decode().strip())) + shutil.move(binary.rstrip().split("/")[1], os.path.join(os.path.join(sisyphus.filesystem.portageCacheDir, CATEGORY.decode().strip()), os.path.basename(binary.rstrip().split("/")[1]))) + + if os.path.exists(binary.rstrip().split("/")[1]): + os.remove(binary.rstrip().split("/")[1]) + + portageExec = subprocess.Popen(['emerge', '--usepkg', '--rebuilt-binaries', '--misspell-suggestion=n', '--fuzzy-search=n'] + list(pkgname), 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() + sisyphus.database.syncLocal() + else: + sys.exit("\n" + "Ok; Quitting." + "\n") + else: + print("\n" + "These are the source packages that would be merged, in order:" + "\n\n" + str(areSources) + "\n\n" + "Total:" + " " + str(len(areSources)) + " " + "source package(s)" + "\n") + if input("Would you like to proceed?" + " " + "[y/N]" + " ").lower().strip()[:1] == "y": + portageExec = subprocess.Popen(['emerge', '--misspell-suggestion=n', '--fuzzy-search=n'] + list(pkgname), 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() + sisyphus.database.syncLocal() + else: + sys.exit("\n" + "Ok; Quitting." + "\n") + else: + portageExec = subprocess.Popen(['emerge', '--quiet', '--pretend', '--getbinpkg', '--rebuilt-binaries', '--misspell-suggestion=n', '--fuzzy-search=n'] + list(pkgname), stdout=subprocess.PIPE) + + for portageOutput in io.TextIOWrapper(portageExec.stdout, encoding="utf-8"): + if not "Local copy of remote index is up-to-date and will be used." in portageOutput.rstrip(): + if not "ebuild" in portageOutput.rstrip(): + if not "binary" in portageOutput.rstrip(): + print(portageOutput.rstrip()) + + portageExec.wait() + sys.exit("\n" + "Cannot proceed; Apply the above changes to your portage configuration files and try again; Quitting." + "\n") diff --git a/src/backend/installhybrid.py b/src/backend/installhybrid.py deleted file mode 100644 index 36704f3..0000000 --- a/src/backend/installhybrid.py +++ /dev/null @@ -1,121 +0,0 @@ -#!/usr/bin/python3 - -import os -import shutil -import subprocess -import sys -import io -import wget -import sisyphus.binhost -import sisyphus.database -import sisyphus.filesystem -import sisyphus.solvedeps -import sisyphus.update - -def start(pkgname): - sisyphus.update.start() - - binhostURL = sisyphus.binhost.getURL() - areBinaries,areSources,needsConfig = sisyphus.solvedeps.package(pkgname) - - if needsConfig == 0: - if len(areSources) == 0: - if not len(areBinaries) == 0: - os.chdir(sisyphus.filesystem.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, binary in enumerate([package + '.tbz2' for package in areBinaries]): - print(">>> Fetching" + " " + binhostURL + binary) - wget.download(binhostURL + binary) - print("\n") - - 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']) - - 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(sisyphus.filesystem.portageCacheDir, CATEGORY.decode().strip())): - shutil.move(binary.rstrip().split("/")[1], os.path.join(os.path.join(sisyphus.filesystem.portageCacheDir, CATEGORY.decode().strip()), os.path.basename(binary.rstrip().split("/")[1]))) - else: - os.makedirs(os.path.join(sisyphus.filesystem.portageCacheDir, CATEGORY.decode().strip())) - shutil.move(binary.rstrip().split("/")[1], os.path.join(os.path.join(sisyphus.filesystem.portageCacheDir, CATEGORY.decode().strip()), os.path.basename(binary.rstrip().split("/")[1]))) - - 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'] + list(pkgname), 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() - sisyphus.database.syncLocal() - else: - sys.exit("\n" + "Ok; Quitting." + "\n") - else: - sys.exit("\n" + "No package found; Quitting." + "\n") - else: - if not len(areBinaries) == 0: - os.chdir(sisyphus.filesystem.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") - print("\n" + "These are the source packages that would be merged, in order:" + "\n\n" + str(areSources) + "\n\n" + "Total:" + " " + str(len(areSources)) + " " + "source package(s)" + "\n") - if input("Would you like to proceed?" + " " + "[y/N]" + " ").lower().strip()[:1] == "y": - for index, binary in enumerate([package + '.tbz2' for package in areBinaries]): - print(">>> Fetching" + " " + binhostURL + binary) - wget.download(binhostURL + binary) - print("\n") - - 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']) - - 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(sisyphus.filesystem.portageCacheDir, CATEGORY.decode().strip())): - shutil.move(binary.rstrip().split("/")[1], os.path.join(os.path.join(sisyphus.filesystem.portageCacheDir, CATEGORY.decode().strip()), os.path.basename(binary.rstrip().split("/")[1]))) - else: - os.makedirs(os.path.join(sisyphus.filesystem.portageCacheDir, CATEGORY.decode().strip())) - shutil.move(binary.rstrip().split("/")[1], os.path.join(os.path.join(sisyphus.filesystem.portageCacheDir, CATEGORY.decode().strip()), os.path.basename(binary.rstrip().split("/")[1]))) - - if os.path.exists(binary.rstrip().split("/")[1]): - os.remove(binary.rstrip().split("/")[1]) - - portageExec = subprocess.Popen(['emerge', '--usepkg', '--rebuilt-binaries', '--misspell-suggestion=n', '--fuzzy-search=n'] + list(pkgname), 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() - sisyphus.database.syncLocal() - else: - sys.exit("\n" + "Ok; Quitting." + "\n") - else: - print("\n" + "These are the source packages that would be merged, in order:" + "\n\n" + str(areSources) + "\n\n" + "Total:" + " " + str(len(areSources)) + " " + "source package(s)" + "\n") - if input("Would you like to proceed?" + " " + "[y/N]" + " ").lower().strip()[:1] == "y": - portageExec = subprocess.Popen(['emerge', '--misspell-suggestion=n', '--fuzzy-search=n'] + list(pkgname), 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() - sisyphus.database.syncLocal() - else: - sys.exit("\n" + "Ok; Quitting." + "\n") - else: - portageExec = subprocess.Popen(['emerge', '--quiet', '--pretend', '--getbinpkg', '--rebuilt-binaries', '--misspell-suggestion=n', '--fuzzy-search=n'] + list(pkgname), stdout=subprocess.PIPE) - - for portageOutput in io.TextIOWrapper(portageExec.stdout, encoding="utf-8"): - if not "Local copy of remote index is up-to-date and will be used." in portageOutput.rstrip(): - if not "ebuild" in portageOutput.rstrip(): - if not "binary" in portageOutput.rstrip(): - print(portageOutput.rstrip()) - - portageExec.wait() - sys.exit("\n" + "Cannot proceed; Apply the above changes to your portage configuration files and try again; Quitting." + "\n") diff --git a/src/backend/upgradeebuild.py b/src/backend/upgradeebuild.py new file mode 100644 index 0000000..d2961d6 --- /dev/null +++ b/src/backend/upgradeebuild.py @@ -0,0 +1,122 @@ +#!/usr/bin/python3 + +import os +import shutil +import subprocess +import sys +import io +import wget +import sisyphus.binhost +import sisyphus.database +import sisyphus.filesystem +import sisyphus.solvedeps +import sisyphus.update + +def start(): + sisyphus.update.start() + + binhostURL = sisyphus.binhost.getURL() + areBinaries,areSources,needsConfig = sisyphus.solvedeps.world() + + if needsConfig == 0: + if len(areSources) == 0: + if not len(areBinaries) == 0: + os.chdir(sisyphus.filesystem.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, binary in enumerate([package + '.tbz2' for package in areBinaries]): + print(">>> Fetching" + " " + binhostURL + binary) + wget.download(binhostURL + binary) + print("\n") + + 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']) + + 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(sisyphus.filesystem.portageCacheDir, CATEGORY.decode().strip())): + shutil.move(binary.rstrip().split("/")[1], os.path.join(os.path.join(sisyphus.filesystem.portageCacheDir, CATEGORY.decode().strip()), os.path.basename(binary.rstrip().split("/")[1]))) + else: + os.makedirs(os.path.join(sisyphus.filesystem.portageCacheDir, CATEGORY.decode().strip())) + shutil.move(binary.rstrip().split("/")[1], os.path.join(os.path.join(sisyphus.filesystem.portageCacheDir, CATEGORY.decode().strip()), os.path.basename(binary.rstrip().split("/")[1]))) + + 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) + + 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() + sisyphus.database.syncLocal() + else: + sys.exit("\n" + "Ok; Quitting." + "\n") + else: + sys.exit("\n" + "No package upgrades found; Quitting." + "\n") + else: + if not len(areBinaries) == 0: + os.chdir(sisyphus.filesystem.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") + print("\n" + "These are the source packages that would be merged, in order:" + "\n\n" + str(areSources) + "\n\n" + "Total:" + " " + str(len(areSources)) + " " + "source package(s)" + "\n") + if input("Would you like to proceed?" + " " + "[y/N]" + " ").lower().strip()[:1] == "y": + for index, binary in enumerate([package + '.tbz2' for package in areBinaries]): + print(">>> Fetching" + " " + binhostURL + binary) + wget.download(binhostURL + binary) + print("\n") + + 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']) + + 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(sisyphus.filesystem.portageCacheDir, CATEGORY.decode().strip())): + shutil.move(binary.rstrip().split("/")[1], os.path.join(os.path.join(sisyphus.filesystem.portageCacheDir, CATEGORY.decode().strip()), os.path.basename(binary.rstrip().split("/")[1]))) + else: + os.makedirs(os.path.join(sisyphus.filesystem.portageCacheDir, CATEGORY.decode().strip())) + shutil.move(binary.rstrip().split("/")[1], os.path.join(os.path.join(sisyphus.filesystem.portageCacheDir, CATEGORY.decode().strip()), os.path.basename(binary.rstrip().split("/")[1]))) + + if os.path.exists(binary.rstrip().split("/")[1]): + os.remove(binary.rstrip().split("/")[1]) + + portageExec = subprocess.Popen(['emerge', '--update', '--deep', '--newuse', '--usepkg', '--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() + sisyphus.database.syncLocal() + else: + sys.exit("\n" + "Ok; Quitting." + "\n") + else: + print("\n" + "These are the source packages that would be merged, in order:" + "\n\n" + str(areSources) + "\n\n" + "Total:" + " " + str(len(areSources)) + " " + "source package(s)" + "\n") + if input("Would you like to proceed?" + " " + "[y/N]" + " ").lower().strip()[:1] == "y": + portageExec = subprocess.Popen(['emerge', '--update', '--deep', '--newuse', '--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() + sisyphus.database.syncLocal() + else: + sys.exit("\n" + "Ok; Quitting." + "\n") + else: + 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 not "Local copy of remote index is up-to-date and will be used." in portageOutput.rstrip(): + if not "ebuild" in portageOutput.rstrip(): + if not "binary" in portageOutput.rstrip(): + print(portageOutput.rstrip()) + + portageExec.wait() + sys.exit("\n" + "Cannot proceed; Apply the above changes to your portage configuration files and try again; Quitting." + "\n") + diff --git a/src/backend/upgradehybrid.py b/src/backend/upgradehybrid.py deleted file mode 100644 index d2961d6..0000000 --- a/src/backend/upgradehybrid.py +++ /dev/null @@ -1,122 +0,0 @@ -#!/usr/bin/python3 - -import os -import shutil -import subprocess -import sys -import io -import wget -import sisyphus.binhost -import sisyphus.database -import sisyphus.filesystem -import sisyphus.solvedeps -import sisyphus.update - -def start(): - sisyphus.update.start() - - binhostURL = sisyphus.binhost.getURL() - areBinaries,areSources,needsConfig = sisyphus.solvedeps.world() - - if needsConfig == 0: - if len(areSources) == 0: - if not len(areBinaries) == 0: - os.chdir(sisyphus.filesystem.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, binary in enumerate([package + '.tbz2' for package in areBinaries]): - print(">>> Fetching" + " " + binhostURL + binary) - wget.download(binhostURL + binary) - print("\n") - - 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']) - - 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(sisyphus.filesystem.portageCacheDir, CATEGORY.decode().strip())): - shutil.move(binary.rstrip().split("/")[1], os.path.join(os.path.join(sisyphus.filesystem.portageCacheDir, CATEGORY.decode().strip()), os.path.basename(binary.rstrip().split("/")[1]))) - else: - os.makedirs(os.path.join(sisyphus.filesystem.portageCacheDir, CATEGORY.decode().strip())) - shutil.move(binary.rstrip().split("/")[1], os.path.join(os.path.join(sisyphus.filesystem.portageCacheDir, CATEGORY.decode().strip()), os.path.basename(binary.rstrip().split("/")[1]))) - - 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) - - 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() - sisyphus.database.syncLocal() - else: - sys.exit("\n" + "Ok; Quitting." + "\n") - else: - sys.exit("\n" + "No package upgrades found; Quitting." + "\n") - else: - if not len(areBinaries) == 0: - os.chdir(sisyphus.filesystem.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") - print("\n" + "These are the source packages that would be merged, in order:" + "\n\n" + str(areSources) + "\n\n" + "Total:" + " " + str(len(areSources)) + " " + "source package(s)" + "\n") - if input("Would you like to proceed?" + " " + "[y/N]" + " ").lower().strip()[:1] == "y": - for index, binary in enumerate([package + '.tbz2' for package in areBinaries]): - print(">>> Fetching" + " " + binhostURL + binary) - wget.download(binhostURL + binary) - print("\n") - - 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']) - - 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(sisyphus.filesystem.portageCacheDir, CATEGORY.decode().strip())): - shutil.move(binary.rstrip().split("/")[1], os.path.join(os.path.join(sisyphus.filesystem.portageCacheDir, CATEGORY.decode().strip()), os.path.basename(binary.rstrip().split("/")[1]))) - else: - os.makedirs(os.path.join(sisyphus.filesystem.portageCacheDir, CATEGORY.decode().strip())) - shutil.move(binary.rstrip().split("/")[1], os.path.join(os.path.join(sisyphus.filesystem.portageCacheDir, CATEGORY.decode().strip()), os.path.basename(binary.rstrip().split("/")[1]))) - - if os.path.exists(binary.rstrip().split("/")[1]): - os.remove(binary.rstrip().split("/")[1]) - - portageExec = subprocess.Popen(['emerge', '--update', '--deep', '--newuse', '--usepkg', '--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() - sisyphus.database.syncLocal() - else: - sys.exit("\n" + "Ok; Quitting." + "\n") - else: - print("\n" + "These are the source packages that would be merged, in order:" + "\n\n" + str(areSources) + "\n\n" + "Total:" + " " + str(len(areSources)) + " " + "source package(s)" + "\n") - if input("Would you like to proceed?" + " " + "[y/N]" + " ").lower().strip()[:1] == "y": - portageExec = subprocess.Popen(['emerge', '--update', '--deep', '--newuse', '--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() - sisyphus.database.syncLocal() - else: - sys.exit("\n" + "Ok; Quitting." + "\n") - else: - 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 not "Local copy of remote index is up-to-date and will be used." in portageOutput.rstrip(): - if not "ebuild" in portageOutput.rstrip(): - if not "binary" in portageOutput.rstrip(): - print(portageOutput.rstrip()) - - portageExec.wait() - sys.exit("\n" + "Cannot proceed; Apply the above changes to your portage configuration files and try again; Quitting." + "\n") - diff --git a/src/frontend/cli/sisyphus-cli.py b/src/frontend/cli/sisyphus-cli.py index 7b9e858..74cdb2f 100755 --- a/src/frontend/cli/sisyphus-cli.py +++ b/src/frontend/cli/sisyphus-cli.py @@ -4,7 +4,6 @@ import sisyphus import typer from typing import List from enum import Enum -import sys app = typer.Typer() mirrorSetup = typer.Typer() @@ -19,10 +18,6 @@ def app_callback(ctx: typer.Context): Use 'sisyphus COMMAND --help' for detailed usage. """ ctx.info_name = 'sisyphus' - if not '--help' in sys.argv: - sisyphus.check.update() - sisyphus.setjobs.start.__wrapped__() # undecorate - @app.command("search") def search(pkgname: List[str]): @@ -51,7 +46,7 @@ def install(pkgname: List[str], ebuild: bool = typer.Option(False, "--ebuild", " if not ebuild: sisyphus.install.start(pkgname) else: - sisyphus.installhybrid.start(pkgname) + sisyphus.installebuild.start(pkgname) @app.command("uninstall") def uninstall(pkgname: List[str], force: bool = typer.Option(False, "--force", "-f")): @@ -127,7 +122,7 @@ def upgrade(ebuild: bool = typer.Option(False, "--ebuild", "-e")): if not ebuild: sisyphus.upgrade.start() else: - sisyphus.upgradehybrid.start() + sisyphus.upgradeebuild.start() @app.command("spmsync") def spmsync(): @@ -199,4 +194,6 @@ def mirrorset(index: int): sisyphus.mirror.setActive(index) if __name__ == "__main__": + sisyphus.check.update() + sisyphus.setjobs.start.__wrapped__() # undecorate app() -- cgit v1.2.3