From c76a29a71d16e9ed512a22945d6e6b77b0d21fb6 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Tue, 9 Jun 2020 20:45:02 +0100 Subject: sisyphus-cli : plug more functions : install, uninstall, forceuninstall, update, upgrade, rescue, spmsync, autoremove - all work --- src/backend/__init__.py | 2 +- src/backend/autoremove.py | 11 +++++++++++ src/backend/install.py | 12 ++++++------ src/backend/removeorphans.py | 11 ----------- src/backend/solvedeps.py | 4 ++-- src/backend/spmsync.py | 2 ++ src/backend/uninstall.py | 4 ++-- src/backend/uninstallforce.py | 4 ++-- 8 files changed, 26 insertions(+), 24 deletions(-) create mode 100644 src/backend/autoremove.py delete mode 100644 src/backend/removeorphans.py (limited to 'src/backend') diff --git a/src/backend/__init__.py b/src/backend/__init__.py index 3afa878..5a1e703 100644 --- a/src/backend/__init__.py +++ b/src/backend/__init__.py @@ -1,3 +1,4 @@ +from .autoremove import * from .binhost import * from .branchinject import * from .branchmaster import * @@ -13,7 +14,6 @@ from .install import * from .killportage import * from .metadata import * from .mirror import * -from .removeorphans import * from .rescue import * from .search import * from .setjobs import * diff --git a/src/backend/autoremove.py b/src/backend/autoremove.py new file mode 100644 index 0000000..a0b4f30 --- /dev/null +++ b/src/backend/autoremove.py @@ -0,0 +1,11 @@ +#!/usr/bin/python3 + +import subprocess +import sisyphus.check +import sisyphus.sync + +def start(): + sisyphus.check.root() + portageExec = subprocess.Popen(['emerge', '--quiet', '--depclean', '--ask']) + portageExec.wait() + sisyphus.database.syncLocal() diff --git a/src/backend/install.py b/src/backend/install.py index cb13849..36704f3 100644 --- a/src/backend/install.py +++ b/src/backend/install.py @@ -12,11 +12,11 @@ import sisyphus.filesystem import sisyphus.solvedeps import sisyphus.update -def start(pkgList): +def start(pkgname): sisyphus.update.start() binhostURL = sisyphus.binhost.getURL() - areBinaries,areSources,needsConfig = sisyphus.solvedeps.package(pkgList) + areBinaries,areSources,needsConfig = sisyphus.solvedeps.package(pkgname) if needsConfig == 0: if len(areSources) == 0: @@ -44,7 +44,7 @@ def start(pkgList): 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) + 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(): @@ -83,7 +83,7 @@ def start(pkgList): 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'] + pkgList, stdout=subprocess.PIPE) + 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(): @@ -97,7 +97,7 @@ def start(pkgList): 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'] + pkgList, stdout=subprocess.PIPE) + 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(): @@ -109,7 +109,7 @@ def start(pkgList): else: sys.exit("\n" + "Ok; Quitting." + "\n") else: - portageExec = subprocess.Popen(['emerge', '--quiet', '--pretend', '--getbinpkg', '--rebuilt-binaries', '--misspell-suggestion=n', '--fuzzy-search=n'] + pkgList, stdout=subprocess.PIPE) + 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(): diff --git a/src/backend/removeorphans.py b/src/backend/removeorphans.py deleted file mode 100644 index a0b4f30..0000000 --- a/src/backend/removeorphans.py +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/python3 - -import subprocess -import sisyphus.check -import sisyphus.sync - -def start(): - sisyphus.check.root() - portageExec = subprocess.Popen(['emerge', '--quiet', '--depclean', '--ask']) - portageExec.wait() - sisyphus.database.syncLocal() diff --git a/src/backend/solvedeps.py b/src/backend/solvedeps.py index 256d588..074baf8 100644 --- a/src/backend/solvedeps.py +++ b/src/backend/solvedeps.py @@ -5,11 +5,11 @@ import subprocess import io @animation.wait('resolving dependencies') -def package(pkgList): +def package(pkgname): areBinaries = [] areSources = [] needsConfig = int() - portageExec = subprocess.Popen(['emerge', '--quiet', '--pretend', '--getbinpkg', '--rebuilt-binaries', '--misspell-suggestion=n', '--fuzzy-search=n'] + pkgList, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + portageExec = subprocess.Popen(['emerge', '--quiet', '--pretend', '--getbinpkg', '--rebuilt-binaries', '--misspell-suggestion=n', '--fuzzy-search=n'] + list(pkgname), stdout=subprocess.PIPE, stderr=subprocess.PIPE) for portageOutput in io.TextIOWrapper(portageExec.stderr, encoding="utf-8"): if "The following keyword changes are necessary to proceed:" in portageOutput.rstrip(): diff --git a/src/backend/spmsync.py b/src/backend/spmsync.py index 83f3089..2c388f1 100644 --- a/src/backend/spmsync.py +++ b/src/backend/spmsync.py @@ -1,6 +1,8 @@ #!/usr/bin/python3 +import animation import sisyphus.database +@animation.wait('syncing spm changes') def start(): sisyphus.database.syncLocal() diff --git a/src/backend/uninstall.py b/src/backend/uninstall.py index 8dc9e34..1ceb0ba 100644 --- a/src/backend/uninstall.py +++ b/src/backend/uninstall.py @@ -4,8 +4,8 @@ import subprocess import sisyphus.check import sisyphus.sync -def start(pkgList): +def start(pkgname): sisyphus.check.root() - portageExec = subprocess.Popen(['emerge', '--quiet', '--depclean', '--ask'] + pkgList) + portageExec = subprocess.Popen(['emerge', '--quiet', '--depclean', '--ask'] + list(pkgname)) portageExec.wait() sisyphus.database.syncLocal() diff --git a/src/backend/uninstallforce.py b/src/backend/uninstallforce.py index e3f4144..90de980 100644 --- a/src/backend/uninstallforce.py +++ b/src/backend/uninstallforce.py @@ -4,8 +4,8 @@ import subprocess import sisyphus.check import sisyphus.sync -def start(pkgList): +def start(pkgname): sisyphus.check.root() - portageExec = subprocess.Popen(['emerge', '--quiet', '--unmerge', '--ask'] + pkgList) + portageExec = subprocess.Popen(['emerge', '--quiet', '--unmerge', '--ask'] + list(pkgname)) portageExec.wait() sisyphus.database.syncLocal() -- cgit v1.2.3