summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2020-08-18 12:26:10 +0100
committerV3n3RiX <venerix@redcorelinux.org>2020-08-18 12:26:10 +0100
commita71ffe9cd09164182584bb01b3993881f7766dfd (patch)
tree3131c0ac94300b27d5983249f54769ec95a89689 /src
parentf28b67f3d6910f71e20da86367205f3c3660ff72 (diff)
make sisyphus.check.root more portable, replace it everywhere
Diffstat (limited to 'src')
-rw-r--r--src/backend/autoremove.py11
-rw-r--r--src/backend/branchsetup.py20
-rw-r--r--src/backend/check.py5
-rw-r--r--src/backend/installbinary.py92
-rw-r--r--src/backend/installebuild.py204
-rw-r--r--src/backend/searchbinary.py15
-rw-r--r--src/backend/uninstall.py11
-rw-r--r--src/backend/uninstallforce.py11
-rw-r--r--src/backend/update.py1
-rw-r--r--src/backend/upgradebinary.py92
-rw-r--r--src/backend/upgradeebuild.py204
-rwxr-xr-xsrc/frontend/cli/sisyphus-cli.py5
12 files changed, 351 insertions, 320 deletions
diff --git a/src/backend/autoremove.py b/src/backend/autoremove.py
index 5bf47ed..b5b732f 100644
--- a/src/backend/autoremove.py
+++ b/src/backend/autoremove.py
@@ -3,9 +3,12 @@
import subprocess
import sisyphus.check
import sisyphus.database
+import sys
def start():
- sisyphus.check.root()
- portageExec = subprocess.Popen(['emerge', '--quiet', '--depclean', '--ask'])
- portageExec.wait()
- sisyphus.database.syncLocal()
+ if sisyphus.check.root() == 0:
+ portageExec = subprocess.Popen(['emerge', '--quiet', '--depclean', '--ask'])
+ portageExec.wait()
+ sisyphus.database.syncLocal()
+ else:
+ sys.exit("\nYou need root permissions to do this, exiting!\n")
diff --git a/src/backend/branchsetup.py b/src/backend/branchsetup.py
index 23670d1..e0d27a6 100644
--- a/src/backend/branchsetup.py
+++ b/src/backend/branchsetup.py
@@ -82,12 +82,14 @@ def warnAboutBinaryRepository(branch,remote):
def start(branch,remote):
- sisyphus.check.root()
- sisyphus.branchreset.start()
- injectGentooPortageTree(branch,remote)
- injectRedcoreEbuildOverlay(branch,remote)
- injectRedcorePortageConfig(branch,remote)
- sisyphus.setjobs.start()
- sisyphus.setprofile.start()
- sisyphus.metadata.regenAnimated()
- warnAboutBinaryRepository(branch,remote)
+ if sisyphus.check.root() == 0:
+ sisyphus.branchreset.start()
+ injectGentooPortageTree(branch,remote)
+ injectRedcoreEbuildOverlay(branch,remote)
+ injectRedcorePortageConfig(branch,remote)
+ sisyphus.setjobs.start()
+ sisyphus.setprofile.start()
+ sisyphus.metadata.regenAnimated()
+ warnAboutBinaryRepository(branch,remote)
+ else:
+ sys.exit("\nYou need root permissions to do this, exiting!\n")
diff --git a/src/backend/check.py b/src/backend/check.py
index a129d36..fb760cc 100644
--- a/src/backend/check.py
+++ b/src/backend/check.py
@@ -1,13 +1,12 @@
#!/usr/bin/python3
import os
-import sys
import subprocess
import sisyphus.filesystem
def root():
- if not os.getuid() == 0:
- sys.exit("\nYou need root permissions to do this, exiting!\n")
+ if os.getuid() == 0:
+ return 0
def portage():
if os.path.isdir(os.path.join(sisyphus.filesystem.portageRepoDir, '.git')):
diff --git a/src/backend/installbinary.py b/src/backend/installbinary.py
index 7df5a88..684bc79 100644
--- a/src/backend/installbinary.py
+++ b/src/backend/installbinary.py
@@ -7,55 +7,59 @@ import sys
import io
import wget
import sisyphus.binhost
+import sisyphus.check
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()
+ if sisyphus.check.root() == 0:
+ 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" + "Ok; Quitting." + "\n")
+ sys.exit("\n" + "No package found; Quitting." + "\n")
else:
- sys.exit("\n" + "No package found; Quitting." + "\n")
- else:
- sys.exit("\n" + "Source package(s) found in the mix;" + " " + "Use" + " " + "'" + "sisyphus install" + " " + ''.join(pkgname) + " " + "--ebuild" + "'" + ";" + " " + "Quitting." + "\n")
+ sys.exit("\n" + "Source package(s) found in the mix;" + " " + "Use" + " " + "'" + "sisyphus install" + " " + ''.join(pkgname) + " " + "--ebuild" + "'" + ";" + " " + "Quitting." + "\n")
+ else:
+ sys.exit("\nYou need root permissions to do this, exiting!\n")
diff --git a/src/backend/installebuild.py b/src/backend/installebuild.py
index 36704f3..199b836 100644
--- a/src/backend/installebuild.py
+++ b/src/backend/installebuild.py
@@ -7,115 +7,119 @@ import sys
import io
import wget
import sisyphus.binhost
+import sisyphus.check
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()
+ if sisyphus.check.root() == 0:
+ 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" + "Ok; Quitting." + "\n")
+ sys.exit("\n" + "No package found; 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()
+ 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:
- 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)
+ 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 "These are the packages that would be merged, in order:" in portageOutput.rstrip():
- if not "Calculating dependencies" in portageOutput.rstrip():
- print(portageOutput.rstrip())
+ 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()
- sisyphus.database.syncLocal()
- else:
- sys.exit("\n" + "Ok; Quitting." + "\n")
+ portageExec.wait()
+ sys.exit("\n" + "Cannot proceed; Apply the above changes to your portage configuration files and try again; 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")
+ sys.exit("\nYou need root permissions to do this, exiting!\n")
diff --git a/src/backend/searchbinary.py b/src/backend/searchbinary.py
index 0305a14..e16c98c 100644
--- a/src/backend/searchbinary.py
+++ b/src/backend/searchbinary.py
@@ -1,6 +1,5 @@
#!/usr/bin/python3
-import os
import sisyphus.filesystem
import sisyphus.update
import sqlite3
@@ -101,11 +100,7 @@ def searchDB(filter, cat = '', pn = '', desc = ''):
def tosql(string):
return '%%' if string == '' else string.replace('*', '%').replace('?', '_')
-def start(filter, cat, pn, desc, single = False):
- if os.getuid() == 0:
- sisyphus.update.start()
- else:
- print('You are not root, cannot fetch updates.\nSearch result may be inaccurate!')
+def showSearch(filter, cat, pn, desc, single = False):
print(f"Looking for {filter} matching packages ...\n")
pkglist = searchDB(filter, tosql(cat), tosql(pn), tosql(desc))
@@ -129,3 +124,11 @@ def start(filter, cat, pn, desc, single = False):
print(f"\nFound {len(pkglist)} binary package(s)")
print("To search for source packages, use the '--ebuild' option.")
+
+def start(filter, cat, pn, desc, single = False):
+ if sisyphus.check.root() == 0:
+ sisyphus.update.start()
+ showSearch(filter, cat, pn, desc, single = False)
+ else:
+ print('\nYou are not root, cannot fetch updates.\nSearch result may be inaccurate!\n')
+ showSearch(filter, cat, pn, desc, single = False)
diff --git a/src/backend/uninstall.py b/src/backend/uninstall.py
index 748e085..2537b74 100644
--- a/src/backend/uninstall.py
+++ b/src/backend/uninstall.py
@@ -3,9 +3,12 @@
import subprocess
import sisyphus.check
import sisyphus.database
+import sys
def start(pkgname):
- sisyphus.check.root()
- portageExec = subprocess.Popen(['emerge', '--quiet', '--depclean', '--ask'] + list(pkgname))
- portageExec.wait()
- sisyphus.database.syncLocal()
+ if sisyphus.check.root() == 0:
+ portageExec = subprocess.Popen(['emerge', '--quiet', '--depclean', '--ask'] + list(pkgname))
+ portageExec.wait()
+ sisyphus.database.syncLocal()
+ else:
+ sys.exit("\nYou need root permissions to do this, exiting!\n")
diff --git a/src/backend/uninstallforce.py b/src/backend/uninstallforce.py
index 9a8330f..f85dbe1 100644
--- a/src/backend/uninstallforce.py
+++ b/src/backend/uninstallforce.py
@@ -3,9 +3,12 @@
import subprocess
import sisyphus.check
import sisyphus.database
+import sys
def start(pkgname):
- sisyphus.check.root()
- portageExec = subprocess.Popen(['emerge', '--quiet', '--unmerge', '--ask'] + list(pkgname))
- portageExec.wait()
- sisyphus.database.syncLocal()
+ if sisyphus.check.root() == 0:
+ portageExec = subprocess.Popen(['emerge', '--quiet', '--unmerge', '--ask'] + list(pkgname))
+ portageExec.wait()
+ sisyphus.database.syncLocal()
+ else:
+ sys.exit("\nYou need root permissions to do this, exiting!\n")
diff --git a/src/backend/update.py b/src/backend/update.py
index 738de3a..902c398 100644
--- a/src/backend/update.py
+++ b/src/backend/update.py
@@ -9,7 +9,6 @@ import sisyphus.sync
@animation.wait('fetching updates')
def start():
- sisyphus.check.root()
sisyphus.cache.clean()
needsPortage = sisyphus.check.portage()
diff --git a/src/backend/upgradebinary.py b/src/backend/upgradebinary.py
index a806214..0f800cc 100644
--- a/src/backend/upgradebinary.py
+++ b/src/backend/upgradebinary.py
@@ -7,55 +7,59 @@ import sys
import io
import wget
import sisyphus.binhost
+import sisyphus.check
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()
+ if sisyphus.check.root() == 0:
+ 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" + "Ok; Quitting." + "\n")
+ sys.exit("\n" + "No package upgrades found; Quitting." + "\n")
else:
- sys.exit("\n" + "No package upgrades found; Quitting." + "\n")
- else:
- sys.exit("\n" + "Source package(s) found in the mix;" + " " + "Use" + " " + "'" + "sisyphus upgrade --ebuild" + "'" + ";" + " " + "Quitting." + "\n")
+ sys.exit("\n" + "Source package(s) found in the mix;" + " " + "Use" + " " + "'" + "sisyphus upgrade --ebuild" + "'" + ";" + " " + "Quitting." + "\n")
+ else:
+ sys.exit("\nYou need root permissions to do this, exiting!\n")
diff --git a/src/backend/upgradeebuild.py b/src/backend/upgradeebuild.py
index d2961d6..0e3a399 100644
--- a/src/backend/upgradeebuild.py
+++ b/src/backend/upgradeebuild.py
@@ -7,116 +7,120 @@ import sys
import io
import wget
import sisyphus.binhost
+import sisyphus.check
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()
+ if sisyphus.check.root() == 0:
+ 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" + "Ok; Quitting." + "\n")
+ sys.exit("\n" + "No package upgrades found; 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()
+ 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:
- 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)
+ 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 "These are the packages that would be merged, in order:" in portageOutput.rstrip():
- if not "Calculating dependencies" in portageOutput.rstrip():
- print(portageOutput.rstrip())
+ 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()
- sisyphus.database.syncLocal()
- else:
- sys.exit("\n" + "Ok; Quitting." + "\n")
+ portageExec.wait()
+ sys.exit("\n" + "Cannot proceed; Apply the above changes to your portage configuration files and try again; 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")
+ sys.exit("\nYou need root permissions to do this, exiting!\n")
diff --git a/src/frontend/cli/sisyphus-cli.py b/src/frontend/cli/sisyphus-cli.py
index 33a2233..61a5d82 100755
--- a/src/frontend/cli/sisyphus-cli.py
+++ b/src/frontend/cli/sisyphus-cli.py
@@ -177,7 +177,10 @@ def autoremove():
@app.command("update")
def update():
"""Update the Portage tree, the Redcore Overlay(s), Portage configs and Sisyphus's package database."""
- sisyphus.update.start()
+ if sisyphus.check.root() == 0:
+ sisyphus.update.start()
+ else:
+ sys.exit("\nYou need root permissions to do this, exiting!\n")
@app.command("upgrade")
def upgrade(ebuild: bool = typer.Option(False, "--ebuild", "-e")):