summaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2022-12-04 22:10:33 +0000
committerV3n3RiX <venerix@koprulu.sector>2022-12-04 22:10:33 +0000
commit99455bbb94f298cd101c3e43227647ccf7aaaf1b (patch)
tree6e1d079bc2a051592d64e5fd1a73b3ea6c2d0123 /src/backend
parent1965c85d0acc683e1dddb58cec343b2ff62711e4 (diff)
add an aditional matchphrase to the dependency solver, add color support && pep8 the whole backendv4.2212.0
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/__init__.py1
-rw-r--r--src/backend/autoremove.py11
-rw-r--r--src/backend/checkenv.py5
-rw-r--r--src/backend/download.py32
-rw-r--r--src/backend/getcolor.py9
-rw-r--r--src/backend/getenv.py17
-rw-r--r--src/backend/install.py106
-rw-r--r--src/backend/mirrors.py31
-rw-r--r--src/backend/purgeenv.py18
-rw-r--r--src/backend/search.py40
-rw-r--r--src/backend/setbranch.py84
-rw-r--r--src/backend/setprofile.py6
-rw-r--r--src/backend/solvedeps.py18
-rw-r--r--src/backend/syncdb.py21
-rw-r--r--src/backend/syncenv.py45
-rw-r--r--src/backend/sysinfo.py1
-rw-r--r--src/backend/uninstall.py18
-rw-r--r--src/backend/update.py20
-rw-r--r--src/backend/upgrade.py105
19 files changed, 395 insertions, 193 deletions
diff --git a/src/backend/__init__.py b/src/backend/__init__.py
index c23ebe8..9c38585 100644
--- a/src/backend/__init__.py
+++ b/src/backend/__init__.py
@@ -1,6 +1,7 @@
from .autoremove import *
from .checkenv import *
from .download import *
+from .getcolor import *
from .getenv import *
from .getfs import *
from .install import *
diff --git a/src/backend/autoremove.py b/src/backend/autoremove.py
index 303b314..8dc00ec 100644
--- a/src/backend/autoremove.py
+++ b/src/backend/autoremove.py
@@ -5,21 +5,26 @@ import io
import subprocess
import sys
import sisyphus.checkenv
+import sisyphus.getcolor
import sisyphus.killemerge
import sisyphus.syncdb
def start():
if sisyphus.checkenv.root():
- portageExec = subprocess.Popen(['emerge', '--quiet', '--depclean', '--ask'])
+ portageExec = subprocess.Popen(
+ ['emerge', '--quiet', '--depclean', '--ask'])
portageExec.wait()
sisyphus.syncdb.localTable()
else:
- sys.exit("\nYou need root permissions to do this, exiting!\n")
+ print(sisyphus.getcolor.bright_red +
+ "\nYou need root permissions to do this!\n" + sisyphus.getcolor.reset)
+ sys.exit()
def xstart():
- portageExec = subprocess.Popen(['emerge', '--depclean'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ portageExec = subprocess.Popen(
+ ['emerge', '--depclean'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
# kill portage if the program dies or it's terminated by the user
atexit.register(sisyphus.killemerge.start, portageExec)
diff --git a/src/backend/checkenv.py b/src/backend/checkenv.py
index 1bf0b52..948bbfe 100644
--- a/src/backend/checkenv.py
+++ b/src/backend/checkenv.py
@@ -15,13 +15,14 @@ def branch():
if os.path.isdir(os.path.join(sisyphus.getfs.gentooRepoDir, '.git')):
os.chdir(sisyphus.getfs.gentooRepoDir)
- localBranch = subprocess.check_output(['git', 'rev-parse', '--abbrev-ref', 'HEAD'])
+ localBranch = subprocess.check_output(
+ ['git', 'rev-parse', '--abbrev-ref', 'HEAD'])
if localBranch.decode().strip() == 'master':
activeBranch = str('master')
if localBranch.decode().strip() == 'next':
- activeBranch = str('next')
+ activeBranch = str('next')
return activeBranch
diff --git a/src/backend/download.py b/src/backend/download.py
index a66d969..cd250f0 100644
--- a/src/backend/download.py
+++ b/src/backend/download.py
@@ -4,23 +4,30 @@ import os
import pickle
import shutil
import wget
+import sisyphus.getcolor
import sisyphus.getenv
import sisyphus.getfs
+
def pkg(pkgname):
binhostURL = sisyphus.getenv.binhostURL()
- areBinaries,areSources,needsConfig = pickle.load(open(os.path.join(sisyphus.getfs.portageMetadataDir, "sisyphus_pkgdeps.pickle"), "rb"))
+ areBinaries, areSources, needsConfig = pickle.load(open(os.path.join(
+ sisyphus.getfs.portageMetadataDir, "sisyphus_pkgdeps.pickle"), "rb"))
for index, binary in enumerate([package + '.tbz2' for package in areBinaries], start=1):
- print(">>> Downloading binary ({}".format(index) + " " + "of" + " " + str(len(areBinaries)) + ")" + " " + binary.replace('.tbz2', ' '))
+ print(">>> Downloading binary" + "(" + sisyphus.getcolor.bright_yellow + "{}".format(index) + sisyphus.getcolor.reset + " " + "of" + " " + sisyphus.getcolor.bright_yellow +
+ str(len(areBinaries)) + sisyphus.getcolor.reset + ")" + " " + sisyphus.getcolor.magenta + binary.replace('.tbz2', ' ') + sisyphus.getcolor.reset)
wget.download(binhostURL + binary)
print("")
if os.path.isdir(os.path.join(sisyphus.getfs.portageCacheDir, binary.rstrip().split("/")[0])):
- shutil.move(binary.rstrip().split("/")[1], os.path.join(os.path.join(sisyphus.getfs.portageCacheDir, binary.rstrip().split("/")[0]), os.path.basename(binary.rstrip().split("/")[1])))
+ shutil.move(binary.rstrip().split("/")[1], os.path.join(os.path.join(
+ sisyphus.getfs.portageCacheDir, binary.rstrip().split("/")[0]), os.path.basename(binary.rstrip().split("/")[1])))
else:
- os.makedirs(os.path.join(sisyphus.getfs.portageCacheDir, binary.rstrip().split("/")[0]))
- shutil.move(binary.rstrip().split("/")[1], os.path.join(os.path.join(sisyphus.getfs.portageCacheDir, binary.rstrip().split("/")[0]), os.path.basename(binary.rstrip().split("/")[1])))
+ os.makedirs(os.path.join(sisyphus.getfs.portageCacheDir,
+ binary.rstrip().split("/")[0]))
+ shutil.move(binary.rstrip().split("/")[1], os.path.join(os.path.join(
+ sisyphus.getfs.portageCacheDir, binary.rstrip().split("/")[0]), os.path.basename(binary.rstrip().split("/")[1])))
if os.path.exists(binary.rstrip().split("/")[1]):
os.remove(binary.rstrip().split("/")[1])
@@ -28,18 +35,23 @@ def pkg(pkgname):
def world():
binhostURL = sisyphus.getenv.binhostURL()
- areBinaries,areSources,needsConfig = pickle.load(open(os.path.join(sisyphus.getfs.portageMetadataDir, "sisyphus_worlddeps.pickle"), "rb"))
+ areBinaries, areSources, needsConfig = pickle.load(open(os.path.join(
+ sisyphus.getfs.portageMetadataDir, "sisyphus_worlddeps.pickle"), "rb"))
for index, binary in enumerate([package + '.tbz2' for package in areBinaries], start=1):
- print(">>> Downloading binary ({}".format(index) + " " + "of" + " " + str(len(areBinaries)) + ")" + " " + binary.replace('.tbz2', ' '))
+ print(">>> Downloading binary" + "(" + sisyphus.getcolor.bright_yellow + "{}".format(index) + sisyphus.getcolor.reset + " " + "of" + " " + sisyphus.getcolor.bright_yellow +
+ str(len(areBinaries)) + sisyphus.getcolor.reset + ")" + " " + sisyphus.getcolor.magenta + binary.replace('.tbz2', ' ') + sisyphus.getcolor.reset)
wget.download(binhostURL + binary)
print("")
if os.path.isdir(os.path.join(sisyphus.getfs.portageCacheDir, binary.rstrip().split("/")[0])):
- shutil.move(binary.rstrip().split("/")[1], os.path.join(os.path.join(sisyphus.getfs.portageCacheDir, binary.rstrip().split("/")[0]), os.path.basename(binary.rstrip().split("/")[1])))
+ shutil.move(binary.rstrip().split("/")[1], os.path.join(os.path.join(
+ sisyphus.getfs.portageCacheDir, binary.rstrip().split("/")[0]), os.path.basename(binary.rstrip().split("/")[1])))
else:
- os.makedirs(os.path.join(sisyphus.getfs.portageCacheDir, binary.rstrip().split("/")[0]))
- shutil.move(binary.rstrip().split("/")[1], os.path.join(os.path.join(sisyphus.getfs.portageCacheDir, binary.rstrip().split("/")[0]), os.path.basename(binary.rstrip().split("/")[1])))
+ os.makedirs(os.path.join(sisyphus.getfs.portageCacheDir,
+ binary.rstrip().split("/")[0]))
+ shutil.move(binary.rstrip().split("/")[1], os.path.join(os.path.join(
+ sisyphus.getfs.portageCacheDir, binary.rstrip().split("/")[0]), os.path.basename(binary.rstrip().split("/")[1])))
if os.path.exists(binary.rstrip().split("/")[1]):
os.remove(binary.rstrip().split("/")[1])
diff --git a/src/backend/getcolor.py b/src/backend/getcolor.py
new file mode 100644
index 0000000..8f4cf3b
--- /dev/null
+++ b/src/backend/getcolor.py
@@ -0,0 +1,9 @@
+#!/usr/bin/python3
+
+bright_green = '\u001b[32;1m'
+bright_red = '\u001b[31;1m'
+bright_yellow = '\u001b[33;1m'
+bright_white = '\u001b[37;1m'
+green = '\u001b[32m'
+magenta = '\u001b[35m'
+reset = '\u001b[0m'
diff --git a/src/backend/getenv.py b/src/backend/getenv.py
index c98d3c8..eebbfee 100644
--- a/src/backend/getenv.py
+++ b/src/backend/getenv.py
@@ -6,7 +6,8 @@ import subprocess
def binhostURL():
binhostURL = []
- portageExec = subprocess.Popen(['emerge', '--info', '--verbose'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ portageExec = subprocess.Popen(
+ ['emerge', '--info', '--verbose'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
for portageOutput in io.TextIOWrapper(portageExec.stdout, encoding="utf-8"):
if "PORTAGE_BINHOST" in portageOutput:
@@ -22,10 +23,14 @@ def csvURL():
descriptionsCsvURL = []
if "packages-next" in csvURL:
- packagesCsvURL = csvURL.replace('packages-next', 'csv-next') + 'remotePackagesPre.csv'
- descriptionsCsvURL = csvURL.replace('packages-next', 'csv-next') + 'remoteDescriptionsPre.csv'
+ packagesCsvURL = csvURL.replace(
+ 'packages-next', 'csv-next') + 'remotePackagesPre.csv'
+ descriptionsCsvURL = csvURL.replace(
+ 'packages-next', 'csv-next') + 'remoteDescriptionsPre.csv'
else:
- packagesCsvURL = csvURL.replace('packages', 'csv') + 'remotePackagesPre.csv'
- descriptionsCsvURL = csvURL.replace('packages', 'csv') + 'remoteDescriptionsPre.csv'
+ packagesCsvURL = csvURL.replace(
+ 'packages', 'csv') + 'remotePackagesPre.csv'
+ descriptionsCsvURL = csvURL.replace(
+ 'packages', 'csv') + 'remoteDescriptionsPre.csv'
- return packagesCsvURL,descriptionsCsvURL
+ return packagesCsvURL, descriptionsCsvURL
diff --git a/src/backend/install.py b/src/backend/install.py
index 64395bb..d0e588d 100644
--- a/src/backend/install.py
+++ b/src/backend/install.py
@@ -8,6 +8,7 @@ import subprocess
import sys
import sisyphus.checkenv
import sisyphus.download
+import sisyphus.getcolor
import sisyphus.getfs
import sisyphus.killemerge
import sisyphus.solvedeps
@@ -19,87 +20,130 @@ def start(pkgname):
if sisyphus.checkenv.root():
sisyphus.update.start()
sisyphus.solvedeps.pkg(pkgname)
- areBinaries,areSources,needsConfig = pickle.load(open(os.path.join(sisyphus.getfs.portageMetadataDir, "sisyphus_pkgdeps.pickle"), "rb"))
+ areBinaries, areSources, needsConfig = pickle.load(open(os.path.join(
+ sisyphus.getfs.portageMetadataDir, "sisyphus_pkgdeps.pickle"), "rb"))
if needsConfig == 0:
if len(areSources) == 0:
if not len(areBinaries) == 0:
os.chdir(sisyphus.getfs.portageCacheDir)
- print("\n" + "These are the binary packages that would be merged, in order:" + "\n\n" + ", ".join(areBinaries) + "\n\n" + "Total:" + " " + str(len(areBinaries)) + " " + "binary package(s)" + "\n")
- if input("Would you like to proceed?" + " " + "[y/N]" + " ").lower().strip()[:1] == "y":
+ print("\n" + sisyphus.getcolor.green + "These are the binary packages that would be merged, in order:" + sisyphus.getcolor.reset + "\n\n" + sisyphus.getcolor.magenta + ", ".join(
+ areBinaries) + sisyphus.getcolor.reset + "\n\n" + sisyphus.getcolor.bright_white + "Total:" + " " + str(len(areBinaries)) + " " + "binary package(s)" + sisyphus.getcolor.reset + "\n")
+ if input(sisyphus.getcolor.bright_white + "Would you like to proceed?" + sisyphus.getcolor.reset + " " + "[" + sisyphus.getcolor.bright_green + "y" + sisyphus.getcolor.reset + "/" + sisyphus.getcolor.bright_red + "N" + sisyphus.getcolor.reset + "]" + " ").lower().strip()[:1] == "y":
sisyphus.download.pkg(pkgname)
- portageExec = subprocess.Popen(['emerge', '--quiet', '--verbose', '--usepkg', '--usepkgonly', '--rebuilt-binaries', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n'] + list(pkgname))
+ portageExec = subprocess.Popen(['emerge', '--quiet', '--verbose', '--usepkg', '--usepkgonly',
+ '--rebuilt-binaries', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n'] + list(pkgname))
portageExec.wait()
sisyphus.syncdb.localTable()
else:
- sys.exit("\n" + "Ok; Quitting." + "\n")
+ print(sisyphus.getcolor.bright_green +
+ "\nOk!\n" + sisyphus.getcolor.reset)
+ sys.exit()
else:
- sys.exit("\n" + "No package found; Quitting." + "\n")
+ print(sisyphus.getcolor.bright_red +
+ "\nNo package found!\n" + sisyphus.getcolor.reset)
+ sys.exit()
else:
- sys.exit("\n" + "Source package(s) found in the mix;" + " " + "Use" + " " + "'" + "sisyphus install" + " " + " ".join(pkgname) + " " + "--ebuild" + "'" + ";" + " " + "Quitting." + "\n")
+ print(sisyphus.getcolor.bright_red +
+ "\nSource package(s) found in the mix!\n" + sisyphus.getcolor.reset)
+ print(sisyphus.getcolor.bright_yellow + "Use" + sisyphus.getcolor.reset + " " + "'" +
+ "sisyphus install" + " " + " ".join(pkgname) + " " + "--ebuild" + "'" + sisyphus.getcolor.reset)
+ sys.exit()
else:
# don't silently fail if a source package requested without the --ebuild option needs a keyword, mask, REQUIRED_USE or USE change
- sys.exit("\n" + "Invalid request;" " " + "Use" + " " + "'" + "sisyphus install" + " " + " ".join(pkgname) + " " + "--ebuild" + "'" + ";" + " " + "Quitting." + "\n")
+ print(sisyphus.getcolor.bright_red +
+ "\nInvalid request!\n" + sisyphus.getcolor.reset)
+ print(sisyphus.getcolor.bright_yellow + "Use" + sisyphus.getcolor.reset + " " + "'" +
+ "sisyphus install" + " " + " ".join(pkgname) + " " + "--ebuild" + "'" + sisyphus.getcolor.reset)
+ sys.exit()
else:
- sys.exit("\nYou need root permissions to do this, exiting!\n")
+ print(sisyphus.getcolor.bright_red +
+ "\nYou need root permissions to do this!\n" + sisyphus.getcolor.reset)
+ sys.exit()
def estart(pkgname):
if sisyphus.checkenv.root():
sisyphus.update.start()
sisyphus.solvedeps.pkg(pkgname)
- areBinaries,areSources,needsConfig = pickle.load(open(os.path.join(sisyphus.getfs.portageMetadataDir, "sisyphus_pkgdeps.pickle"), "rb"))
+ areBinaries, areSources, needsConfig = pickle.load(open(os.path.join(
+ sisyphus.getfs.portageMetadataDir, "sisyphus_pkgdeps.pickle"), "rb"))
if needsConfig == 0:
if len(areSources) == 0:
if not len(areBinaries) == 0:
os.chdir(sisyphus.getfs.portageCacheDir)
- print("\n" + "These are the binary packages that would be merged, in order:" + "\n\n" + ", ".join(areBinaries) + "\n\n" + "Total:" + " " + str(len(areBinaries)) + " " + "binary package(s)" + "\n")
- if input("Would you like to proceed?" + " " + "[y/N]" + " ").lower().strip()[:1] == "y":
+ print("\n" + sisyphus.getcolor.green + "These are the binary packages that would be merged, in order:" + sisyphus.getcolor.reset + "\n\n" + sisyphus.getcolor.magenta + ", ".join(
+ areBinaries) + sisyphus.getcolor.reset + "\n\n" + sisyphus.getcolor.bright_white + "Total:" + " " + str(len(areBinaries)) + " " + "binary package(s)" + sisyphus.getcolor.reset + "\n")
+ if input(sisyphus.getcolor.bright_white + "Would you like to proceed?" + sisyphus.getcolor.reset + " " + "[" + sisyphus.getcolor.bright_green + "y" + sisyphus.getcolor.reset + "/" + sisyphus.getcolor.bright_red + "N" + sisyphus.getcolor.reset + "]" + " ").lower().strip()[:1] == "y":
sisyphus.download.pkg(pkgname)
- portageExec = subprocess.Popen(['emerge', '--quiet', '--verbose', '--usepkg', '--usepkgonly', '--rebuilt-binaries', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n'] + list(pkgname))
+ portageExec = subprocess.Popen(['emerge', '--quiet', '--verbose', '--usepkg', '--usepkgonly',
+ '--rebuilt-binaries', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n'] + list(pkgname))
portageExec.wait()
sisyphus.syncdb.localTable()
else:
- sys.exit("\n" + "Ok; Quitting." + "\n")
+ print(sisyphus.getcolor.bright_green +
+ "\nOk!\n" + sisyphus.getcolor.reset)
+ sys.exit()
else:
- sys.exit("\n" + "No package found; Quitting." + "\n")
+ print(sisyphus.getcolor.bright_red +
+ "\nNo package found!\n" + sisyphus.getcolor.reset)
+ sys.exit()
else:
if not len(areBinaries) == 0:
os.chdir(sisyphus.getfs.portageCacheDir)
- print("\n" + "These are the binary packages that would be merged, in order:" + "\n\n" + ", ".join(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" + ", ".join(areSources) + "\n\n" + "Total:" + " " + str(len(areSources)) + " " + "source package(s)" + "\n")
- if input("Would you like to proceed?" + " " + "[y/N]" + " ").lower().strip()[:1] == "y":
+ print("\n" + sisyphus.getcolor.green + "These are the binary packages that would be merged, in order:" + sisyphus.getcolor.reset + "\n\n" + sisyphus.getcolor.magenta + ", ".join(
+ areBinaries) + sisyphus.getcolor.reset + "\n\n" + sisyphus.getcolor.bright_white + "Total:" + " " + str(len(areBinaries)) + " " + "binary package(s)" + sisyphus.getcolor.reset + "\n")
+ print("\n" + sisyphus.getcolor.green + "These are the source packages that would be merged, in order:" + sisyphus.getcolor.reset + "\n\n" + sisyphus.getcolor.magenta + ", ".join(
+ areSources) + sisyphus.getcolor.reset + "\n\n" + sisyphus.getcolor.bright_white + "Total:" + " " + str(len(areSources)) + " " + "source package(s)" + sisyphus.getcolor.reset + "\n")
+ if input(sisyphus.getcolor.bright_white + "Would you like to proceed?" + sisyphus.getcolor.reset + " " + "[" + sisyphus.getcolor.bright_green + "y" + sisyphus.getcolor.reset + "/" + sisyphus.getcolor.bright_red + "N" + sisyphus.getcolor.reset + "]" + " ").lower().strip()[:1] == "y":
sisyphus.download.pkg(pkgname)
- portageExec = subprocess.Popen(['emerge', '--quiet', '--verbose', '--usepkg', '--rebuilt-binaries', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n'] + list(pkgname))
+ portageExec = subprocess.Popen(['emerge', '--quiet', '--verbose', '--usepkg', '--rebuilt-binaries',
+ '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n'] + list(pkgname))
portageExec.wait()
sisyphus.syncdb.localTable()
else:
- sys.exit("\n" + "Ok; Quitting." + "\n")
+ print(sisyphus.getcolor.bright_green +
+ "\nOk!\n" + sisyphus.getcolor.reset)
+ sys.exit()
else:
- print("\n" + "These are the source packages that would be merged, in order:" + "\n\n" + ", ".join(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', '--quiet', '--verbose', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n'] + list(pkgname))
+ print("\n" + sisyphus.getcolor.green + "These are the source packages that would be merged, in order:" + sisyphus.getcolor.reset + "\n\n" + sisyphus.getcolor.magenta + ", ".join(
+ areSources) + sisyphus.getcolor.reset + "\n\n" + sisyphus.getcolor.bright_white + "Total:" + " " + str(len(areSources)) + " " + "source package(s)" + sisyphus.getcolor.reset + "\n")
+ if input(sisyphus.getcolor.bright_white + "Would you like to proceed?" + sisyphus.getcolor.reset + " " + "[" + sisyphus.getcolor.bright_green + "y" + sisyphus.getcolor.reset + "/" + sisyphus.getcolor.bright_red + "N" + sisyphus.getcolor.reset + "]" + " ").lower().strip()[:1] == "y":
+ portageExec = subprocess.Popen(
+ ['emerge', '--quiet', '--verbose', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n'] + list(pkgname))
portageExec.wait()
sisyphus.syncdb.localTable()
else:
- sys.exit("\n" + "Ok; Quitting." + "\n")
+ print(sisyphus.getcolor.bright_green +
+ "\nOk!\n" + sisyphus.getcolor.reset)
+ sys.exit()
else:
- portageExec = subprocess.Popen(['emerge', '--quiet', '--pretend', '--getbinpkg', '--rebuilt-binaries', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n'] + list(pkgname))
+ portageExec = subprocess.Popen(['emerge', '--quiet', '--pretend', '--getbinpkg', '--rebuilt-binaries',
+ '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n'] + list(pkgname))
portageExec.wait()
- sys.exit("\n" + "Cannot proceed; Apply the above changes to your portage configuration files and try again; Quitting." + "\n")
+ print(sisyphus.getcolor.bright_red +
+ "\nCannot proceed!\n" + sisyphus.getcolor.reset)
+ print(sisyphus.getcolor.bright_yellow +
+ "Apply the above changes to your portage configuration files and try again" + sisyphus.getcolor.reset)
+ sys.exit()
else:
- sys.exit("\nYou need root permissions to do this, exiting!\n")
+ print(sisyphus.getcolor.bright_red +
+ "\nYou need root permissions to do this!\n" + sisyphus.getcolor.reset)
+ sys.exit()
def xstart(pkgname):
- sisyphus.solvedeps.pkg.__wrapped__(pkgname) #undecorate
- areBinaries,areSources,needsConfig = pickle.load(open(os.path.join(sisyphus.getfs.portageMetadataDir, "sisyphus_pkgdeps.pickle"), "rb"))
+ sisyphus.solvedeps.pkg.__wrapped__(pkgname) # undecorate
+ areBinaries, areSources, needsConfig = pickle.load(open(os.path.join(
+ sisyphus.getfs.portageMetadataDir, "sisyphus_pkgdeps.pickle"), "rb"))
os.chdir(sisyphus.getfs.portageCacheDir)
- print("\n" + "These are the binary packages that will be merged, in order:" + "\n\n" + ", ".join(areBinaries) + "\n\n" + "Total:" + " " + str(len(areBinaries)) + " " + "binary package(s)" + "\n\n")
+ print("\n" + "These are the binary packages that will be merged, in order:" + "\n\n" + ", ".join(
+ areBinaries) + "\n\n" + "Total:" + " " + str(len(areBinaries)) + " " + "binary package(s)" + "\n\n")
sisyphus.download.pkg(pkgname)
- portageExec = subprocess.Popen(['emerge', '--quiet', '--verbose', '--usepkg', '--usepkgonly', '--rebuilt-binaries', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n'] + pkgname, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ portageExec = subprocess.Popen(['emerge', '--quiet', '--verbose', '--usepkg', '--usepkgonly', '--rebuilt-binaries',
+ '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n'] + pkgname, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
# kill portage if the program dies or it's terminated by the user
atexit.register(sisyphus.killemerge.start, portageExec)
diff --git a/src/backend/mirrors.py b/src/backend/mirrors.py
index ad02f58..83d83f1 100644
--- a/src/backend/mirrors.py
+++ b/src/backend/mirrors.py
@@ -2,6 +2,7 @@
import sisyphus.getfs
+
def getList():
mirrorList = []
@@ -17,6 +18,7 @@ def getList():
return mirrorList
+
def printList():
mirrorList = getList()
@@ -26,17 +28,27 @@ def printList():
else:
print(i + 1, ' ', line['Url'])
+
def writeList(mirrorList):
with open(sisyphus.getfs.mirrorCfg, 'w+') as mirrorFile:
- mirrorFile.write("#######################################################\n")
- mirrorFile.write("# Support for multiple mirrors is somewhat incomplete #\n")
- mirrorFile.write("#######################################################\n")
- mirrorFile.write("# Please avoid using the Main Repository #\n")
- mirrorFile.write("# http://mirrors.redcorelinux.org/redcorelinux #\n")
- mirrorFile.write("# as the bandwidth is limited, use mirrors instead #\n")
- mirrorFile.write("#######################################################\n")
- mirrorFile.write("# Uncomment only one mirror from the list bellow #\n")
- mirrorFile.write("#######################################################\n")
+ mirrorFile.write(
+ "#######################################################\n")
+ mirrorFile.write(
+ "# Support for multiple mirrors is somewhat incomplete #\n")
+ mirrorFile.write(
+ "#######################################################\n")
+ mirrorFile.write(
+ "# Please avoid using the Main Repository #\n")
+ mirrorFile.write(
+ "# http://mirrors.redcorelinux.org/redcorelinux #\n")
+ mirrorFile.write(
+ "# as the bandwidth is limited, use mirrors instead #\n")
+ mirrorFile.write(
+ "#######################################################\n")
+ mirrorFile.write(
+ "# Uncomment only one mirror from the list bellow #\n")
+ mirrorFile.write(
+ "#######################################################\n")
mirrorFile.write("\n")
for line in mirrorList:
mirror = 'PORTAGE_BINHOST=' + '"' + line['Url'] + '"'
@@ -45,6 +57,7 @@ def writeList(mirrorList):
mirrorFile.write(mirror + "\n")
mirrorFile.write("\n")
+
def setActive(mirror):
mirrorList = getList()
if mirror not in range(1, len(mirrorList) + 1):
diff --git a/src/backend/purgeenv.py b/src/backend/purgeenv.py
index ff009e7..d9b12c9 100644
--- a/src/backend/purgeenv.py
+++ b/src/backend/purgeenv.py
@@ -13,7 +13,8 @@ def branch():
if os.path.isfile(os.path.join(sisyphus.getfs.gentooRepoDir, files)):
os.remove(os.path.join(sisyphus.getfs.gentooRepoDir, files))
else:
- shutil.rmtree(os.path.join(sisyphus.getfs.gentooRepoDir, files))
+ shutil.rmtree(os.path.join(
+ sisyphus.getfs.gentooRepoDir, files))
else:
os.makedirs(sisyphus.getfs.gentooRepoDir)
@@ -22,7 +23,8 @@ def branch():
if os.path.isfile(os.path.join(sisyphus.getfs.redcoreRepoDir, files)):
os.remove(os.path.join(sisyphus.getfs.redcoreRepoDir, files))
else:
- shutil.rmtree(os.path.join(sisyphus.getfs.redcoreRepoDir, files))
+ shutil.rmtree(os.path.join(
+ sisyphus.getfs.redcoreRepoDir, files))
else:
os.makedirs(sisyphus.getfs.redcoreRepoDir)
@@ -31,7 +33,8 @@ def branch():
if os.path.isfile(os.path.join(sisyphus.getfs.portageConfigDir, files)):
os.remove(os.path.join(sisyphus.getfs.portageConfigDir, files))
else:
- shutil.rmtree(os.path.join(sisyphus.getfs.portageConfigDir, files))
+ shutil.rmtree(os.path.join(
+ sisyphus.getfs.portageConfigDir, files))
else:
os.makedirs(sisyphus.getfs.portageConfigDir)
@@ -42,13 +45,16 @@ def cache():
if os.path.isfile(os.path.join(sisyphus.getfs.portageCacheDir, files)):
os.remove(os.path.join(sisyphus.getfs.portageCacheDir, files))
else:
- shutil.rmtree(os.path.join(sisyphus.getfs.portageCacheDir, files))
+ shutil.rmtree(os.path.join(
+ sisyphus.getfs.portageCacheDir, files))
def metadata():
if os.path.isdir(sisyphus.getfs.portageMetadataDir):
for files in os.listdir(sisyphus.getfs.portageMetadataDir):
if os.path.isfile(os.path.join(sisyphus.getfs.portageMetadataDir, files)):
- os.remove(os.path.join(sisyphus.getfs.portageMetadataDir, files))
+ os.remove(os.path.join(
+ sisyphus.getfs.portageMetadataDir, files))
else:
- shutil.rmtree(os.path.join(sisyphus.getfs.portageMetadataDir, files))
+ shutil.rmtree(os.path.join(
+ sisyphus.getfs.portageMetadataDir, files))
diff --git a/src/backend/search.py b/src/backend/search.py
index e68cd2d..a374da7 100644
--- a/src/backend/search.py
+++ b/src/backend/search.py
@@ -3,11 +3,12 @@
import sqlite3
import subprocess
import sisyphus.checkenv
+import sisyphus.getcolor
import sisyphus.getfs
import sisyphus.update
-def searchDB(filter, cat = '', pn = '', desc = ''):
+def searchDB(filter, cat='', pn='', desc=''):
NOVIRT = "AND cat NOT LIKE 'virtual'"
SELECTS = {
'all': f'''SELECT
@@ -106,34 +107,49 @@ def tosql(string):
def showSearch(filter, cat, pn, desc, single):
- print(f"Searching {filter} packages ... \n")
+ print("Searching" + sisyphus.getcolor.bright_yellow + " " +
+ f"{filter}" + " " + sisyphus.getcolor.reset + "packages ..." + "\n")
pkglist = searchDB(filter, tosql(cat), tosql(pn), tosql(desc))
if len(pkglist) == 0:
- print("No package found!\nUse the '--ebuild' option to search for source packages!")
+ print(sisyphus.getcolor.bright_red +
+ "No binary package found!\n" + sisyphus.getcolor.reset)
+ print(sisyphus.getcolor.bright_yellow + "Use the" + sisyphus.getcolor.reset + " " + "'" + "--ebuild" +
+ "'" + " " + sisyphus.getcolor.bright_yellow + "option to search source packages" + sisyphus.getcolor.reset)
+ print(sisyphus.getcolor.bright_yellow +
+ "Use" + sisyphus.getcolor.reset + " " + "'" + "sisyphus search --help" + "'" + " " + sisyphus.getcolor.bright_yellow + "for help" + sisyphus.getcolor.reset)
else:
if single:
- print(f"{'Package':45} {'Installed':20} Available")
+ print(sisyphus.getcolor.green +
+ f"{'Package category/name':45} {'Installed version':20} {'Latest available version':30} {'Description'}" + sisyphus.getcolor.reset)
for pkg in pkglist:
if not single:
- print(f"* {pkg['cat']}/{pkg['pn']}")
- print(f"\tInstalled version: {pkg['iv']}")
+ print(sisyphus.getcolor.bright_green + "*" + " " + sisyphus.getcolor.reset +
+ sisyphus.getcolor.bright_white + f"{pkg['cat']}/{pkg['pn']}" + sisyphus.getcolor.reset)
+ print(sisyphus.getcolor.green + "\tInstalled version:" +
+ " " + sisyphus.getcolor.reset + f"{pkg['iv']}")
if pkg['av'] != 'alien':
- print(f"\tLatest available version: {pkg['av']}")
+ print(sisyphus.getcolor.green + "\tLatest available version:" +
+ " " + sisyphus.getcolor.reset + f"{pkg['av']}")
else:
- print(f"\tAlien package: Use `sisyphus search --ebuild {pkg['pn']}` for available version!")
- print(f"\tDescription: {pkg['desc']}\n")
+ print(sisyphus.getcolor.green + "\tAlien package:" + " " + sisyphus.getcolor.reset +
+ "Use `sisyphus search --ebuild" + " " + f"{pkg['pn']}`" + " " + "for available version!")
+ print(sisyphus.getcolor.green + "\tDescription:" + " " +
+ sisyphus.getcolor.reset + f"{pkg['desc']}" + "\n")
else:
cpn = f"{pkg['cat']}/{pkg['pn']}"
- print(f"{cpn:45} {str(pkg['iv']):20} {str(pkg['av'])}")
- print(f"\nFound {len(pkglist)} matching package(s) ...")
+ print(sisyphus.getcolor.bright_white + f"{cpn:45}" + " " + sisyphus.getcolor.reset +
+ f"{str(pkg['iv']):20}" + " " + f"{str(pkg['av']):30}" + " " + f"{str(pkg['desc'])}")
+ print("\nFound" + " " + sisyphus.getcolor.bright_yellow +
+ f"{len(pkglist)}" + " " + sisyphus.getcolor.reset + "matching package(s) ...")
def start(filter, cat, pn, desc, single):
if sisyphus.checkenv.root():
sisyphus.update.start()
else:
- print("\nYou are not root, cannot fetch updates.\nSearch result may be inaccurate!\n")
+ print("\n" + sisyphus.getcolor.bright_red + "You don't have root permissions, cannot update the database!" +
+ sisyphus.getcolor.reset + sisyphus.getcolor.bright_yellow + "\nSearch results may be inaccurate" + sisyphus.getcolor.reset + "\n")
showSearch(filter, cat, pn, desc, single)
diff --git a/src/backend/setbranch.py b/src/backend/setbranch.py
index b1f42d3..0527ad4 100644
--- a/src/backend/setbranch.py
+++ b/src/backend/setbranch.py
@@ -5,13 +5,14 @@ import git
import os
import sys
import sisyphus.checkenv
+import sisyphus.getcolor
import sisyphus.getfs
import sisyphus.purgeenv
import sisyphus.setjobs
import sisyphus.setprofile
-def getBranchRemote(branch,remote):
+def getBranchRemote(branch, remote):
gentooRemote = []
redcoreRemote = []
portageConfigRemote = []
@@ -20,80 +21,81 @@ def getBranchRemote(branch,remote):
remote = sisyphus.getfs.remoteGitlab
elif "pagure" in remote:
remote = sisyphus.getfs.remotePagure
- else:
- sys.exit("Usage: sisyphus-cli.py branch [OPTIONS] BRANCH" + "\n" +
- "Try 'sisyphus-cli.py branch --help' for help." + "\n\n" +
- "Error: Invalid remote" + " " + "'" + str(remote) + "'" + " " + "(options : gitlab, pagure)"
- )
elif "next" in branch:
if "gitlab" in remote:
remote = sisyphus.getfs.remoteGitlab
elif "pagure" in remote:
remote = sisyphus.getfs.remotePagure
- else:
- sys.exit("Usage: sisyphus-cli.py branch [OPTIONS] BRANCH" + "\n" +
- "Try 'sisyphus-cli.py branch --help' for help." + "\n\n" +
- "Error: Invalid remote" + " " + "'" + str(remote) + "'" + " " + "(options : gitlab, pagure)"
- )
- else:
- sys.exit("Usage: sisyphus-cli.py branch [OPTIONS] BRANCH" + "\n" +
- "Try 'sisyphus-cli.py branch --help' for help." + "\n\n" +
- "Error: Invalid branch" + " " + "'" + str(branch) + "'" +" " + "(options : master, next)"
- )
gentooRemote = [remote, sisyphus.getfs.gentooRepo]
redcoreRemote = [remote, sisyphus.getfs.redcoreRepo]
portageConfigRemote = [remote, sisyphus.getfs.portageConfigRepo]
- return gentooRemote,redcoreRemote,portageConfigRemote
+ return gentooRemote, redcoreRemote, portageConfigRemote
@animation.wait('injecting Gentoo Linux portage tree')
-def injectGentooRepo(branch,remote):
- gentooRemote,redcoreRemote,portageConfigRemote = getBranchRemote(branch,remote)
+def injectGentooRepo(branch, remote):
+ gentooRemote, redcoreRemote, portageConfigRemote = getBranchRemote(
+ branch, remote)
if not os.path.isdir(os.path.join(sisyphus.getfs.gentooRepoDir, '.git')):
- git.Repo.clone_from("/".join(gentooRemote), sisyphus.getfs.gentooRepoDir, depth=1, branch=branch)
+ git.Repo.clone_from("/".join(gentooRemote),
+ sisyphus.getfs.gentooRepoDir, depth=1, branch=branch)
@animation.wait('injecting Redcore Linux ebuild overlay')
-def injectRedcoreRepo(branch,remote):
- gentooRemote,redcoreRemote,portageConfigRemote = getBranchRemote(branch,remote)
+def injectRedcoreRepo(branch, remote):
+ gentooRemote, redcoreRemote, portageConfigRemote = getBranchRemote(
+ branch, remote)
if not os.path.isdir(os.path.join(sisyphus.getfs.redcoreRepoDir, '.git')):
- git.Repo.clone_from("/".join(redcoreRemote), sisyphus.getfs.redcoreRepoDir, depth=1, branch=branch)
+ git.Repo.clone_from("/".join(redcoreRemote),
+ sisyphus.getfs.redcoreRepoDir, depth=1, branch=branch)
@animation.wait('injecting Redcore Linux portage config')
-def injectPortageConfigRepo(branch,remote):
- gentooRemote,redcoreRemote,portageConfigRemote = getBranchRemote(branch,remote)
+def injectPortageConfigRepo(branch, remote):
+ gentooRemote, redcoreRemote, portageConfigRemote = getBranchRemote(
+ branch, remote)
if not os.path.isdir(os.path.join(sisyphus.getfs.portageConfigDir, '.git')):
- git.Repo.clone_from("/".join(portageConfigRemote), sisyphus.getfs.portageConfigDir, depth=1, branch=branch)
+ git.Repo.clone_from("/".join(portageConfigRemote),
+ sisyphus.getfs.portageConfigDir, depth=1, branch=branch)
-def giveWarning(branch,remote):
+def giveWarning(branch, remote):
if "master" in branch:
- print("\nThe switch to branch" + " " + "'" + branch + "'" + " " + "from remote" + " " + "'" + remote + "'" + " " + "is now complete")
- print("You must pair this branch with the stable binhost (binary repository)")
- print("Hint : Use the odd numbers (1,3,5,7) from 'sisyphus mirror list'")
- print("Examples : 'sisyphus mirror set 1' or 'sisyphus mirror set 5'\n")
+ print(sisyphus.getcolor.green + "\nActive branch switched:" +
+ " " + sisyphus.getcolor.reset + "'" + branch + "'")
+ print(sisyphus.getcolor.green + "Active remote switched:" +
+ " " + sisyphus.getcolor.reset + "'" + remote + "'")
+ print(sisyphus.getcolor.bright_yellow + "\nUse" + sisyphus.getcolor.reset + " " + "'" + "sisyphus mirror set 3" + "'" + " " + sisyphus.getcolor.bright_yellow + "or" +
+ sisyphus.getcolor.reset + " " + "'" + "sisyphus mirror set 7" + "'" + " " + sisyphus.getcolor.bright_yellow + "to pair the binhost" + sisyphus.getcolor.reset)
+ print(sisyphus.getcolor.bright_yellow +
+ "Use" + sisyphus.getcolor.reset + " " + "'" + "sisyphus branch --help" + "'" + " " + sisyphus.getcolor.bright_yellow + "for help" + sisyphus.getcolor.reset)
elif "next" in branch:
- print("\nThe switch to branch" + " " + "'" + branch + "'" + " " + "from remote" + " " + "'" + remote + "'" + " " + "is now complete")
- print("You must pair this branch with the testing binhost (binary repository)")
- print("Hint : Use the even numbers (2,4,6,8) from 'sisyphus mirror list'")
- print("Examples : 'sisyphus mirror set 4' or 'sisyphus mirror set 8'\n")
+ print(sisyphus.getcolor.green + "\nActive branch switched:" +
+ " " + sisyphus.getcolor.reset + "'" + branch + "'")
+ print(sisyphus.getcolor.green + "Active remote switched:" +
+ " " + sisyphus.getcolor.reset + "'" + remote + "'")
+ print(sisyphus.getcolor.bright_yellow + "\nUse" + sisyphus.getcolor.reset + " " + "'" + "sisyphus mirror set 4" + "'" + " " + sisyphus.getcolor.bright_yellow + "or" +
+ sisyphus.getcolor.reset + " " + "'" + "sisyphus mirror set 8" + "'" + " " + sisyphus.getcolor.bright_yellow + "to pair the binhost" + sisyphus.getcolor.reset)
+ print(sisyphus.getcolor.bright_yellow +
+ "Use" + sisyphus.getcolor.reset + " " + "'" + "sisyphus branch --help" + "'" + " " + sisyphus.getcolor.bright_yellow + "for help" + sisyphus.getcolor.reset)
-def start(branch,remote):
+def start(branch, remote):
if sisyphus.checkenv.root():
sisyphus.purgeenv.branch()
sisyphus.purgeenv.metadata()
- injectGentooRepo(branch,remote)
- injectRedcoreRepo(branch,remote)
- injectPortageConfigRepo(branch,remote)
+ injectGentooRepo(branch, remote)
+ injectRedcoreRepo(branch, remote)
+ injectPortageConfigRepo(branch, remote)
sisyphus.setjobs.start()
sisyphus.setprofile.start()
- giveWarning(branch,remote)
+ giveWarning(branch, remote)
else:
- sys.exit("\nYou need root permissions to do this, exiting!\n")
+ print(sisyphus.getcolor.bright_red +
+ "\nYou need root permissions to do this!\n" + sisyphus.getcolor.reset)
+ sys.exit()
diff --git a/src/backend/setprofile.py b/src/backend/setprofile.py
index a553e95..50ed554 100644
--- a/src/backend/setprofile.py
+++ b/src/backend/setprofile.py
@@ -8,11 +8,13 @@ import subprocess
@animation.wait('setting up profile')
def start():
if platform.uname()[4] == 'x86_64':
- eselectExec = subprocess.Popen(['eselect', 'profile', 'set', 'default/linux/amd64/17.1/hardened'])
+ eselectExec = subprocess.Popen(
+ ['eselect', 'profile', 'set', 'default/linux/amd64/17.1/hardened'])
eselectExec.wait()
if platform.uname()[4] == 'aarch64':
- eselectExec = subprocess.Popen(['eselect', 'profile', 'set', 'default/linux/arm64/17.0'])
+ eselectExec = subprocess.Popen(
+ ['eselect', 'profile', 'set', 'default/linux/arm64/17.0'])
eselectExec.wait()
envExec = subprocess.Popen(['env-update'], stdout=subprocess.DEVNULL)
diff --git a/src/backend/solvedeps.py b/src/backend/solvedeps.py
index 9ad9aca..5e66465 100644
--- a/src/backend/solvedeps.py
+++ b/src/backend/solvedeps.py
@@ -12,7 +12,8 @@ def pkg(pkgname):
areBinaries = []
areSources = []
needsConfig = int()
- portageExec = subprocess.Popen(['emerge', '--quiet', '--pretend', '--getbinpkg', '--rebuilt-binaries', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n'] + list(pkgname), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ portageExec = subprocess.Popen(['emerge', '--quiet', '--pretend', '--getbinpkg', '--rebuilt-binaries', '--with-bdeps=y',
+ '--misspell-suggestion=n', '--fuzzy-search=n'] + list(pkgname), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout, stderr = portageExec.communicate()
for portageOutput in stderr.decode('utf-8').splitlines():
@@ -28,6 +29,9 @@ def pkg(pkgname):
if "The following REQUIRED_USE flag constraints are unsatisfied:" in portageOutput:
needsConfig = int(1)
+ if "One of the following masked packages is required to complete your request:" in portageOutput:
+ needsConfig = int(1)
+
for portageOutput in stdout.decode('utf-8').splitlines():
if "[binary" in portageOutput:
isBinary = portageOutput.split("]")[1].split("[")[0].strip(" ")
@@ -37,7 +41,8 @@ def pkg(pkgname):
isSource = portageOutput.split("]")[1].split("[")[0].strip(" ")
areSources.append(isSource)
- pickle.dump([areBinaries,areSources,needsConfig], open(os.path.join(sisyphus.getfs.portageMetadataDir, "sisyphus_pkgdeps.pickle"), "wb"))
+ pickle.dump([areBinaries, areSources, needsConfig], open(os.path.join(
+ sisyphus.getfs.portageMetadataDir, "sisyphus_pkgdeps.pickle"), "wb"))
@animation.wait('resolving dependencies')
@@ -45,7 +50,8 @@ def world():
areBinaries = []
areSources = []
needsConfig = int()
- 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, stderr=subprocess.PIPE)
+ 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, stderr=subprocess.PIPE)
stdout, stderr = portageExec.communicate()
for portageOutput in stderr.decode('utf-8').splitlines():
@@ -61,6 +67,9 @@ def world():
if "The following REQUIRED_USE flag constraints are unsatisfied:" in portageOutput:
needsConfig = int(1)
+ if "One of the following masked packages is required to complete your request:" in portageOutput:
+ needsConfig = int(1)
+
for portageOutput in stdout.decode('utf-8').splitlines():
if "[binary" in portageOutput:
isBinary = portageOutput.split("]")[1].split("[")[0].strip(" ")
@@ -70,4 +79,5 @@ def world():
isSource = portageOutput.split("]")[1].split("[")[0].strip(" ")
areSources.append(isSource)
- pickle.dump([areBinaries,areSources,needsConfig], open(os.path.join(sisyphus.getfs.portageMetadataDir, "sisyphus_worlddeps.pickle"), "wb"))
+ pickle.dump([areBinaries, areSources, needsConfig], open(os.path.join(
+ sisyphus.getfs.portageMetadataDir, "sisyphus_worlddeps.pickle"), "wb"))
diff --git a/src/backend/syncdb.py b/src/backend/syncdb.py
index 65812ac..2dee634 100644
--- a/src/backend/syncdb.py
+++ b/src/backend/syncdb.py
@@ -10,7 +10,7 @@ import sisyphus.getfs
def remoteCSV():
- packagesCsvURL,descriptionsCsvURL = sisyphus.getenv.csvURL()
+ packagesCsvURL, descriptionsCsvURL = sisyphus.getenv.csvURL()
http = urllib3.PoolManager()
with http.request('GET', packagesCsvURL, preload_content=False) as tmp_buffer, open(sisyphus.getfs.remotePackagesCsv, 'wb') as output_file:
@@ -30,16 +30,20 @@ def remoteTable():
sisyphusdb = sqlite3.connect(sisyphus.getfs.localDatabase)
sisyphusdb.cursor().execute('''drop table if exists remote_packages''')
sisyphusdb.cursor().execute('''drop table if exists remote_descriptions''')
- sisyphusdb.cursor().execute('''create table remote_packages (category TEXT,name TEXT,version TEXT,slot TEXT)''')
- sisyphusdb.cursor().execute('''create table remote_descriptions (category TEXT,name TEXT,description TEXT)''')
+ sisyphusdb.cursor().execute(
+ '''create table remote_packages (category TEXT,name TEXT,version TEXT,slot TEXT)''')
+ sisyphusdb.cursor().execute(
+ '''create table remote_descriptions (category TEXT,name TEXT,description TEXT)''')
with open(sisyphus.getfs.remotePackagesCsv) as input_file:
for row in csv.reader(input_file):
- sisyphusdb.cursor().execute("insert into remote_packages (category, name, version, slot) values (?, ?, ?, ?);", row)
+ sisyphusdb.cursor().execute(
+ "insert into remote_packages (category, name, version, slot) values (?, ?, ?, ?);", row)
with open(sisyphus.getfs.remoteDescriptionsCsv) as input_file:
for row in csv.reader(input_file):
- sisyphusdb.cursor().execute("insert into remote_descriptions (category, name, description) values (?, ?, ?);", row)
+ sisyphusdb.cursor().execute(
+ "insert into remote_descriptions (category, name, description) values (?, ?, ?);", row)
sisyphusdb.commit()
sisyphusdb.close()
@@ -50,12 +54,13 @@ def localTable():
sisyphusdb = sqlite3.connect(sisyphus.getfs.localDatabase)
sisyphusdb.cursor().execute('''drop table if exists local_packages''')
- sisyphusdb.cursor().execute('''create table local_packages (category TEXT,name TEXT,version TEXT,slot TEXT)''')
+ sisyphusdb.cursor().execute(
+ '''create table local_packages (category TEXT,name TEXT,version TEXT,slot TEXT)''')
with open(sisyphus.getfs.localPackagesCsv) as input_file:
for row in csv.reader(input_file):
- sisyphusdb.cursor().execute("insert into local_packages (category, name, version, slot) values (?, ?, ?, ?);", row)
+ sisyphusdb.cursor().execute(
+ "insert into local_packages (category, name, version, slot) values (?, ?, ?, ?);", row)
sisyphusdb.commit()
sisyphusdb.close()
-
diff --git a/src/backend/syncenv.py b/src/backend/syncenv.py
index 5c07c3a..5a571c8 100644
--- a/src/backend/syncenv.py
+++ b/src/backend/syncenv.py
@@ -7,42 +7,57 @@ import sisyphus.getfs
def gentooRepo():
os.chdir(sisyphus.getfs.gentooRepoDir)
- localBranch = subprocess.check_output(['git', 'rev-parse', '--abbrev-ref', 'HEAD'])
- remoteBranch = subprocess.check_output(['git', 'rev-parse', '--symbolic-full-name', '@{u}'])
+ localBranch = subprocess.check_output(
+ ['git', 'rev-parse', '--abbrev-ref', 'HEAD'])
+ remoteBranch = subprocess.check_output(
+ ['git', 'rev-parse', '--symbolic-full-name', '@{u}'])
- gitExecStage1 = subprocess.Popen(['git', 'fetch', '--depth=1', 'origin'] + localBranch.decode().strip().split() + ['--quiet'], stdout=subprocess.PIPE)
+ gitExecStage1 = subprocess.Popen(['git', 'fetch', '--depth=1', 'origin'] +
+ localBranch.decode().strip().split() + ['--quiet'], stdout=subprocess.PIPE)
gitExecStage1.wait()
- gitExecStage2 = subprocess.Popen(['git', 'reset', '--hard'] + remoteBranch.decode().strip().replace('refs/remotes/','').split() + ['--quiet'], stdout=subprocess.PIPE)
+ gitExecStage2 = subprocess.Popen(['git', 'reset', '--hard'] + remoteBranch.decode(
+ ).strip().replace('refs/remotes/', '').split() + ['--quiet'], stdout=subprocess.PIPE)
gitExecStage2.wait()
def redcoreRepo():
os.chdir(sisyphus.getfs.redcoreRepoDir)
- localBranch = subprocess.check_output(['git', 'rev-parse', '--abbrev-ref', 'HEAD'])
- remoteBranch = subprocess.check_output(['git', 'rev-parse', '--symbolic-full-name', '@{u}'])
+ localBranch = subprocess.check_output(
+ ['git', 'rev-parse', '--abbrev-ref', 'HEAD'])
+ remoteBranch = subprocess.check_output(
+ ['git', 'rev-parse', '--symbolic-full-name', '@{u}'])
- gitExecStage1 = subprocess.Popen(['git', 'fetch', '--depth=1', 'origin'] + localBranch.decode().strip().split() + ['--quiet'], stdout=subprocess.PIPE)
+ gitExecStage1 = subprocess.Popen(['git', 'fetch', '--depth=1', 'origin'] +
+ localBranch.decode().strip().split() + ['--quiet'], stdout=subprocess.PIPE)
gitExecStage1.wait()
- gitExecStage2 = subprocess.Popen(['git', 'reset', '--hard'] + remoteBranch.decode().strip().replace('refs/remotes/','').split() + ['--quiet'], stdout=subprocess.PIPE)
+ gitExecStage2 = subprocess.Popen(['git', 'reset', '--hard'] + remoteBranch.decode(
+ ).strip().replace('refs/remotes/', '').split() + ['--quiet'], stdout=subprocess.PIPE)
gitExecStage2.wait()
def portageConfigRepo():
os.chdir(sisyphus.getfs.portageConfigDir)
- localBranch = subprocess.check_output(['git', 'rev-parse', '--abbrev-ref', 'HEAD'])
- remoteBranch = subprocess.check_output(['git', 'rev-parse', '--symbolic-full-name', '@{u}'])
+ localBranch = subprocess.check_output(
+ ['git', 'rev-parse', '--abbrev-ref', 'HEAD'])
+ remoteBranch = subprocess.check_output(
+ ['git', 'rev-parse', '--symbolic-full-name', '@{u}'])
gitExecStage1 = subprocess.Popen(['git', 'stash'], stdout=subprocess.PIPE)
gitExecStage1.wait()
- gitExecStage2 = subprocess.Popen(['git', 'fetch', '--depth=1', 'origin'] + localBranch.decode().strip().split() + ['--quiet'], stdout=subprocess.PIPE)
+ gitExecStage2 = subprocess.Popen(['git', 'fetch', '--depth=1', 'origin'] +
+ localBranch.decode().strip().split() + ['--quiet'], stdout=subprocess.PIPE)
gitExecStage2.wait()
- gitExecStage3 = subprocess.Popen(['git', 'reset', '--hard'] + remoteBranch.decode().strip().replace('refs/remotes/','').split() + ['--quiet'], stdout=subprocess.PIPE)
+ gitExecStage3 = subprocess.Popen(['git', 'reset', '--hard'] + remoteBranch.decode(
+ ).strip().replace('refs/remotes/', '').split() + ['--quiet'], stdout=subprocess.PIPE)
gitExecStage3.wait()
- gitExecStage4 = subprocess.Popen(['git', 'stash', 'apply'], stdout=subprocess.PIPE)
+ gitExecStage4 = subprocess.Popen(
+ ['git', 'stash', 'apply'], stdout=subprocess.PIPE)
gitExecStage4.wait()
- gitExecStage5 = subprocess.Popen(['git', 'stash', 'clear'], stdout=subprocess.PIPE)
+ gitExecStage5 = subprocess.Popen(
+ ['git', 'stash', 'clear'], stdout=subprocess.PIPE)
gitExecStage5.wait()
- gitExecStage6 = subprocess.Popen(['git', 'gc', '--prune=now', '--quiet'], stdout=subprocess.PIPE)
+ gitExecStage6 = subprocess.Popen(
+ ['git', 'gc', '--prune=now', '--quiet'], stdout=subprocess.PIPE)
gitExecStage6.wait()
diff --git a/src/backend/sysinfo.py b/src/backend/sysinfo.py
index 3c3af70..48b5634 100644
--- a/src/backend/sysinfo.py
+++ b/src/backend/sysinfo.py
@@ -5,4 +5,3 @@ import subprocess
def show():
subprocess.call(['emerge', '--info'])
-
diff --git a/src/backend/uninstall.py b/src/backend/uninstall.py
index 0c22182..77fa479 100644
--- a/src/backend/uninstall.py
+++ b/src/backend/uninstall.py
@@ -5,30 +5,38 @@ import io
import subprocess
import sys
import sisyphus.checkenv
+import sisyphus.getcolor
import sisyphus.killemerge
import sisyphus.syncdb
def start(pkgname):
if sisyphus.checkenv.root():
- portageExec = subprocess.Popen(['emerge', '--quiet', '--depclean', '--ask'] + list(pkgname))
+ portageExec = subprocess.Popen(
+ ['emerge', '--quiet', '--depclean', '--ask'] + list(pkgname))
portageExec.wait()
sisyphus.syncdb.localTable()
else:
- sys.exit("\nYou need root permissions to do this, exiting!\n")
+ print(sisyphus.getcolor.bright_red +
+ "\nYou need root permissions to do this!\n" + sisyphus.getcolor.reset)
+ sys.exit()
def fstart(pkgname):
if sisyphus.checkenv.root():
- portageExec = subprocess.Popen(['emerge', '--quiet', '--unmerge', '--ask'] + list(pkgname))
+ portageExec = subprocess.Popen(
+ ['emerge', '--quiet', '--unmerge', '--ask'] + list(pkgname))
portageExec.wait()
sisyphus.syncdb.localTable()
else:
- sys.exit("\nYou need root permissions to do this, exiting!\n")
+ print(sisyphus.getcolor.bright_red +
+ "\nYou need root permissions to do this!\n" + sisyphus.getcolor.reset)
+ sys.exit()
def xstart(pkgname):
- portageExec = subprocess.Popen(['emerge', '--depclean'] + pkgname, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ portageExec = subprocess.Popen(
+ ['emerge', '--depclean'] + pkgname, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
# kill portage if the program dies or it's terminated by the user
atexit.register(sisyphus.killemerge.start, portageExec)
diff --git a/src/backend/update.py b/src/backend/update.py
index a60c597..856ecd0 100644
--- a/src/backend/update.py
+++ b/src/backend/update.py
@@ -4,6 +4,7 @@ import animation
import sys
import time
import sisyphus.checkenv
+import sisyphus.getcolor
import sisyphus.getenv
import sisyphus.purgeenv
import sisyphus.syncdb
@@ -28,10 +29,13 @@ def start():
syncAll()
else:
if "packages-next" in binhostURL:
- print("\nCurrent branch: '" + activeBranch + "' (stable)" + "\nCurrent binhost: '" + binhostURL + "' (testing)")
+ print(sisyphus.getcolor.green + "\n\nActive branch:" + " " + sisyphus.getcolor.reset + "'" + activeBranch + "'" + " " + "(stable)" +
+ " " + sisyphus.getcolor.green + "\nActive binhost:" + " " + sisyphus.getcolor.reset + "'" + binhostURL + "'" + " " + "(testing)")
else:
- print("\nCurrent branch: '" + activeBranch + "' (testing)" + "\nCurrent binhost: '" + binhostURL + "' (stable)")
- sys.exit("\nInvalid branch - binhost pairing; Use 'sisyphus branch --help' for help; Quitting.")
+ print(sisyphus.getcolor.green + "\n\nActive branch:" + " " + sisyphus.getcolor.reset + "'" + activeBranch + "'" + " " + "(testing)" +
+ " " + sisyphus.getcolor.green + "\nActive binhost:" + " " + sisyphus.getcolor.reset + "'" + binhostURL + "'" + " " + "(stable)")
+ sys.exit(sisyphus.getcolor.bright_red + "\n\nInvalid configuration!" + sisyphus.getcolor.reset + sisyphus.getcolor.bright_yellow +
+ "\nUse" + sisyphus.getcolor.reset + " " + "'" + "sisyphus branch --help" + "'" + " " + sisyphus.getcolor.bright_yellow + "for help" + sisyphus.getcolor.reset)
def xstart():
@@ -43,10 +47,13 @@ def xstart():
syncAll()
else:
if "packages-next" in binhostURL:
- print("\nCurrent branch: '" + activeBranch + "' (stable)" + "\nCurrent binhost: '" + binhostURL + "' (testing)")
+ print("\n\nActive branch:" + " " + "'" + activeBranch + "'" + " " + "(stable)" +
+ "\nActive binhost:" + " " + "'" + binhostURL + "'" + " " + "(testing)")
else:
- print("\nCurrent branch: '" + activeBranch + "' (testing)" + "\nCurrent binhost: '" + binhostURL + "' (stable)")
- print("\nInvalid branch - binhost pairing; Use 'sisyphus branch --help' for help; Quitting in 10 seconds.\n")
+ print("\n\nActive branch:" + " " + "'" + activeBranch + "'" + " " + "(testing)" +
+ "\nActive binhost:" + " " + "'" + binhostURL + "'" + " " + "(stable)")
+ print("\n\nInvalid configuration!" +
+ "\nUse 'sisyphus branch --help' for help\n")
t = int(10)
while t:
mins, secs = divmod(t, 60)
@@ -54,5 +61,4 @@ def xstart():
print(timer, end="\r")
time.sleep(1)
t -= 1
-
sys.exit()
diff --git a/src/backend/upgrade.py b/src/backend/upgrade.py
index f0468ed..346ba2b 100644
--- a/src/backend/upgrade.py
+++ b/src/backend/upgrade.py
@@ -8,6 +8,7 @@ import subprocess
import sys
import sisyphus.checkenv
import sisyphus.download
+import sisyphus.getcolor
import sisyphus.getfs
import sisyphus.killemerge
import sisyphus.solvedeps
@@ -19,82 +20,123 @@ def start():
if sisyphus.checkenv.root():
sisyphus.update.start()
sisyphus.solvedeps.world()
- areBinaries,areSources,needsConfig = pickle.load(open(os.path.join(sisyphus.getfs.portageMetadataDir, "sisyphus_worlddeps.pickle"), "rb"))
+ areBinaries, areSources, needsConfig = pickle.load(open(os.path.join(
+ sisyphus.getfs.portageMetadataDir, "sisyphus_worlddeps.pickle"), "rb"))
if needsConfig == 0:
if len(areSources) == 0:
if not len(areBinaries) == 0:
os.chdir(sisyphus.getfs.portageCacheDir)
- print("\n" + "These are the binary packages that would be merged, in order:" + "\n\n" + ", ".join(areBinaries) + "\n\n" + "Total:" + " " + str(len(areBinaries)) + " " + "binary package(s)" + "\n")
- if input("Would you like to proceed?" + " " + "[y/N]" + " ").lower().strip()[:1] == "y":
+ print("\n" + sisyphus.getcolor.green + "These are the binary packages that would be merged, in order:" + sisyphus.getcolor.reset + "\n\n" + sisyphus.getcolor.magenta + ", ".join(
+ areBinaries) + sisyphus.getcolor.reset + "\n\n" + sisyphus.getcolor.bright_white + "Total:" + " " + str(len(areBinaries)) + " " + "binary package(s)" + sisyphus.getcolor.reset + "\n")
+ if input(sisyphus.getcolor.bright_white + "Would you like to proceed?" + sisyphus.getcolor.reset + " " + "[" + sisyphus.getcolor.bright_green + "y" + sisyphus.getcolor.reset + "/" + sisyphus.getcolor.bright_red + "N" + sisyphus.getcolor.reset + "]" + " ").lower().strip()[:1] == "y":
sisyphus.download.world()
- portageExec = subprocess.Popen(['emerge', '--quiet', '--verbose', '--update', '--deep', '--newuse', '--usepkg', '--usepkgonly', '--rebuilt-binaries', '--backtrack=100', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n', '@world'])
+ portageExec = subprocess.Popen(['emerge', '--quiet', '--verbose', '--update', '--deep', '--newuse', '--usepkg', '--usepkgonly',
+ '--rebuilt-binaries', '--backtrack=100', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n', '@world'])
portageExec.wait()
sisyphus.syncdb.localTable()
else:
- sys.exit("\n" + "Ok; Quitting." + "\n")
+ print(sisyphus.getcolor.bright_green +
+ "\nOk!\n" + sisyphus.getcolor.reset)
+ sys.exit()
else:
- sys.exit("\n" + "No package upgrades found; Quitting." + "\n")
+ print(sisyphus.getcolor.bright_red +
+ "\nNo package found!\n" + sisyphus.getcolor.reset)
+ sys.exit()
else:
- sys.exit("\n" + "Source package(s) found in the mix;" + " " + "Use" + " " + "'" + "sisyphus upgrade --ebuild" + "'" + ";" + " " + "Quitting." + "\n")
+ print(sisyphus.getcolor.bright_red +
+ "\nSource package(s) found in the mix!\n" + sisyphus.getcolor.reset)
+ print(sisyphus.getcolor.bright_yellow + "Use" + sisyphus.getcolor.reset + " " + "'" +
+ "sisyphus install" + " " + " ".join(pkgname) + " " + "--ebuild" + "'" + sisyphus.getcolor.reset)
+ sys.exit()
else:
# don't silently fail if a source package requested without the --ebuild option needs a keyword, mask, REQUIRED_USE or USE change
- sys.exit("\n" + "Invalid request;" " " + "Use" + " " + "'" + "sisyphus upgrade --ebuild" + "'" + ";" + " " + "Quitting." + "\n")
+ print(sisyphus.getcolor.bright_red +
+ "\nInvalid request!\n" + sisyphus.getcolor.reset)
+ print(sisyphus.getcolor.bright_yellow + "Use" + sisyphus.getcolor.reset + " " + "'" +
+ "sisyphus install" + " " + " ".join(pkgname) + " " + "--ebuild" + "'" + sisyphus.getcolor.reset)
+ sys.exit()
else:
- sys.exit("\nYou need root permissions to do this, exiting!\n")
+ print(sisyphus.getcolor.bright_red +
+ "\nYou need root permissions to do this!\n" + sisyphus.getcolor.reset)
+ sys.exit()
def estart():
if sisyphus.checkenv.root():
sisyphus.update.start()
sisyphus.solvedeps.world()
- areBinaries,areSources,needsConfig = pickle.load(open(os.path.join(sisyphus.getfs.portageMetadataDir, "sisyphus_worlddeps.pickle"), "rb"))
+ areBinaries, areSources, needsConfig = pickle.load(open(os.path.join(
+ sisyphus.getfs.portageMetadataDir, "sisyphus_worlddeps.pickle"), "rb"))
if needsConfig == 0:
if len(areSources) == 0:
if not len(areBinaries) == 0:
os.chdir(sisyphus.getfs.portageCacheDir)
- print("\n" + "These are the binary packages that would be merged, in order:" + "\n\n" + ", ".join(areBinaries) + "\n\n" + "Total:" + " " + str(len(areBinaries)) + " " + "binary package(s)" + "\n")
- if input("Would you like to proceed?" + " " + "[y/N]" + " ").lower().strip()[:1] == "y":
+ print("\n" + sisyphus.getcolor.green + "These are the binary packages that would be merged, in order:" + sisyphus.getcolor.reset + "\n\n" + sisyphus.getcolor.magenta + ", ".join(
+ areBinaries) + sisyphus.getcolor.reset + "\n\n" + sisyphus.getcolor.bright_white + "Total:" + " " + str(len(areBinaries)) + " " + "binary package(s)" + sisyphus.getcolor.reset + "\n")
+ if input(sisyphus.getcolor.bright_white + "Would you like to proceed?" + sisyphus.getcolor.reset + " " + "[" + sisyphus.getcolor.bright_green + "y" + sisyphus.getcolor.reset + "/" + sisyphus.getcolor.bright_red + "N" + sisyphus.getcolor.reset + "]" + " ").lower().strip()[:1] == "y":
sisyphus.download.world()
- portageExec = subprocess.Popen(['emerge', '--quiet', '--verbose', '--update', '--deep', '--newuse', '--usepkg', '--usepkgonly', '--rebuilt-binaries', '--backtrack=100', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n', '@world'])
+ portageExec = subprocess.Popen(['emerge', '--quiet', '--verbose', '--update', '--deep', '--newuse', '--usepkg', '--usepkgonly',
+ '--rebuilt-binaries', '--backtrack=100', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n', '@world'])
portageExec.wait()
sisyphus.syncdb.localTable()
else:
- sys.exit("\n" + "Ok; Quitting." + "\n")
+ print(sisyphus.getcolor.bright_green +
+ "\nOk!\n" + sisyphus.getcolor.reset)
+ sys.exit()
else:
- sys.exit("\n" + "No package upgrades found; Quitting." + "\n")
+ print(sisyphus.getcolor.bright_red +
+ "\nNo package found!\n" + sisyphus.getcolor.reset)
+ sys.exit()
else:
if not len(areBinaries) == 0:
os.chdir(sisyphus.getfs.portageCacheDir)
- print("\n" + "These are the binary packages that would be merged, in order:" + "\n\n" + ", ".join(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" + ", ".join(areSources) + "\n\n" + "Total:" + " " + str(len(areSources)) + " " + "source package(s)" + "\n")
- if input("Would you like to proceed?" + " " + "[y/N]" + " ").lower().strip()[:1] == "y":
+ print("\n" + sisyphus.getcolor.green + "These are the binary packages that would be merged, in order:" + sisyphus.getcolor.reset + "\n\n" + sisyphus.getcolor.magenta + ", ".join(
+ areBinaries) + sisyphus.getcolor.reset + "\n\n" + sisyphus.getcolor.bright_white + "Total:" + " " + str(len(areBinaries)) + " " + "binary package(s)" + sisyphus.getcolor.reset + "\n")
+ print("\n" + sisyphus.getcolor.green + "These are the source packages that would be merged, in order:" + sisyphus.getcolor.reset + "\n\n" + sisyphus.getcolor.magenta + ", ".join(
+ areSources) + sisyphus.getcolor.reset + "\n\n" + sisyphus.getcolor.bright_white + "Total:" + " " + str(len(areSources)) + " " + "source package(s)" + sisyphus.getcolor.reset + "\n")
+ if input(sisyphus.getcolor.bright_white + "Would you like to proceed?" + sisyphus.getcolor.reset + " " + "[" + sisyphus.getcolor.bright_green + "y" + sisyphus.getcolor.reset + "/" + sisyphus.getcolor.bright_red + "N" + sisyphus.getcolor.reset + "]" + " ").lower().strip()[:1] == "y":
sisyphus.download.world()
- portageExec = subprocess.Popen(['emerge', '--quiet', '--verbose', '--update', '--deep', '--newuse', '--usepkg', '--rebuilt-binaries', '--backtrack=100', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n', '@world'])
+ portageExec = subprocess.Popen(['emerge', '--quiet', '--verbose', '--update', '--deep', '--newuse', '--usepkg',
+ '--rebuilt-binaries', '--backtrack=100', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n', '@world'])
portageExec.wait()
sisyphus.syncdb.localTable()
else:
- sys.exit("\n" + "Ok; Quitting." + "\n")
+ print(sisyphus.getcolor.bright_green +
+ "\nOk!\n" + sisyphus.getcolor.reset)
+ sys.exit()
else:
- print("\n" + "These are the source packages that would be merged, in order:" + "\n\n" + ", ".join(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', '--quiet', '--verbose', '--update', '--deep', '--newuse', '--backtrack=100', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n', '@world'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ print("\n" + sisyphus.getcolor.green + "These are the source packages that would be merged, in order:" + sisyphus.getcolor.reset + "\n\n" + sisyphus.getcolor.magenta + ", ".join(
+ areSources) + sisyphus.getcolor.reset + "\n\n" + sisyphus.getcolor.bright_white + "Total:" + " " + str(len(areSources)) + " " + "source package(s)" + sisyphus.getcolor.reset + "\n")
+ if input(sisyphus.getcolor.bright_white + "Would you like to proceed?" + sisyphus.getcolor.reset + " " + "[" + sisyphus.getcolor.bright_green + "y" + sisyphus.getcolor.reset + "/" + sisyphus.getcolor.bright_red + "N" + sisyphus.getcolor.reset + "]" + " ").lower().strip()[:1] == "y":
+ portageExec = subprocess.Popen(['emerge', '--quiet', '--verbose', '--update', '--deep', '--newuse', '--backtrack=100',
+ '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n', '@world'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
portageExec.wait()
sisyphus.syncdb.localTable()
else:
- sys.exit("\n" + "Ok; Quitting." + "\n")
+ print(sisyphus.getcolor.bright_green +
+ "\nOk!\n" + sisyphus.getcolor.reset)
+ sys.exit()
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'])
+ portageExec = subprocess.Popen(['emerge', '--quiet', '--update', '--deep', '--newuse', '--pretend', '--getbinpkg',
+ '--rebuilt-binaries', '--backtrack=100', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n', '@world'])
portageExec.wait()
- sys.exit("\n" + "Cannot proceed; Apply the above changes to your portage configuration files and try again; Quitting." + "\n")
+ print(sisyphus.getcolor.bright_red +
+ "\nCannot proceed!\n" + sisyphus.getcolor.reset)
+ print(sisyphus.getcolor.bright_yellow +
+ "Apply the above changes to your portage configuration files and try again" + sisyphus.getcolor.reset)
+ sys.exit()
else:
- sys.exit("\nYou need root permissions to do this, exiting!\n")
+ print(sisyphus.getcolor.bright_red +
+ "\nYou need root permissions to do this!\n" + sisyphus.getcolor.reset)
+ sys.exit()
def xstart():
- sisyphus.solvedeps.world.__wrapped__() #undecorate
- areBinaries,areSources,needsConfig = pickle.load(open(os.path.join(sisyphus.getfs.portageMetadataDir, "sisyphus_worlddeps.pickle"), "rb"))
+ sisyphus.solvedeps.world.__wrapped__() # undecorate
+ areBinaries, areSources, needsConfig = pickle.load(open(os.path.join(
+ sisyphus.getfs.portageMetadataDir, "sisyphus_worlddeps.pickle"), "rb"))
if not len(areSources) == 0:
print("\n" + "Source package(s) found in the mix;" + " " + "Use sisyphus CLI:" + " " + "'" + "sisyphus upgrade --ebuild" + "'" + " " + "to perform the upgrade;" + " " + "Aborting." + "\n")
@@ -103,7 +145,8 @@ def xstart():
os.chdir(sisyphus.getfs.portageCacheDir)
print("\n" + "These are the binary packages that will be merged, in order:" + "\n\n" + ", ".join(areBinaries) + "\n\n" + "Total:" + " " + str(len(areBinaries)) + " " + "binary package(s)" + "\n\n")
sisyphus.download.world()
- portageExec = subprocess.Popen(['emerge', '--quiet', '--verbose', '--update', '--deep', '--newuse', '--usepkg', '--usepkgonly', '--rebuilt-binaries', '--backtrack=100', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n', '@world'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ portageExec = subprocess.Popen(['emerge', '--quiet', '--verbose', '--update', '--deep', '--newuse', '--usepkg', '--usepkgonly', '--rebuilt-binaries',
+ '--backtrack=100', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n', '@world'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
# kill portage if the program dies or it's terminated by the user
atexit.register(sisyphus.killemerge.start, portageExec)
@@ -113,4 +156,4 @@ def xstart():
portageExec.wait()
sisyphus.syncdb.localTable()
else:
- print("\n" + "No package upgrades found; Quitting." + "\n")
+ print("\nNo package upgrades found!\n")