diff options
-rw-r--r-- | src/backend/__init__.py | 2 | ||||
-rw-r--r-- | src/backend/autoremove.py (renamed from src/backend/removeorphans.py) | 0 | ||||
-rw-r--r-- | src/backend/install.py | 12 | ||||
-rw-r--r-- | src/backend/solvedeps.py | 4 | ||||
-rw-r--r-- | src/backend/spmsync.py | 2 | ||||
-rw-r--r-- | src/backend/uninstall.py | 4 | ||||
-rw-r--r-- | src/backend/uninstallforce.py | 4 | ||||
-rwxr-xr-x | src/frontend/cli/sisyphus-cli.py | 40 | ||||
-rw-r--r-- | src/frontend/gui/sisyphus-gui.py | 14 |
9 files changed, 42 insertions, 40 deletions
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/removeorphans.py b/src/backend/autoremove.py index a0b4f30..a0b4f30 100644 --- a/src/backend/removeorphans.py +++ b/src/backend/autoremove.py 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/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() diff --git a/src/frontend/cli/sisyphus-cli.py b/src/frontend/cli/sisyphus-cli.py index 3d7a21f..7488922 100755 --- a/src/frontend/cli/sisyphus-cli.py +++ b/src/frontend/cli/sisyphus-cli.py @@ -23,23 +23,13 @@ def search(pkgname: List[str]): """Search for binary and/or ebuild (source) packages.""" sisyphus.search.start(pkgname) -@app.command("update") -def update(): - """Update the Portage tree, the Redcore Overlay(s), Portage configs and Sisyphus's package database.""" - typer.echo("Updating system ...") - -@app.command("upgrade") -def upgrade(): - """Upgrade the system using binary and/or ebuild (source) packages.""" - typer.echo("Upgrading all packages ...") - @app.command("install") -def install(pkglist: List[str]): +def install(pkgname: List[str]): """Install binary and/or ebuild (source) packages.""" - [typer.echo(f"Installing {pkg}") for pkg in pkglist] + sisyphus.install.start(pkgname) @app.command("uninstall") -def uninstall(pkglist: List[str], force: bool = False): +def uninstall(pkgname: List[str], force: bool = False): """Uninstall packages *SAFELY* by checking for reverse dependencies. If reverse dependencies exist, the package(s) will NOT be uninstalled to prevent the possible breakage of the system. If you really want to uninstall the package, make sure you uninstall all reverse dependencies as well. @@ -51,9 +41,9 @@ def uninstall(pkglist: List[str], force: bool = False): Upgrading the system may pull the packages back in, to fix the reverse dependency chain. """ if not force: - [typer.echo(f"Safely removing {pkg}") for pkg in pkglist] + sisyphus.uninstall.start(pkgname) else: - [typer.echo(f"Force removing {pkg}") for pkg in pkglist] + sisyphus.uninstallforce.start(pkgname) @app.command("autoremove") def autoremove(): @@ -62,7 +52,17 @@ def autoremove(): In addition, a package may no longer depend on another one, so that other package becomes orphan as well if nothing else requires it. Use this option to check the whole dependency chain for such packages, and uninstall them. """ - typer.echo("Performing cleanup ... ") + sisyphus.autoremove.start() + +@app.command("update") +def update(): + """Update the Portage tree, the Redcore Overlay(s), Portage configs and Sisyphus's package database.""" + sisyphus.update.start() + +@app.command("upgrade") +def upgrade(): + """Upgrade the system using binary and/or ebuild (source) packages.""" + sisyphus.upgrade.start() @app.command("spmsync") def spmsync(): @@ -70,7 +70,7 @@ def spmsync(): When you install something with Portage directly (emerge), Sisyphus is not aware of that package, and it doesn't track it in it's database. Use this command to synchronize Sisyphus's package database with Portage's package database. """ - typer.echo("Syncing sisyphus database ...") + sisyphus.spmsync.start() @app.command("rescue") def rescue(): @@ -79,10 +79,10 @@ def rescue(): If Portage's package database is corrupted (in this case you're screwed anyway :D), only a partial resurrection will be possible. If Portage's package database is intact, full resurrection will be possible. """ - typer.echo("Syncing sisyphus database ...") + sisyphus.rescue.start() @app.command("branch") -def branch(branch: str = typer.Argument('master'), remote: str = typer.Option('pagure')): +def branch(branch: str = typer.Argument(...), remote: str = typer.Option(...)): """Pull the branch 'BRANCH' of the Portage tree, Redcore overlay and Portage configs, using 'REMOTE' git repositories. @@ -117,7 +117,7 @@ def sysinfo(): @mirrorSetup.command("list") def mirrorlist(): - """List available binary package repository mirrors (* means active).""" + """List available binary package repository mirrors (the active one is marked with *).""" sisyphus.mirror.printList() @mirrorSetup.command("set") diff --git a/src/frontend/gui/sisyphus-gui.py b/src/frontend/gui/sisyphus-gui.py index a3f1375..5cc4fc8 100644 --- a/src/frontend/gui/sisyphus-gui.py +++ b/src/frontend/gui/sisyphus-gui.py @@ -245,7 +245,7 @@ class Sisyphus(QtWidgets.QMainWindow): if not self.databaseTable.selectionModel().hasSelection(): self.statusBar().showMessage("No package selected, please pick at least one!") else: - Sisyphus.pkgList = self.getSelectedPackages() + Sisyphus.pkgname = self.getSelectedPackages() self.statusBar().showMessage("I am installing requested package(s), please wait ...") self.installThread.start() @@ -253,7 +253,7 @@ class Sisyphus(QtWidgets.QMainWindow): if not self.databaseTable.selectionModel().hasSelection(): self.statusBar().showMessage("No package selected, please pick at least one!") else: - Sisyphus.pkgList = self.getSelectedPackages() + Sisyphus.pkgname = self.getSelectedPackages() self.statusBar().showMessage("I am removing requested package(s), please wait ...") self.uninstallThread.start() @@ -397,10 +397,10 @@ class MainWorker(QtCore.QObject): @QtCore.pyqtSlot() def startInstall(self): self.started.emit() - pkgList = Sisyphus.pkgList + pkgname = Sisyphus.pkgname binhostURL = sisyphus.binhost.getURL() - areBinaries,areSources,needsConfig = sisyphus.solvedeps.package.__wrapped__(pkgList) #undecorate + areBinaries,areSources,needsConfig = sisyphus.solvedeps.package.__wrapped__(pkgname) #undecorate os.chdir(sisyphus.filesystem.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") @@ -424,7 +424,7 @@ class MainWorker(QtCore.QObject): 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'] + pkgname, stdout=subprocess.PIPE) # kill portage if the program dies or it's terminated by the user atexit.register(sisyphus.killportage.start, portageExec) @@ -441,8 +441,8 @@ class MainWorker(QtCore.QObject): @QtCore.pyqtSlot() def startUninstall(self): self.started.emit() - pkgList = Sisyphus.pkgList - portageExec = subprocess.Popen(['emerge', '--depclean'] + pkgList, stdout=subprocess.PIPE) + pkgname = Sisyphus.pkgname + portageExec = subprocess.Popen(['emerge', '--depclean'] + pkgname, stdout=subprocess.PIPE) # kill portage if the program dies or it's terminated by the user atexit.register(sisyphus.killportage.start, portageExec) |