summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2022-10-30 20:02:58 +0000
committerV3n3RiX <venerix@koprulu.sector>2022-10-30 20:02:58 +0000
commit206c993e45c39e60eceae1f66c69d39903ab9266 (patch)
tree96e15cacf4f5ad804fb97f0fb37584c6d064acfd /src
parent80d633d0738461d7715e5051ab7f3248068fa87e (diff)
space functions a bit
Diffstat (limited to 'src')
-rw-r--r--src/backend/autoremove.py2
-rw-r--r--src/backend/checkenv.py5
-rw-r--r--src/backend/getenv.py2
-rw-r--r--src/backend/install.py11
-rw-r--r--src/backend/purgeenv.py3
-rw-r--r--src/backend/recoverdb.py1
-rw-r--r--src/backend/search.py5
-rw-r--r--src/backend/setbranch.py6
-rw-r--r--src/backend/setjobs.py1
-rw-r--r--src/backend/setprofile.py1
-rw-r--r--src/backend/solvedeps.py2
-rw-r--r--src/backend/syncdb.py4
-rw-r--r--src/backend/syncenv.py3
-rw-r--r--src/backend/syncspm.py1
-rw-r--r--src/backend/sysinfo.py1
-rw-r--r--src/backend/uninstall.py3
-rw-r--r--src/backend/update.py3
-rw-r--r--src/backend/upgrade.py11
18 files changed, 56 insertions, 9 deletions
diff --git a/src/backend/autoremove.py b/src/backend/autoremove.py
index 28d4f31..c49787e 100644
--- a/src/backend/autoremove.py
+++ b/src/backend/autoremove.py
@@ -8,6 +8,7 @@ import sisyphus.checkenv
import sisyphus.killemerge
import sisyphus.syncdb
+
def start():
if sisyphus.checkenv.root():
portageExec = subprocess.Popen(['emerge', '--quiet', '--depclean', '--ask'])
@@ -16,6 +17,7 @@ def start():
else:
sys.exit("\nYou need root permissions to do this, exiting!\n")
+
def startx():
portageExec = subprocess.Popen(['emerge', '--depclean'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
# kill portage if the program dies or it's terminated by the user
diff --git a/src/backend/checkenv.py b/src/backend/checkenv.py
index 053fc52..1bf0b52 100644
--- a/src/backend/checkenv.py
+++ b/src/backend/checkenv.py
@@ -5,9 +5,11 @@ import subprocess
import sisyphus.getenv
import sisyphus.getfs
+
def root():
return True if os.getuid() == 0 else False
+
def branch():
activeBranch = None
@@ -21,7 +23,8 @@ def branch():
if localBranch.decode().strip() == 'next':
activeBranch = str('next')
- return activeBranch
+ return activeBranch
+
def sanity():
activeBranch = branch()
diff --git a/src/backend/getenv.py b/src/backend/getenv.py
index 5edd038..c98d3c8 100644
--- a/src/backend/getenv.py
+++ b/src/backend/getenv.py
@@ -3,6 +3,7 @@
import io
import subprocess
+
def binhostURL():
binhostURL = []
portageExec = subprocess.Popen(['emerge', '--info', '--verbose'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
@@ -14,6 +15,7 @@ def binhostURL():
portageExec.wait()
return binhostURL
+
def csvURL():
csvURL = binhostURL()
packagesCsvURL = []
diff --git a/src/backend/install.py b/src/backend/install.py
index 1b54089..6883940 100644
--- a/src/backend/install.py
+++ b/src/backend/install.py
@@ -15,6 +15,7 @@ import sisyphus.solvedeps
import sisyphus.syncdb
import sisyphus.update
+
def start(pkgname):
if sisyphus.checkenv.root():
sisyphus.update.start()
@@ -31,7 +32,7 @@ def start(pkgname):
for index, binary in enumerate([package + '.tbz2' for package in areBinaries], start=1):
print(">>> Downloading binary ({}".format(index) + " " + "of" + " " + str(len(areBinaries)) + ")" + " " + binary)
wget.download(binhostURL + binary)
- print("\n")
+ 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])))
@@ -57,6 +58,7 @@ def start(pkgname):
else:
sys.exit("\nYou need root permissions to do this, exiting!\n")
+
def estart(pkgname):
if sisyphus.checkenv.root():
sisyphus.update.start()
@@ -73,7 +75,7 @@ def estart(pkgname):
for index, binary in enumerate([package + '.tbz2' for package in areBinaries], start=1):
print(">>> Downloading binary ({}".format(index) + " " + "of" + " " + str(len(areBinaries)) + ")" + " " + binary)
wget.download(binhostURL + binary)
- print("\n")
+ 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])))
@@ -100,7 +102,7 @@ def estart(pkgname):
for index, binary in enumerate([package + '.tbz2' for package in areBinaries], start=1):
print(">>> Downloading binary ({}".format(index) + " " + "of" + " " + str(len(areBinaries)) + ")" + " " + binary)
wget.download(binhostURL + binary)
- print("\n")
+ 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])))
@@ -131,6 +133,7 @@ def estart(pkgname):
else:
sys.exit("\nYou need root permissions to do this, exiting!\n")
+
def startx(pkgname):
binhostURL = sisyphus.getenv.binhostURL()
areBinaries,areSources,needsConfig = sisyphus.solvedeps.package.__wrapped__(pkgname) #undecorate
@@ -140,7 +143,7 @@ def startx(pkgname):
for index, binary in enumerate([package + '.tbz2' for package in areBinaries], start=1):
print(">>> Downloading binary ({}".format(index) + " " + "of" + " " + str(len(areBinaries)) + ")" + " " + binary)
wget.download(binhostURL + binary)
- print("\n")
+ 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])))
diff --git a/src/backend/purgeenv.py b/src/backend/purgeenv.py
index b5424a6..ff009e7 100644
--- a/src/backend/purgeenv.py
+++ b/src/backend/purgeenv.py
@@ -5,6 +5,7 @@ import os
import shutil
import sisyphus.getfs
+
@animation.wait('purging branch configuration')
def branch():
if os.path.isdir(sisyphus.getfs.gentooRepoDir):
@@ -34,6 +35,7 @@ def branch():
else:
os.makedirs(sisyphus.getfs.portageConfigDir)
+
def cache():
if os.path.isdir(sisyphus.getfs.portageCacheDir):
for files in os.listdir(sisyphus.getfs.portageCacheDir):
@@ -42,6 +44,7 @@ def cache():
else:
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):
diff --git a/src/backend/recoverdb.py b/src/backend/recoverdb.py
index c19cddc..6aff890 100644
--- a/src/backend/recoverdb.py
+++ b/src/backend/recoverdb.py
@@ -5,6 +5,7 @@ import os
import sisyphus.getfs
import sisyphus.syncdb
+
@animation.wait('recovering databases')
def start():
if os.path.exists(sisyphus.getfs.remotePackagesCsv):
diff --git a/src/backend/search.py b/src/backend/search.py
index d718c7e..e68cd2d 100644
--- a/src/backend/search.py
+++ b/src/backend/search.py
@@ -6,6 +6,7 @@ import sisyphus.checkenv
import sisyphus.getfs
import sisyphus.update
+
def searchDB(filter, cat = '', pn = '', desc = ''):
NOVIRT = "AND cat NOT LIKE 'virtual'"
SELECTS = {
@@ -99,9 +100,11 @@ def searchDB(filter, cat = '', pn = '', desc = ''):
return rows
+
def tosql(string):
return '%%' if string == '' else string.replace('*', '%').replace('?', '_')
+
def showSearch(filter, cat, pn, desc, single):
print(f"Searching {filter} packages ... \n")
pkglist = searchDB(filter, tosql(cat), tosql(pn), tosql(desc))
@@ -125,6 +128,7 @@ def showSearch(filter, cat, pn, desc, single):
print(f"{cpn:45} {str(pkg['iv']):20} {str(pkg['av'])}")
print(f"\nFound {len(pkglist)} matching package(s) ...")
+
def start(filter, cat, pn, desc, single):
if sisyphus.checkenv.root():
sisyphus.update.start()
@@ -133,5 +137,6 @@ def start(filter, cat, pn, desc, single):
showSearch(filter, cat, pn, desc, single)
+
def estart(pkgname):
subprocess.call(['emerge', '--search', '--getbinpkg'] + list(pkgname))
diff --git a/src/backend/setbranch.py b/src/backend/setbranch.py
index 100d271..b1f42d3 100644
--- a/src/backend/setbranch.py
+++ b/src/backend/setbranch.py
@@ -10,6 +10,7 @@ import sisyphus.purgeenv
import sisyphus.setjobs
import sisyphus.setprofile
+
def getBranchRemote(branch,remote):
gentooRemote = []
redcoreRemote = []
@@ -46,6 +47,7 @@ def getBranchRemote(branch,remote):
return gentooRemote,redcoreRemote,portageConfigRemote
+
@animation.wait('injecting Gentoo Linux portage tree')
def injectGentooRepo(branch,remote):
gentooRemote,redcoreRemote,portageConfigRemote = getBranchRemote(branch,remote)
@@ -53,6 +55,7 @@ def injectGentooRepo(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)
+
@animation.wait('injecting Redcore Linux ebuild overlay')
def injectRedcoreRepo(branch,remote):
gentooRemote,redcoreRemote,portageConfigRemote = getBranchRemote(branch,remote)
@@ -60,6 +63,7 @@ def injectRedcoreRepo(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)
+
@animation.wait('injecting Redcore Linux portage config')
def injectPortageConfigRepo(branch,remote):
gentooRemote,redcoreRemote,portageConfigRemote = getBranchRemote(branch,remote)
@@ -67,6 +71,7 @@ def injectPortageConfigRepo(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)
+
def giveWarning(branch,remote):
if "master" in branch:
print("\nThe switch to branch" + " " + "'" + branch + "'" + " " + "from remote" + " " + "'" + remote + "'" + " " + "is now complete")
@@ -79,6 +84,7 @@ def giveWarning(branch,remote):
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")
+
def start(branch,remote):
if sisyphus.checkenv.root():
sisyphus.purgeenv.branch()
diff --git a/src/backend/setjobs.py b/src/backend/setjobs.py
index 5a22b10..743c7e7 100644
--- a/src/backend/setjobs.py
+++ b/src/backend/setjobs.py
@@ -2,5 +2,6 @@
import subprocess
+
def start():
subprocess.call(['/usr/share/sisyphus/helpers/set_jobs'])
diff --git a/src/backend/setprofile.py b/src/backend/setprofile.py
index a5d6480..a553e95 100644
--- a/src/backend/setprofile.py
+++ b/src/backend/setprofile.py
@@ -4,6 +4,7 @@ import animation
import platform
import subprocess
+
@animation.wait('setting up profile')
def start():
if platform.uname()[4] == 'x86_64':
diff --git a/src/backend/solvedeps.py b/src/backend/solvedeps.py
index 41e9103..833f8e2 100644
--- a/src/backend/solvedeps.py
+++ b/src/backend/solvedeps.py
@@ -3,6 +3,7 @@
import animation
import subprocess
+
@animation.wait('resolving dependencies')
def package(pkgname):
areBinaries = []
@@ -35,6 +36,7 @@ def package(pkgname):
return areBinaries,areSources,needsConfig
+
@animation.wait('resolving dependencies')
def world():
areBinaries = []
diff --git a/src/backend/syncdb.py b/src/backend/syncdb.py
index b5d86ae..65812ac 100644
--- a/src/backend/syncdb.py
+++ b/src/backend/syncdb.py
@@ -8,6 +8,7 @@ import subprocess
import sisyphus.getenv
import sisyphus.getfs
+
def remoteCSV():
packagesCsvURL,descriptionsCsvURL = sisyphus.getenv.csvURL()
http = urllib3.PoolManager()
@@ -18,9 +19,11 @@ def remoteCSV():
with http.request('GET', descriptionsCsvURL, preload_content=False) as tmp_buffer, open(sisyphus.getfs.remoteDescriptionsCsv, 'wb') as output_file:
shutil.copyfileobj(tmp_buffer, output_file)
+
def localCSV():
subprocess.call(['/usr/share/sisyphus/helpers/make_local_csv'])
+
def remoteTable():
remoteCSV()
@@ -41,6 +44,7 @@ def remoteTable():
sisyphusdb.commit()
sisyphusdb.close()
+
def localTable():
localCSV()
diff --git a/src/backend/syncenv.py b/src/backend/syncenv.py
index 2b3277f..5c07c3a 100644
--- a/src/backend/syncenv.py
+++ b/src/backend/syncenv.py
@@ -4,6 +4,7 @@ import os
import subprocess
import sisyphus.getfs
+
def gentooRepo():
os.chdir(sisyphus.getfs.gentooRepoDir)
localBranch = subprocess.check_output(['git', 'rev-parse', '--abbrev-ref', 'HEAD'])
@@ -15,6 +16,7 @@ def gentooRepo():
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'])
@@ -26,6 +28,7 @@ def redcoreRepo():
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'])
diff --git a/src/backend/syncspm.py b/src/backend/syncspm.py
index 9ea598d..abe6f90 100644
--- a/src/backend/syncspm.py
+++ b/src/backend/syncspm.py
@@ -3,6 +3,7 @@
import animation
import sisyphus.syncdb
+
@animation.wait('syncing spm changes')
def start():
sisyphus.syncdb.localTable()
diff --git a/src/backend/sysinfo.py b/src/backend/sysinfo.py
index 5ae29c2..3c3af70 100644
--- a/src/backend/sysinfo.py
+++ b/src/backend/sysinfo.py
@@ -2,6 +2,7 @@
import subprocess
+
def show():
subprocess.call(['emerge', '--info'])
diff --git a/src/backend/uninstall.py b/src/backend/uninstall.py
index d219b47..be1a1e3 100644
--- a/src/backend/uninstall.py
+++ b/src/backend/uninstall.py
@@ -8,6 +8,7 @@ import sisyphus.checkenv
import sisyphus.killemerge
import sisyphus.syncdb
+
def start(pkgname):
if sisyphus.checkenv.root():
portageExec = subprocess.Popen(['emerge', '--quiet', '--depclean', '--ask'] + list(pkgname))
@@ -16,6 +17,7 @@ def start(pkgname):
else:
sys.exit("\nYou need root permissions to do this, exiting!\n")
+
def fstart(pkgname):
if sisyphus.checkenv.root():
portageExec = subprocess.Popen(['emerge', '--quiet', '--unmerge', '--ask'] + list(pkgname))
@@ -24,6 +26,7 @@ def fstart(pkgname):
else:
sys.exit("\nYou need root permissions to do this, exiting!\n")
+
def startx(pkgname):
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
diff --git a/src/backend/update.py b/src/backend/update.py
index acbc445..d6d944e 100644
--- a/src/backend/update.py
+++ b/src/backend/update.py
@@ -9,6 +9,7 @@ import sisyphus.purgeenv
import sisyphus.syncdb
import sisyphus.syncenv
+
def syncAll():
sisyphus.purgeenv.cache()
sisyphus.syncenv.gentooRepo()
@@ -16,6 +17,7 @@ def syncAll():
sisyphus.syncenv.portageConfigRepo()
sisyphus.syncdb.remoteTable()
+
@animation.wait('fetching updates')
def start():
activeBranch = sisyphus.checkenv.branch()
@@ -31,6 +33,7 @@ def start():
print("\nCurrent branch: '" + activeBranch + "' (testing)" + "\nCurrent binhost: '" + binhostURL + "' (stable)")
sys.exit("\nInvalid branch - binhost pairing; Use 'sisyphus branch --help' for help; Quitting.")
+
def startx():
activeBranch = sisyphus.checkenv.branch()
binhostURL = sisyphus.getenv.binhostURL()
diff --git a/src/backend/upgrade.py b/src/backend/upgrade.py
index fe0d74d..aa920dd 100644
--- a/src/backend/upgrade.py
+++ b/src/backend/upgrade.py
@@ -15,6 +15,7 @@ import sisyphus.solvedeps
import sisyphus.syncdb
import sisyphus.update
+
def start():
if sisyphus.checkenv.root():
sisyphus.update.start()
@@ -31,7 +32,7 @@ def start():
for index, binary in enumerate([package + '.tbz2' for package in areBinaries], start=1):
print(">>> Downloading binary ({}".format(index) + " " + "of" + " " + str(len(areBinaries)) + ")" + " " + binary)
wget.download(binhostURL + binary)
- print("\n")
+ 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])))
@@ -57,6 +58,7 @@ def start():
else:
sys.exit("\nYou need root permissions to do this, exiting!\n")
+
def estart():
if sisyphus.checkenv.root():
sisyphus.update.start()
@@ -73,7 +75,7 @@ def estart():
for index, binary in enumerate([package + '.tbz2' for package in areBinaries], start=1):
print(">>> Downloading binary ({}".format(index) + " " + "of" + " " + str(len(areBinaries)) + ")" + " " + binary)
wget.download(binhostURL + binary)
- print("\n")
+ 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])))
@@ -100,7 +102,7 @@ def estart():
for index, binary in enumerate([package + '.tbz2' for package in areBinaries], start=1):
print(">>> Downloading binary ({}".format(index) + " " + "of" + " " + str(len(areBinaries)) + ")" + " " + binary)
wget.download(binhostURL + binary)
- print("\n")
+ 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])))
@@ -131,6 +133,7 @@ def estart():
else:
sys.exit("\nYou need root permissions to do this, exiting!\n")
+
def startx():
binhostURL = sisyphus.getenv.binhostURL()
areBinaries,areSources,needsConfig = sisyphus.solvedeps.world.__wrapped__() #undecorate
@@ -144,7 +147,7 @@ def startx():
for index, binary in enumerate([package + '.tbz2' for package in areBinaries], start=1):
print(">>> Downloading binary ({}".format(index) + " " + "of" + " " + str(len(areBinaries)) + ")" + " " + binary)
wget.download(binhostURL + binary)
- print("\n")
+ 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])))