diff options
author | V3n3RiX <venerix@koprulu.sector> | 2022-09-17 19:12:53 +0100 |
---|---|---|
committer | V3n3RiX <venerix@koprulu.sector> | 2022-09-17 19:12:53 +0100 |
commit | e1562a71d6483021d332bccbfc5a3086688bc58c (patch) | |
tree | 6be3d468e0aadd6c4de6c4dbd7a58ebe9fd59cbb /src | |
parent | 0cf2c9f8ec52b1ae276c1573210d252ab0c4577b (diff) |
rearrange the backend
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/__init__.py | 52 | ||||
-rw-r--r-- | src/backend/autoRemoveAll.py (renamed from src/backend/autoremove.py) | 14 | ||||
-rw-r--r-- | src/backend/checkEnvironment.py (renamed from src/backend/check.py) | 10 | ||||
-rw-r--r-- | src/backend/getBinhost.py (renamed from src/backend/binhost.py) | 0 | ||||
-rw-r--r-- | src/backend/getCSV.py (renamed from src/backend/csvfiles.py) | 4 | ||||
-rw-r--r-- | src/backend/getFilesystem.py (renamed from src/backend/filesystem.py) | 0 | ||||
-rw-r--r-- | src/backend/installPkg.py (renamed from src/backend/install.py) | 52 | ||||
-rw-r--r-- | src/backend/installSrc.py (renamed from src/backend/ebuildinstall.py) | 46 | ||||
-rw-r--r-- | src/backend/killPortage.py (renamed from src/backend/killportage.py) | 0 | ||||
-rw-r--r-- | src/backend/purge.py | 51 | ||||
-rw-r--r-- | src/backend/purgeEnvironment.py | 51 | ||||
-rw-r--r-- | src/backend/recoverDatabase.py | 20 | ||||
-rw-r--r-- | src/backend/rescue.py | 20 | ||||
-rw-r--r-- | src/backend/resolveDeps.py (renamed from src/backend/solvedeps.py) | 0 | ||||
-rw-r--r-- | src/backend/searchPkg.py (renamed from src/backend/search.py) | 12 | ||||
-rw-r--r-- | src/backend/searchSrc.py (renamed from src/backend/ebuildsearch.py) | 0 | ||||
-rw-r--r-- | src/backend/setBranch.py (renamed from src/backend/branchsetup.py) | 62 | ||||
-rw-r--r-- | src/backend/setJobs.py (renamed from src/backend/setjobs.py) | 0 | ||||
-rw-r--r-- | src/backend/setMirror.py (renamed from src/backend/mirror.py) | 6 | ||||
-rw-r--r-- | src/backend/setProfile.py (renamed from src/backend/setprofile.py) | 0 | ||||
-rw-r--r-- | src/backend/syncDatabase.py (renamed from src/backend/database.py) | 20 | ||||
-rw-r--r-- | src/backend/syncEnvironment.py (renamed from src/backend/sync.py) | 14 | ||||
-rw-r--r-- | src/backend/syncSPM.py (renamed from src/backend/spmsync.py) | 4 | ||||
-rw-r--r-- | src/backend/sysInfo.py (renamed from src/backend/sysinfo.py) | 0 | ||||
-rw-r--r-- | src/backend/uninstallAll.py (renamed from src/backend/uninstall.py) | 14 | ||||
-rw-r--r-- | src/backend/uninstallForceAll.py (renamed from src/backend/forceuninstall.py) | 8 | ||||
-rw-r--r-- | src/backend/updateAll.py (renamed from src/backend/update.py) | 32 | ||||
-rw-r--r-- | src/backend/upgradePkg.py (renamed from src/backend/upgrade.py) | 52 | ||||
-rw-r--r-- | src/backend/upgradeSrc.py (renamed from src/backend/ebuildupgrade.py) | 46 | ||||
-rwxr-xr-x | src/frontend/cli/sisyphus-cli.py | 36 | ||||
-rw-r--r-- | src/frontend/gui/sisyphus-gui.py | 18 |
31 files changed, 322 insertions, 322 deletions
diff --git a/src/backend/__init__.py b/src/backend/__init__.py index 7833aba..bf350e1 100644 --- a/src/backend/__init__.py +++ b/src/backend/__init__.py @@ -1,26 +1,26 @@ -from .autoremove import * -from .binhost import * -from .branchsetup import * -from .check import * -from .csvfiles import * -from .database import * -from .ebuildinstall import * -from .ebuildsearch import * -from .ebuildupgrade import * -from .filesystem import * -from .forceuninstall import * -from .install import * -from .killportage import * -from .mirror import * -from .purge import * -from .rescue import * -from .search import * -from .setjobs import * -from .setprofile import * -from .solvedeps import * -from .spmsync import * -from .sync import * -from .sysinfo import * -from .uninstall import * -from .update import * -from .upgrade import * +from .autoRemoveAll import * +from .checkEnvironment import * +from .getBinhost import * +from .getCSV import * +from .getFilesystem import * +from .installPkg import * +from .installSrc import * +from .killPortage import * +from .purgeEnvironment import * +from .recoverDatabase import * +from .resolveDeps import * +from .searchPkg import * +from .searchSrc import * +from .setBranch import * +from .setJobs import * +from .setMirror import * +from .setProfile import * +from .syncDatabase import * +from .syncEnvironment import * +from .syncSPM import * +from .sysInfo import * +from .uninstallAll import * +from .uninstallForceAll import * +from .updateAll import * +from .upgradePkg import * +from .upgradeSrc import * diff --git a/src/backend/autoremove.py b/src/backend/autoRemoveAll.py index 37ae7ee..bcf5760 100644 --- a/src/backend/autoremove.py +++ b/src/backend/autoRemoveAll.py @@ -4,15 +4,15 @@ import atexit import io import subprocess import sys -import sisyphus.check -import sisyphus.database -import sisyphus.killportage +import sisyphus.checkEnvironment +import sisyphus.syncDatabase +import sisyphus.killPortage def start(): - if sisyphus.check.root(): + if sisyphus.checkEnvironment.root(): portageExec = subprocess.Popen(['emerge', '--quiet', '--depclean', '--ask'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) stdout, stderr = portageExec.communicate() - sisyphus.database.syncLocal() + sisyphus.syncDatabase.syncLocal() else: sys.exit("\nYou need root permissions to do this, exiting!\n") @@ -20,9 +20,9 @@ def startqt(): portageExec = subprocess.Popen(['emerge', '--depclean'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) stdout, stderr = portageExec.communicate() # kill portage if the program dies or it's terminated by the user - atexit.register(sisyphus.killportage.start, portageExec) + atexit.register(sisyphus.killPortage.start, portageExec) for portageOutput in io.TextIOWrapper(portageExec.stdout, encoding="utf-8"): print(portageOutput.rstrip()) - sisyphus.database.syncLocal() + sisyphus.syncDatabase.syncLocal() diff --git a/src/backend/check.py b/src/backend/checkEnvironment.py index 7f23338..5a43780 100644 --- a/src/backend/check.py +++ b/src/backend/checkEnvironment.py @@ -2,8 +2,8 @@ import os import subprocess -import sisyphus.binhost -import sisyphus.filesystem +import sisyphus.getBinhost +import sisyphus.getFilesystem def root(): return True if os.getuid() == 0 else False @@ -11,8 +11,8 @@ def root(): def branch(): activeBranch = None - if os.path.isdir(os.path.join(sisyphus.filesystem.portageRepoDir, '.git')): - os.chdir(sisyphus.filesystem.portageRepoDir) + if os.path.isdir(os.path.join(sisyphus.getFilesystem.portageRepoDir, '.git')): + os.chdir(sisyphus.getFilesystem.portageRepoDir) localBranch = subprocess.check_output(['git', 'rev-parse', '--abbrev-ref', 'HEAD']) if localBranch.decode().strip() == 'master': @@ -25,7 +25,7 @@ def branch(): def sanity(): activeBranch = branch() - isBinhost = sisyphus.binhost.start() + isBinhost = sisyphus.getBinhost.start() isSane = int() if "packages-next" in isBinhost: diff --git a/src/backend/binhost.py b/src/backend/getBinhost.py index 3de4fca..3de4fca 100644 --- a/src/backend/binhost.py +++ b/src/backend/getBinhost.py diff --git a/src/backend/csvfiles.py b/src/backend/getCSV.py index 503ee84..798f163 100644 --- a/src/backend/csvfiles.py +++ b/src/backend/getCSV.py @@ -1,11 +1,11 @@ #!/usr/bin/python3 -import sisyphus.binhost +import sisyphus.getBinhost def start(): isPackageCsv = [] isDescriptionCsv = [] - isBinhost = sisyphus.binhost.start() + isBinhost = sisyphus.getBinhost.start() if "packages-next" in isBinhost: isPackageCsv = isBinhost.replace('packages-next', 'csv-next') + 'remotePackagesPre.csv' diff --git a/src/backend/filesystem.py b/src/backend/getFilesystem.py index 4934108..4934108 100644 --- a/src/backend/filesystem.py +++ b/src/backend/getFilesystem.py diff --git a/src/backend/install.py b/src/backend/installPkg.py index c9b2d67..480e346 100644 --- a/src/backend/install.py +++ b/src/backend/installPkg.py @@ -7,25 +7,25 @@ import shutil import subprocess import sys import wget -import sisyphus.binhost -import sisyphus.check -import sisyphus.database -import sisyphus.filesystem -import sisyphus.killportage -import sisyphus.solvedeps -import sisyphus.update +import sisyphus.getBinhost +import sisyphus.checkEnvironment +import sisyphus.syncDatabase +import sisyphus.getFilesystem +import sisyphus.killPortage +import sisyphus.resolveDeps +import sisyphus.updateAll def start(pkgname): - if sisyphus.check.root(): - sisyphus.update.start() + if sisyphus.checkEnvironment.root(): + sisyphus.updateAll.start() - isBinhost = sisyphus.binhost.start() - areBinaries,areSources,needsConfig = sisyphus.solvedeps.package(pkgname) + isBinhost = sisyphus.getBinhost.start() + areBinaries,areSources,needsConfig = sisyphus.resolveDeps.package(pkgname) if needsConfig == 0: if len(areSources) == 0: if not len(areBinaries) == 0: - os.chdir(sisyphus.filesystem.portageCacheDir) + os.chdir(sisyphus.getFilesystem.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": for index, binary in enumerate([package + '.tbz2' for package in areBinaries], start=1): @@ -33,11 +33,11 @@ def start(pkgname): wget.download(isBinhost + binary) print("\n") - if os.path.isdir(os.path.join(sisyphus.filesystem.portageCacheDir, binary.rstrip().split("/")[0])): - shutil.move(binary.rstrip().split("/")[1], os.path.join(os.path.join(sisyphus.filesystem.portageCacheDir, binary.rstrip().split("/")[0]), os.path.basename(binary.rstrip().split("/")[1]))) + if os.path.isdir(os.path.join(sisyphus.getFilesystem.portageCacheDir, binary.rstrip().split("/")[0])): + shutil.move(binary.rstrip().split("/")[1], os.path.join(os.path.join(sisyphus.getFilesystem.portageCacheDir, binary.rstrip().split("/")[0]), os.path.basename(binary.rstrip().split("/")[1]))) else: - os.makedirs(os.path.join(sisyphus.filesystem.portageCacheDir, binary.rstrip().split("/")[0])) - shutil.move(binary.rstrip().split("/")[1], os.path.join(os.path.join(sisyphus.filesystem.portageCacheDir, binary.rstrip().split("/")[0]), os.path.basename(binary.rstrip().split("/")[1]))) + os.makedirs(os.path.join(sisyphus.getFilesystem.portageCacheDir, binary.rstrip().split("/")[0])) + shutil.move(binary.rstrip().split("/")[1], os.path.join(os.path.join(sisyphus.getFilesystem.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]) @@ -50,7 +50,7 @@ def start(pkgname): if not "Calculating dependencies" in portageOutput.rstrip(): print(portageOutput.rstrip()) - sisyphus.database.syncLocal() + sisyphus.syncDatabase.syncLocal() else: sys.exit("\n" + "Ok; Quitting." + "\n") else: @@ -64,21 +64,21 @@ def start(pkgname): sys.exit("\nYou need root permissions to do this, exiting!\n") def startqt(pkgname): - isBinhost = sisyphus.binhost.start() - areBinaries,areSources,needsConfig = sisyphus.solvedeps.package.__wrapped__(pkgname) #undecorate + isBinhost = sisyphus.getBinhost.start() + areBinaries,areSources,needsConfig = sisyphus.resolveDeps.package.__wrapped__(pkgname) #undecorate - os.chdir(sisyphus.filesystem.portageCacheDir) + os.chdir(sisyphus.getFilesystem.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") 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(isBinhost + binary) print("\n") - if os.path.isdir(os.path.join(sisyphus.filesystem.portageCacheDir, binary.rstrip().split("/")[0])): - shutil.move(binary.rstrip().split("/")[1], os.path.join(os.path.join(sisyphus.filesystem.portageCacheDir, binary.rstrip().split("/")[0]), os.path.basename(binary.rstrip().split("/")[1]))) + if os.path.isdir(os.path.join(sisyphus.getFilesystem.portageCacheDir, binary.rstrip().split("/")[0])): + shutil.move(binary.rstrip().split("/")[1], os.path.join(os.path.join(sisyphus.getFilesystem.portageCacheDir, binary.rstrip().split("/")[0]), os.path.basename(binary.rstrip().split("/")[1]))) else: - os.makedirs(os.path.join(sisyphus.filesystem.portageCacheDir, binary.rstrip().split("/")[0])) - shutil.move(binary.rstrip().split("/")[1], os.path.join(os.path.join(sisyphus.filesystem.portageCacheDir, binary.rstrip().split("/")[0]), os.path.basename(binary.rstrip().split("/")[1]))) + os.makedirs(os.path.join(sisyphus.getFilesystem.portageCacheDir, binary.rstrip().split("/")[0])) + shutil.move(binary.rstrip().split("/")[1], os.path.join(os.path.join(sisyphus.getFilesystem.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]) @@ -86,11 +86,11 @@ def startqt(pkgname): portageExec = subprocess.Popen(['emerge', '--usepkg', '--usepkgonly', '--rebuilt-binaries', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n'] + pkgname, stdout=subprocess.PIPE, stderr=subprocess.PIPE) stdout, stderr = portageExec.communicate() # kill portage if the program dies or it's terminated by the user - atexit.register(sisyphus.killportage.start, portageExec) + atexit.register(sisyphus.killPortage.start, portageExec) 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()) - sisyphus.database.syncLocal() + sisyphus.syncDatabase.syncLocal() diff --git a/src/backend/ebuildinstall.py b/src/backend/installSrc.py index d194ac2..5ff5958 100644 --- a/src/backend/ebuildinstall.py +++ b/src/backend/installSrc.py @@ -6,24 +6,24 @@ import shutil import subprocess import sys import wget -import sisyphus.binhost -import sisyphus.check -import sisyphus.database -import sisyphus.filesystem -import sisyphus.solvedeps -import sisyphus.update +import sisyphus.getBinhost +import sisyphus.checkEnvironment +import sisyphus.syncDatabase +import sisyphus.getFilesystem +import sisyphus.resolveDeps +import sisyphus.updateAll def start(pkgname): - if sisyphus.check.root(): - sisyphus.update.start() + if sisyphus.checkEnvironment.root(): + sisyphus.updateAll.start() - isBinhost = sisyphus.binhost.start() - areBinaries,areSources,needsConfig = sisyphus.solvedeps.package(pkgname) + isBinhost = sisyphus.getBinhost.start() + areBinaries,areSources,needsConfig = sisyphus.resolveDeps.package(pkgname) if needsConfig == 0: if len(areSources) == 0: if not len(areBinaries) == 0: - os.chdir(sisyphus.filesystem.portageCacheDir) + os.chdir(sisyphus.getFilesystem.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": for index, binary in enumerate([package + '.tbz2' for package in areBinaries], start=1): @@ -31,11 +31,11 @@ def start(pkgname): wget.download(isBinhost + binary) print("\n") - if os.path.isdir(os.path.join(sisyphus.filesystem.portageCacheDir, binary.rstrip().split("/")[0])): - shutil.move(binary.rstrip().split("/")[1], os.path.join(os.path.join(sisyphus.filesystem.portageCacheDir, binary.rstrip().split("/")[0]), os.path.basename(binary.rstrip().split("/")[1]))) + if os.path.isdir(os.path.join(sisyphus.getFilesystem.portageCacheDir, binary.rstrip().split("/")[0])): + shutil.move(binary.rstrip().split("/")[1], os.path.join(os.path.join(sisyphus.getFilesystem.portageCacheDir, binary.rstrip().split("/")[0]), os.path.basename(binary.rstrip().split("/")[1]))) else: - os.makedirs(os.path.join(sisyphus.filesystem.portageCacheDir, binary.rstrip().split("/")[0])) - shutil.move(binary.rstrip().split("/")[1], os.path.join(os.path.join(sisyphus.filesystem.portageCacheDir, binary.rstrip().split("/")[0]), os.path.basename(binary.rstrip().split("/")[1]))) + os.makedirs(os.path.join(sisyphus.getFilesystem.portageCacheDir, binary.rstrip().split("/")[0])) + shutil.move(binary.rstrip().split("/")[1], os.path.join(os.path.join(sisyphus.getFilesystem.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]) @@ -48,14 +48,14 @@ def start(pkgname): if not "Calculating dependencies" in portageOutput.rstrip(): print(portageOutput.rstrip()) - sisyphus.database.syncLocal() + sisyphus.syncDatabase.syncLocal() else: sys.exit("\n" + "Ok; Quitting." + "\n") else: sys.exit("\n" + "No package found; Quitting." + "\n") else: if not len(areBinaries) == 0: - os.chdir(sisyphus.filesystem.portageCacheDir) + os.chdir(sisyphus.getFilesystem.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": @@ -64,11 +64,11 @@ def start(pkgname): wget.download(isBinhost + binary) print("\n") - if os.path.isdir(os.path.join(sisyphus.filesystem.portageCacheDir, binary.rstrip().split("/")[0])): - shutil.move(binary.rstrip().split("/")[1], os.path.join(os.path.join(sisyphus.filesystem.portageCacheDir, binary.rstrip().split("/")[0]), os.path.basename(binary.rstrip().split("/")[1]))) + if os.path.isdir(os.path.join(sisyphus.getFilesystem.portageCacheDir, binary.rstrip().split("/")[0])): + shutil.move(binary.rstrip().split("/")[1], os.path.join(os.path.join(sisyphus.getFilesystem.portageCacheDir, binary.rstrip().split("/")[0]), os.path.basename(binary.rstrip().split("/")[1]))) else: - os.makedirs(os.path.join(sisyphus.filesystem.portageCacheDir, binary.rstrip().split("/")[0])) - shutil.move(binary.rstrip().split("/")[1], os.path.join(os.path.join(sisyphus.filesystem.portageCacheDir, binary.rstrip().split("/")[0]), os.path.basename(binary.rstrip().split("/")[1]))) + os.makedirs(os.path.join(sisyphus.getFilesystem.portageCacheDir, binary.rstrip().split("/")[0])) + shutil.move(binary.rstrip().split("/")[1], os.path.join(os.path.join(sisyphus.getFilesystem.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]) @@ -81,7 +81,7 @@ def start(pkgname): if not "Calculating dependencies" in portageOutput.rstrip(): print(portageOutput.rstrip()) - sisyphus.database.syncLocal() + sisyphus.syncDatabase.syncLocal() else: sys.exit("\n" + "Ok; Quitting." + "\n") else: @@ -95,7 +95,7 @@ def start(pkgname): if not "Calculating dependencies" in portageOutput.rstrip(): print(portageOutput.rstrip()) - sisyphus.database.syncLocal() + sisyphus.syncDatabase.syncLocal() else: sys.exit("\n" + "Ok; Quitting." + "\n") else: diff --git a/src/backend/killportage.py b/src/backend/killPortage.py index f01af6b..f01af6b 100644 --- a/src/backend/killportage.py +++ b/src/backend/killPortage.py diff --git a/src/backend/purge.py b/src/backend/purge.py deleted file mode 100644 index 3a94cff..0000000 --- a/src/backend/purge.py +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/python3 - -import animation -import os -import shutil -import sisyphus.filesystem - -@animation.wait('purging branch configuration') -def branch(): - if os.path.isdir(sisyphus.filesystem.portageRepoDir): - for files in os.listdir(sisyphus.filesystem.portageRepoDir): - if os.path.isfile(os.path.join(sisyphus.filesystem.portageRepoDir, files)): - os.remove(os.path.join(sisyphus.filesystem.portageRepoDir, files)) - else: - shutil.rmtree(os.path.join(sisyphus.filesystem.portageRepoDir, files)) - else: - os.makedirs(sisyphus.filesystem.portageRepoDir) - - if os.path.isdir(sisyphus.filesystem.redcoreRepoDir): - for files in os.listdir(sisyphus.filesystem.redcoreRepoDir): - if os.path.isfile(os.path.join(sisyphus.filesystem.redcoreRepoDir, files)): - os.remove(os.path.join(sisyphus.filesystem.redcoreRepoDir, files)) - else: - shutil.rmtree(os.path.join(sisyphus.filesystem.redcoreRepoDir, files)) - else: - os.makedirs(sisyphus.filesystem.redcoreRepoDir) - - if os.path.isdir(sisyphus.filesystem.portageConfigDir): - for files in os.listdir(sisyphus.filesystem.portageConfigDir): - if os.path.isfile(os.path.join(sisyphus.filesystem.portageConfigDir, files)): - os.remove(os.path.join(sisyphus.filesystem.portageConfigDir, files)) - else: - shutil.rmtree(os.path.join(sisyphus.filesystem.portageConfigDir, files)) - else: - os.makedirs(sisyphus.filesystem.portageConfigDir) - -def cache(): - if os.path.isdir(sisyphus.filesystem.portageCacheDir): - for files in os.listdir(sisyphus.filesystem.portageCacheDir): - if os.path.isfile(os.path.join(sisyphus.filesystem.portageCacheDir, files)): - os.remove(os.path.join(sisyphus.filesystem.portageCacheDir, files)) - else: - shutil.rmtree(os.path.join(sisyphus.filesystem.portageCacheDir, files)) - -def metadata(): - if os.path.isdir(sisyphus.filesystem.portageMetadataDir): - for files in os.listdir(sisyphus.filesystem.portageMetadataDir): - if os.path.isfile(os.path.join(sisyphus.filesystem.portageMetadataDir, files)): - os.remove(os.path.join(sisyphus.filesystem.portageMetadataDir, files)) - else: - shutil.rmtree(os.path.join(sisyphus.filesystem.portageMetadataDir, files)) diff --git a/src/backend/purgeEnvironment.py b/src/backend/purgeEnvironment.py new file mode 100644 index 0000000..0eba801 --- /dev/null +++ b/src/backend/purgeEnvironment.py @@ -0,0 +1,51 @@ +#!/usr/bin/python3 + +import animation +import os +import shutil +import sisyphus.getFilesystem + +@animation.wait('purging branch configuration') +def branch(): + if os.path.isdir(sisyphus.getFilesystem.portageRepoDir): + for files in os.listdir(sisyphus.getFilesystem.portageRepoDir): + if os.path.isfile(os.path.join(sisyphus.getFilesystem.portageRepoDir, files)): + os.remove(os.path.join(sisyphus.getFilesystem.portageRepoDir, files)) + else: + shutil.rmtree(os.path.join(sisyphus.getFilesystem.portageRepoDir, files)) + else: + os.makedirs(sisyphus.getFilesystem.portageRepoDir) + + if os.path.isdir(sisyphus.getFilesystem.redcoreRepoDir): + for files in os.listdir(sisyphus.getFilesystem.redcoreRepoDir): + if os.path.isfile(os.path.join(sisyphus.getFilesystem.redcoreRepoDir, files)): + os.remove(os.path.join(sisyphus.getFilesystem.redcoreRepoDir, files)) + else: + shutil.rmtree(os.path.join(sisyphus.getFilesystem.redcoreRepoDir, files)) + else: + os.makedirs(sisyphus.getFilesystem.redcoreRepoDir) + + if os.path.isdir(sisyphus.getFilesystem.portageConfigDir): + for files in os.listdir(sisyphus.getFilesystem.portageConfigDir): + if os.path.isfile(os.path.join(sisyphus.getFilesystem.portageConfigDir, files)): + os.remove(os.path.join(sisyphus.getFilesystem.portageConfigDir, files)) + else: + shutil.rmtree(os.path.join(sisyphus.getFilesystem.portageConfigDir, files)) + else: + os.makedirs(sisyphus.getFilesystem.portageConfigDir) + +def cache(): + if os.path.isdir(sisyphus.getFilesystem.portageCacheDir): + for files in os.listdir(sisyphus.getFilesystem.portageCacheDir): + if os.path.isfile(os.path.join(sisyphus.getFilesystem.portageCacheDir, files)): + os.remove(os.path.join(sisyphus.getFilesystem.portageCacheDir, files)) + else: + shutil.rmtree(os.path.join(sisyphus.getFilesystem.portageCacheDir, files)) + +def metadata(): + if os.path.isdir(sisyphus.getFilesystem.portageMetadataDir): + for files in os.listdir(sisyphus.getFilesystem.portageMetadataDir): + if os.path.isfile(os.path.join(sisyphus.getFilesystem.portageMetadataDir, files)): + os.remove(os.path.join(sisyphus.getFilesystem.portageMetadataDir, files)) + else: + shutil.rmtree(os.path.join(sisyphus.getFilesystem.portageMetadataDir, files)) diff --git a/src/backend/recoverDatabase.py b/src/backend/recoverDatabase.py new file mode 100644 index 0000000..c067815 --- /dev/null +++ b/src/backend/recoverDatabase.py @@ -0,0 +1,20 @@ +#!/usr/bin/python3 + +import animation +import os +import sisyphus.syncDatabase +import sisyphus.getFilesystem + +@animation.wait('recovering databases') +def start(): + if os.path.exists(sisyphus.getFilesystem.remotePackagesCsv): + os.remove(sisyphus.getFilesystem.remotePackagesCsv) + if os.path.exists(sisyphus.getFilesystem.remoteDescriptionsCsv): + os.remove(sisyphus.getFilesystem.remoteDescriptionsCsv) + if os.path.exists(sisyphus.getFilesystem.localPackagesCsv): + os.remove(sisyphus.getFilesystem.localPackagesCsv) + if os.path.exists(sisyphus.getFilesystem.localDatabase): + os.remove(sisyphus.getFilesystem.localDatabase) + + sisyphus.syncDatabase.syncRemote() + sisyphus.syncDatabase.syncLocal() diff --git a/src/backend/rescue.py b/src/backend/rescue.py deleted file mode 100644 index 26e7c68..0000000 --- a/src/backend/rescue.py +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/python3 - -import animation -import os -import sisyphus.database -import sisyphus.filesystem - -@animation.wait('recovering databases') -def start(): - if os.path.exists(sisyphus.filesystem.remotePackagesCsv): - os.remove(sisyphus.filesystem.remotePackagesCsv) - if os.path.exists(sisyphus.filesystem.remoteDescriptionsCsv): - os.remove(sisyphus.filesystem.remoteDescriptionsCsv) - if os.path.exists(sisyphus.filesystem.localPackagesCsv): - os.remove(sisyphus.filesystem.localPackagesCsv) - if os.path.exists(sisyphus.filesystem.localDatabase): - os.remove(sisyphus.filesystem.localDatabase) - - sisyphus.database.syncRemote() - sisyphus.database.syncLocal() diff --git a/src/backend/solvedeps.py b/src/backend/resolveDeps.py index f0af4c0..f0af4c0 100644 --- a/src/backend/solvedeps.py +++ b/src/backend/resolveDeps.py diff --git a/src/backend/search.py b/src/backend/searchPkg.py index 18eeb82..6f227f9 100644 --- a/src/backend/search.py +++ b/src/backend/searchPkg.py @@ -1,9 +1,9 @@ #!/usr/bin/python3 import sqlite3 -import sisyphus.check -import sisyphus.filesystem -import sisyphus.update +import sisyphus.checkEnvironment +import sisyphus.getFilesystem +import sisyphus.updateAll def searchDB(filter, cat = '', pn = '', desc = ''): NOVIRT = "AND cat NOT LIKE 'virtual'" @@ -90,7 +90,7 @@ def searchDB(filter, cat = '', pn = '', desc = ''): AND iv <> av''' } - with sqlite3.connect(sisyphus.filesystem.localDatabase) as db: + with sqlite3.connect(sisyphus.getFilesystem.localDatabase) as db: db.row_factory = sqlite3.Row cursor = db.cursor() cursor.execute(SELECTS[filter]) @@ -125,8 +125,8 @@ def showSearch(filter, cat, pn, desc, single): print(f"\nFound {len(pkglist)} matching package(s) ...") def start(filter, cat, pn, desc, single): - if sisyphus.check.root(): - sisyphus.update.start() + if sisyphus.checkEnvironment.root(): + sisyphus.updateAll.start() else: print("\nYou are not root, cannot fetch updates.\nSearch result may be inaccurate!\n") diff --git a/src/backend/ebuildsearch.py b/src/backend/searchSrc.py index c9b5862..c9b5862 100644 --- a/src/backend/ebuildsearch.py +++ b/src/backend/searchSrc.py diff --git a/src/backend/branchsetup.py b/src/backend/setBranch.py index 4ac3b84..d0fa834 100644 --- a/src/backend/branchsetup.py +++ b/src/backend/setBranch.py @@ -4,11 +4,11 @@ import animation import git import os import sys -import sisyphus.check -import sisyphus.filesystem -import sisyphus.purge -import sisyphus.setjobs -import sisyphus.setprofile +import sisyphus.checkEnvironment +import sisyphus.getFilesystem +import sisyphus.purgeEnvironment +import sisyphus.setJobs +import sisyphus.setProfile def getBranchRemote(branch,remote): portageRemote = [] @@ -16,9 +16,9 @@ def getBranchRemote(branch,remote): portageConfigRemote = [] if "master" in branch: if "gitlab" in remote: - remote = sisyphus.filesystem.remoteGitlab + remote = sisyphus.getFilesystem.remoteGitlab elif "pagure" in remote: - remote = sisyphus.filesystem.remotePagure + remote = sisyphus.getFilesystem.remotePagure else: sys.exit("Usage: sisyphus-cli.py branch [OPTIONS] BRANCH" + "\n" + "Try 'sisyphus-cli.py branch --help' for help." + "\n\n" + @@ -26,9 +26,9 @@ def getBranchRemote(branch,remote): ) elif "next" in branch: if "gitlab" in remote: - remote = sisyphus.filesystem.remoteGitlab + remote = sisyphus.getFilesystem.remoteGitlab elif "pagure" in remote: - remote = sisyphus.filesystem.remotePagure + remote = sisyphus.getFilesystem.remotePagure else: sys.exit("Usage: sisyphus-cli.py branch [OPTIONS] BRANCH" + "\n" + "Try 'sisyphus-cli.py branch --help' for help." + "\n\n" + @@ -40,34 +40,34 @@ def getBranchRemote(branch,remote): "Error: Invalid branch" + " " + "'" + str(branch) + "'" +" " + "(options : master, next)" ) - portageRemote = [remote, sisyphus.filesystem.portageRepo] - redcoreRemote = [remote, sisyphus.filesystem.redcoreRepo] - portageConfigRemote = [remote, sisyphus.filesystem.portageConfigRepo] + portageRemote = [remote, sisyphus.getFilesystem.portageRepo] + redcoreRemote = [remote, sisyphus.getFilesystem.redcoreRepo] + portageConfigRemote = [remote, sisyphus.getFilesystem.portageConfigRepo] return portageRemote,redcoreRemote,portageConfigRemote @animation.wait('injecting Gentoo Linux portage tree') -def injectGentooPortageTree(branch,remote): +def injectStage1(branch,remote): portageRemote,redcoreRemote,portageConfigRemote = getBranchRemote(branch,remote) - if not os.path.isdir(os.path.join(sisyphus.filesystem.portageRepoDir, '.git')): - git.Repo.clone_from("/".join(portageRemote), sisyphus.filesystem.portageRepoDir, depth=1, branch=branch) + if not os.path.isdir(os.path.join(sisyphus.getFilesystem.portageRepoDir, '.git')): + git.Repo.clone_from("/".join(portageRemote), sisyphus.getFilesystem.portageRepoDir, depth=1, branch=branch) @animation.wait('injecting Redcore Linux ebuild overlay') -def injectRedcoreEbuildOverlay(branch,remote): +def injectStage2(branch,remote): portageRemote,redcoreRemote,portageConfigRemote = getBranchRemote(branch,remote) - if not os.path.isdir(os.path.join(sisyphus.filesystem.redcoreRepoDir, '.git')): - git.Repo.clone_from("/".join(redcoreRemote), sisyphus.filesystem.redcoreRepoDir, depth=1, branch=branch) + if not os.path.isdir(os.path.join(sisyphus.getFilesystem.redcoreRepoDir, '.git')): + git.Repo.clone_from("/".join(redcoreRemote), sisyphus.getFilesystem.redcoreRepoDir, depth=1, branch=branch) @animation.wait('injecting Redcore Linux portage config') -def injectRedcorePortageConfig(branch,remote): +def injectStage3(branch,remote): portageRemote,redcoreRemote,portageConfigRemote = getBranchRemote(branch,remote) - if not os.path.isdir(os.path.join(sisyphus.filesystem.portageConfigDir, '.git')): - git.Repo.clone_from("/".join(portageConfigRemote), sisyphus.filesystem.portageConfigDir, depth=1, branch=branch) + if not os.path.isdir(os.path.join(sisyphus.getFilesystem.portageConfigDir, '.git')): + git.Repo.clone_from("/".join(portageConfigRemote), sisyphus.getFilesystem.portageConfigDir, depth=1, branch=branch) -def warnAboutBinaryRepository(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)") @@ -81,14 +81,14 @@ def warnAboutBinaryRepository(branch,remote): def start(branch,remote): - if sisyphus.check.root(): - sisyphus.purge.branch() - sisyphus.purge.metadata() - injectGentooPortageTree(branch,remote) - injectRedcoreEbuildOverlay(branch,remote) - injectRedcorePortageConfig(branch,remote) - sisyphus.setjobs.start() - sisyphus.setprofile.start() - warnAboutBinaryRepository(branch,remote) + if sisyphus.checkEnvironment.root(): + sisyphus.purgeEnvironment.branch() + sisyphus.purgeEnvironment.metadata() + injectStage1(branch,remote) + injectStage2(branch,remote) + injectStage3(branch,remote) + sisyphus.setJobs.start() + sisyphus.setProfile.start() + giveWarning(branch,remote) else: sys.exit("\nYou need root permissions to do this, exiting!\n") diff --git a/src/backend/setjobs.py b/src/backend/setJobs.py index 5a22b10..5a22b10 100644 --- a/src/backend/setjobs.py +++ b/src/backend/setJobs.py diff --git a/src/backend/mirror.py b/src/backend/setMirror.py index e2b7f26..b2d4f1f 100644 --- a/src/backend/mirror.py +++ b/src/backend/setMirror.py @@ -1,11 +1,11 @@ #!/usr/bin/python3 -import sisyphus.filesystem +import sisyphus.getFilesystem def getList(): mirrorList = [] - with open(sisyphus.filesystem.mirrorCfg) as mirrorFile: + with open(sisyphus.getFilesystem.mirrorCfg) as mirrorFile: for line in mirrorFile.readlines(): if 'PORTAGE_BINHOST=' in line: url = line.split("=")[1].replace('"', '').rstrip() @@ -27,7 +27,7 @@ def printList(): print(i + 1, ' ', line['Url']) def writeList(mirrorList): - with open(sisyphus.filesystem.mirrorCfg, 'w+') as mirrorFile: + with open(sisyphus.getFilesystem.mirrorCfg, 'w+') as mirrorFile: mirrorFile.write("#######################################################\n") mirrorFile.write("# Support for multiple mirrors is somewhat incomplete #\n") mirrorFile.write("#######################################################\n") diff --git a/src/backend/setprofile.py b/src/backend/setProfile.py index 87d5437..87d5437 100644 --- a/src/backend/setprofile.py +++ b/src/backend/setProfile.py diff --git a/src/backend/database.py b/src/backend/syncDatabase.py index e2ad380..9aa72d6 100644 --- a/src/backend/database.py +++ b/src/backend/syncDatabase.py @@ -5,17 +5,17 @@ import shutil import urllib3 import sqlite3 import subprocess -import sisyphus.csvfiles -import sisyphus.filesystem +import sisyphus.getCSV +import sisyphus.getFilesystem def getRemote(): - isPackageCsv,isDescriptionCsv = sisyphus.csvfiles.start() + isPackageCsv,isDescriptionCsv = sisyphus.getCSV.start() http = urllib3.PoolManager() - with http.request('GET', isPackageCsv, preload_content=False) as tmp_buffer, open(sisyphus.filesystem.remotePackagesCsv, 'wb') as output_file: + with http.request('GET', isPackageCsv, preload_content=False) as tmp_buffer, open(sisyphus.getFilesystem.remotePackagesCsv, 'wb') as output_file: shutil.copyfileobj(tmp_buffer, output_file) - with http.request('GET', isDescriptionCsv, preload_content=False) as tmp_buffer, open(sisyphus.filesystem.remoteDescriptionsCsv, 'wb') as output_file: + with http.request('GET', isDescriptionCsv, preload_content=False) as tmp_buffer, open(sisyphus.getFilesystem.remoteDescriptionsCsv, 'wb') as output_file: shutil.copyfileobj(tmp_buffer, output_file) def makeLocal(): @@ -24,17 +24,17 @@ def makeLocal(): def syncRemote(): getRemote() - sisyphusdb = sqlite3.connect(sisyphus.filesystem.localDatabase) + sisyphusdb = sqlite3.connect(sisyphus.getFilesystem.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)''') - with open(sisyphus.filesystem.remotePackagesCsv) as input_file: + with open(sisyphus.getFilesystem.remotePackagesCsv) as input_file: for row in csv.reader(input_file): sisyphusdb.cursor().execute("insert into remote_packages (category, name, version, slot) values (?, ?, ?, ?);", row) - with open(sisyphus.filesystem.remoteDescriptionsCsv) as input_file: + with open(sisyphus.getFilesystem.remoteDescriptionsCsv) as input_file: for row in csv.reader(input_file): sisyphusdb.cursor().execute("insert into remote_descriptions (category, name, description) values (?, ?, ?);", row) @@ -44,11 +44,11 @@ def syncRemote(): def syncLocal(): makeLocal() - sisyphusdb = sqlite3.connect(sisyphus.filesystem.localDatabase) + sisyphusdb = sqlite3.connect(sisyphus.getFilesystem.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)''') - with open(sisyphus.filesystem.localPackagesCsv) as input_file: + with open(sisyphus.getFilesystem.localPackagesCsv) as input_file: for row in csv.reader(input_file): sisyphusdb.cursor().execute("insert into local_packages (category, name, version, slot) values (?, ?, ?, ?);", row) diff --git a/src/backend/sync.py b/src/backend/syncEnvironment.py index 0f28823..04b662a 100644 --- a/src/backend/sync.py +++ b/src/backend/syncEnvironment.py @@ -2,10 +2,10 @@ import os import subprocess -import sisyphus.filesystem +import sisyphus.getFilesystem -def portage(): - os.chdir(sisyphus.filesystem.portageRepoDir) +def syncStage1(): + os.chdir(sisyphus.getFilesystem.portageRepoDir) localBranch = subprocess.check_output(['git', 'rev-parse', '--abbrev-ref', 'HEAD']) remoteBranch = subprocess.check_output(['git', 'rev-parse', '--symbolic-full-name', '@{u}']) @@ -15,8 +15,8 @@ def portage(): gitExecStage2 = subprocess.Popen(['git', 'reset', '--hard'] + remoteBranch.decode().strip().replace('refs/remotes/','').split() + ['--quiet'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) stdout, stderr = gitExecStage2.communicate() -def overlay(): - os.chdir(sisyphus.filesystem.redcoreRepoDir) +def syncStage2(): + os.chdir(sisyphus.getFilesystem.redcoreRepoDir) localBranch = subprocess.check_output(['git', 'rev-parse', '--abbrev-ref', 'HEAD']) remoteBranch = subprocess.check_output(['git', 'rev-parse', '--symbolic-full-name', '@{u}']) @@ -26,8 +26,8 @@ def overlay(): gitExecStage2 = subprocess.Popen(['git', 'reset', '--hard'] + remoteBranch.decode().strip().replace('refs/remotes/','').split() + ['--quiet'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) stdout, stderr = gitExecStage2.communicate() -def portageCfg(): - os.chdir(sisyphus.filesystem.portageConfigDir) +def syncStage3(): + os.chdir(sisyphus.getFilesystem.portageConfigDir) localBranch = subprocess.check_output(['git', 'rev-parse', '--abbrev-ref', 'HEAD']) remoteBranch = subprocess.check_output(['git', 'rev-parse', '--symbolic-full-name', '@{u}']) diff --git a/src/backend/spmsync.py b/src/backend/syncSPM.py index 2c388f1..89cc5df 100644 --- a/src/backend/spmsync.py +++ b/src/backend/syncSPM.py @@ -1,8 +1,8 @@ #!/usr/bin/python3 import animation -import sisyphus.database +import sisyphus.syncDatabase @animation.wait('syncing spm changes') def start(): - sisyphus.database.syncLocal() + sisyphus.syncDatabase.syncLocal() diff --git a/src/backend/sysinfo.py b/src/backend/sysInfo.py index 5ae29c2..5ae29c2 100644 --- a/src/backend/sysinfo.py +++ b/src/backend/sysInfo.py diff --git a/src/backend/uninstall.py b/src/backend/uninstallAll.py index b8981ca..4d0c050 100644 --- a/src/backend/uninstall.py +++ b/src/backend/uninstallAll.py @@ -4,15 +4,15 @@ import atexit import io import subprocess import sys -import sisyphus.check -import sisyphus.database -import sisyphus.killportage +import sisyphus.checkEnvironment +import sisyphus.syncDatabase +import sisyphus.killPortage def start(pkgname): - if sisyphus.check.root(): + if sisyphus.checkEnvironment.root(): portageExec = subprocess.Popen(['emerge', '--quiet', '--depclean', '--ask'] + list(pkgname), stdout=subprocess.PIPE, stderr=subprocess.PIPE) stdout, stderr = portageExec.communicate() - sisyphus.database.syncLocal() + sisyphus.syncDatabase.syncLocal() else: sys.exit("\nYou need root permissions to do this, exiting!\n") @@ -20,9 +20,9 @@ def startqt(pkgname): portageExec = subprocess.Popen(['emerge', '--depclean'] + pkgname, stdout=subprocess.PIPE, stderr=subprocess.PIPE) stdout, stderr = portageExec.communicate() # kill portage if the program dies or it's terminated by the user - atexit.register(sisyphus.killportage.start, portageExec) + atexit.register(sisyphus.killPortage.start, portageExec) for portageOutput in io.TextIOWrapper(portageExec.stdout, encoding="utf-8"): print(portageOutput.rstrip()) - sisyphus.database.syncLocal() + sisyphus.syncDatabase.syncLocal() diff --git a/src/backend/forceuninstall.py b/src/backend/uninstallForceAll.py index 9329695..8a952c6 100644 --- a/src/backend/forceuninstall.py +++ b/src/backend/uninstallForceAll.py @@ -2,13 +2,13 @@ import subprocess import sys -import sisyphus.check -import sisyphus.database +import sisyphus.checkEnvironment +import sisyphus.syncDatabase def start(pkgname): - if sisyphus.check.root(): + if sisyphus.checkEnvironment.root(): portageExec = subprocess.Popen(['emerge', '--quiet', '--unmerge', '--ask'] + list(pkgname), stdout=subprocess.PIPE, stderr=subprocess.PIPE) stdout, stderr = portageExec.communicate() - sisyphus.database.syncLocal() + sisyphus.syncDatabase.syncLocal() else: sys.exit("\nYou need root permissions to do this, exiting!\n") diff --git a/src/backend/update.py b/src/backend/updateAll.py index 0fe1fde..e981da2 100644 --- a/src/backend/update.py +++ b/src/backend/updateAll.py @@ -3,24 +3,24 @@ import animation import sys import time -import sisyphus.binhost -import sisyphus.check -import sisyphus.database -import sisyphus.purge -import sisyphus.sync +import sisyphus.getBinhost +import sisyphus.checkEnvironment +import sisyphus.syncDatabase +import sisyphus.purgeEnvironment +import sisyphus.syncEnvironment def syncAll(): - sisyphus.purge.cache() - sisyphus.sync.portage() - sisyphus.sync.overlay() - sisyphus.sync.portageCfg() - sisyphus.database.syncRemote() + sisyphus.purgeEnvironment.cache() + sisyphus.syncEnvironment.syncStage1() + sisyphus.syncEnvironment.syncStage2() + sisyphus.syncEnvironment.syncStage3() + sisyphus.syncDatabase.syncRemote() @animation.wait('fetching updates') def start(): - activeBranch = sisyphus.check.branch() - isBinhost = sisyphus.binhost.start() - isSane = sisyphus.check.sanity() + activeBranch = sisyphus.checkEnvironment.branch() + isBinhost = sisyphus.getBinhost.start() + isSane = sisyphus.checkEnvironment.sanity() if isSane == 1: syncAll() @@ -32,9 +32,9 @@ def start(): sys.exit("\nInvalid branch - binhost pairing; Use 'sisyphus branch --help' for help; Quitting.") def startqt(): - activeBranch = sisyphus.check.branch() - isBinhost = sisyphus.binhost.start() - isSane = sisyphus.check.sanity() + activeBranch = sisyphus.checkEnvironment.branch() + isBinhost = sisyphus.getBinhost.start() + isSane = sisyphus.checkEnvironment.sanity() if isSane == 1: syncAll() diff --git a/src/backend/upgrade.py b/src/backend/upgradePkg.py index 54fcd5c..1121747 100644 --- a/src/backend/upgrade.py +++ b/src/backend/upgradePkg.py @@ -7,25 +7,25 @@ import shutil import subprocess import sys import wget -import sisyphus.binhost -import sisyphus.check -import sisyphus.database -import sisyphus.filesystem -import sisyphus.killportage -import sisyphus.solvedeps -import sisyphus.update +import sisyphus.getBinhost +import sisyphus.checkEnvironment +import sisyphus.syncDatabase +import sisyphus.getFilesystem +import sisyphus.killPortage +import sisyphus.resolveDeps +import sisyphus.updateAll def start(): - if sisyphus.check.root(): - sisyphus.update.start() + if sisyphus.checkEnvironment.root(): + sisyphus.updateAll.start() - isBinhost = sisyphus.binhost.start() - areBinaries,areSources,needsConfig = sisyphus.solvedeps.world() + isBinhost = sisyphus.getBinhost.start() + areBinaries,areSources,needsConfig = sisyphus.resolveDeps.world() if needsConfig == 0: if len(areSources) == 0: if not len(areBinaries) == 0: - os.chdir(sisyphus.filesystem.portageCacheDir) + os.chdir(sisyphus.getFilesystem.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": for index, binary in enumerate([package + '.tbz2' for package in areBinaries], start=1): @@ -33,11 +33,11 @@ def start(): wget.download(isBinhost + binary) print("\n") - if os.path.isdir(os.path.join(sisyphus.filesystem.portageCacheDir, binary.rstrip().split("/")[0])): - shutil.move(binary.rstrip().split("/")[1], os.path.join(os.path.join(sisyphus.filesystem.portageCacheDir, binary.rstrip().split("/")[0]), os.path.basename(binary.rstrip().split("/")[1]))) + if os.path.isdir(os.path.join(sisyphus.getFilesystem.portageCacheDir, binary.rstrip().split("/")[0])): + shutil.move(binary.rstrip().split("/")[1], os.path.join(os.path.join(sisyphus.getFilesystem.portageCacheDir, binary.rstrip().split("/")[0]), os.path.basename(binary.rstrip().split("/")[1]))) else: - os.makedirs(os.path.join(sisyphus.filesystem.portageCacheDir, binary.rstrip().split("/")[0])) - shutil.move(binary.rstrip().split("/")[1], os.path.join(os.path.join(sisyphus.filesystem.portageCacheDir, binary.rstrip().split("/")[0]), os.path.basename(binary.rstrip().split("/")[1]))) + os.makedirs(os.path.join(sisyphus.getFilesystem.portageCacheDir, binary.rstrip().split("/")[0])) + shutil.move(binary.rstrip().split("/")[1], os.path.join(os.path.join(sisyphus.getFilesystem.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]) @@ -50,7 +50,7 @@ def start(): if not "Calculating dependencies" in portageOutput.rstrip(): print(portageOutput.rstrip()) - sisyphus.database.syncLocal() + sisyphus.syncDatabase.syncLocal() else: sys.exit("\n" + "Ok; Quitting." + "\n") else: @@ -64,25 +64,25 @@ def start(): sys.exit("\nYou need root permissions to do this, exiting!\n") def startqt(): - isBinhost = sisyphus.binhost.start() - areBinaries,areSources,needsConfig = sisyphus.solvedeps.world.__wrapped__() #undecorate + isBinhost = sisyphus.getBinhost.start() + areBinaries,areSources,needsConfig = sisyphus.resolveDeps.world.__wrapped__() #undecorate 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") else: if not len(areBinaries) == 0: - os.chdir(sisyphus.filesystem.portageCacheDir) + os.chdir(sisyphus.getFilesystem.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") 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(isBinhost + binary) print("\n") - if os.path.isdir(os.path.join(sisyphus.filesystem.portageCacheDir, binary.rstrip().split("/")[0])): - shutil.move(binary.rstrip().split("/")[1], os.path.join(os.path.join(sisyphus.filesystem.portageCacheDir, binary.rstrip().split("/")[0]), os.path.basename(binary.rstrip().split("/")[1]))) + if os.path.isdir(os.path.join(sisyphus.getFilesystem.portageCacheDir, binary.rstrip().split("/")[0])): + shutil.move(binary.rstrip().split("/")[1], os.path.join(os.path.join(sisyphus.getFilesystem.portageCacheDir, binary.rstrip().split("/")[0]), os.path.basename(binary.rstrip().split("/")[1]))) else: - os.makedirs(os.path.join(sisyphus.filesystem.portageCacheDir, binary.rstrip().split("/")[0])) - shutil.move(binary.rstrip().split("/")[1], os.path.join(os.path.join(sisyphus.filesystem.portageCacheDir, binary.rstrip().split("/")[0]), os.path.basename(binary.rstrip().split("/")[1]))) + os.makedirs(os.path.join(sisyphus.getFilesystem.portageCacheDir, binary.rstrip().split("/")[0])) + shutil.move(binary.rstrip().split("/")[1], os.path.join(os.path.join(sisyphus.getFilesystem.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]) @@ -90,13 +90,13 @@ def startqt(): 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, stderr=subprocess.PIPE) stdout, stderr = portageExec.communicate() # kill portage if the program dies or it's terminated by the user - atexit.register(sisyphus.killportage.start, portageExec) + atexit.register(sisyphus.killPortage.start, portageExec) 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()) - sisyphus.database.syncLocal() + sisyphus.syncDatabase.syncLocal() else: print("\n" + "No package upgrades found; Quitting." + "\n") diff --git a/src/backend/ebuildupgrade.py b/src/backend/upgradeSrc.py index ae5d39b..161a7c4 100644 --- a/src/backend/ebuildupgrade.py +++ b/src/backend/upgradeSrc.py @@ -6,24 +6,24 @@ import shutil import subprocess import sys import wget -import sisyphus.binhost -import sisyphus.check -import sisyphus.database -import sisyphus.filesystem -import sisyphus.solvedeps -import sisyphus.update +import sisyphus.getBinhost +import sisyphus.checkEnvironment +import sisyphus.syncDatabase +import sisyphus.getFilesystem +import sisyphus.resolveDeps +import sisyphus.updateAll def start(): - if sisyphus.check.root(): - sisyphus.update.start() + if sisyphus.checkEnvironment.root(): + sisyphus.updateAll.start() - binhostURL = sisyphus.binhost.start() - areBinaries,areSources,needsConfig = sisyphus.solvedeps.world() + binhostURL = sisyphus.getBinhost.start() + areBinaries,areSources,needsConfig = sisyphus.resolveDeps.world() if needsConfig == 0: if len(areSources) == 0: if not len(areBinaries) == 0: - os.chdir(sisyphus.filesystem.portageCacheDir) + os.chdir(sisyphus.getFilesystem.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": for index, binary in enumerate([package + '.tbz2' for package in areBinaries], start=1): @@ -31,11 +31,11 @@ def start(): wget.download(binhostURL + binary) print("\n") - if os.path.isdir(os.path.join(sisyphus.filesystem.portageCacheDir, binary.rstrip().split("/")[0])): - shutil.move(binary.rstrip().split("/")[1], os.path.join(os.path.join(sisyphus.filesystem.portageCacheDir, binary.rstrip().split("/")[0]), os.path.basename(binary.rstrip().split("/")[1]))) + if os.path.isdir(os.path.join(sisyphus.getFilesystem.portageCacheDir, binary.rstrip().split("/")[0])): + shutil.move(binary.rstrip().split("/")[1], os.path.join(os.path.join(sisyphus.getFilesystem.portageCacheDir, binary.rstrip().split("/")[0]), os.path.basename(binary.rstrip().split("/")[1]))) else: - os.makedirs(os.path.join(sisyphus.filesystem.portageCacheDir, binary.rstrip().split("/")[0])) - shutil.move(binary.rstrip().split("/")[1], os.path.join(os.path.join(sisyphus.filesystem.portageCacheDir, binary.rstrip().split("/")[0]), os.path.basename(binary.rstrip().split("/")[1]))) + os.makedirs(os.path.join(sisyphus.getFilesystem.portageCacheDir, binary.rstrip().split("/")[0])) + shutil.move(binary.rstrip().split("/")[1], os.path.join(os.path.join(sisyphus.getFilesystem.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]) @@ -48,14 +48,14 @@ def start(): if not "Calculating dependencies" in portageOutput.rstrip(): print(portageOutput.rstrip()) - sisyphus.database.syncLocal() + sisyphus.syncDatabase.syncLocal() else: sys.exit("\n" + "Ok; Quitting." + "\n") else: sys.exit("\n" + "No package upgrades found; Quitting." + "\n") else: if not len(areBinaries) == 0: - os.chdir(sisyphus.filesystem.portageCacheDir) + os.chdir(sisyphus.getFilesystem.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": @@ -64,11 +64,11 @@ def start(): wget.download(binhostURL + binary) print("\n") - if os.path.isdir(os.path.join(sisyphus.filesystem.portageCacheDir, binary.rstrip().split("/")[0])): - shutil.move(binary.rstrip().split("/")[1], os.path.join(os.path.join(sisyphus.filesystem.portageCacheDir, binary.rstrip().split("/")[0]), os.path.basename(binary.rstrip().split("/")[1]))) + if os.path.isdir(os.path.join(sisyphus.getFilesystem.portageCacheDir, binary.rstrip().split("/")[0])): + shutil.move(binary.rstrip().split("/")[1], os.path.join(os.path.join(sisyphus.getFilesystem.portageCacheDir, binary.rstrip().split("/")[0]), os.path.basename(binary.rstrip().split("/")[1]))) else: - os.makedirs(os.path.join(sisyphus.filesystem.portageCacheDir, binary.rstrip().split("/")[0])) - shutil.move(binary.rstrip().split("/")[1], os.path.join(os.path.join(sisyphus.filesystem.portageCacheDir, binary.rstrip().split("/")[0]), os.path.basename(binary.rstrip().split("/")[1]))) + os.makedirs(os.path.join(sisyphus.getFilesystem.portageCacheDir, binary.rstrip().split("/")[0])) + shutil.move(binary.rstrip().split("/")[1], os.path.join(os.path.join(sisyphus.getFilesystem.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]) @@ -81,7 +81,7 @@ def start(): if not "Calculating dependencies" in portageOutput.rstrip(): print(portageOutput.rstrip()) - sisyphus.database.syncLocal() + sisyphus.syncDatabase.syncLocal() else: sys.exit("\n" + "Ok; Quitting." + "\n") else: @@ -95,7 +95,7 @@ def start(): if not "Calculating dependencies" in portageOutput.rstrip(): print(portageOutput.rstrip()) - sisyphus.database.syncLocal() + sisyphus.syncDatabase.syncLocal() else: sys.exit("\n" + "Ok; Quitting." + "\n") else: diff --git a/src/frontend/cli/sisyphus-cli.py b/src/frontend/cli/sisyphus-cli.py index f38fddb..cc0d607 100755 --- a/src/frontend/cli/sisyphus-cli.py +++ b/src/frontend/cli/sisyphus-cli.py @@ -97,12 +97,12 @@ def search(package: List[str] = typer.Argument(...), cat, pn = package[0].split('/') else: cat, pn = '', package[0] - sisyphus.search.start(filter.value, cat, pn, desc, quiet) + sisyphus.searchPkg.start(filter.value, cat, pn, desc, quiet) else: if not package: raise typer.Exit('No search term provided, try: sisyphus search --help') else: - sisyphus.ebuildsearch.start(package) + sisyphus.searchSrc.start(package) @app.command("install") def install(pkgname: List[str], ebuild: bool = typer.Option(False, "--ebuild", "-e")): @@ -124,9 +124,9 @@ def install(pkgname: List[str], ebuild: bool = typer.Option(False, "--ebuild", " You can use the --ebuild option even if you don't want to install any ebuild(source) packages; It will fall back to binary packages only. """ if not ebuild: - sisyphus.install.start(pkgname) + sisyphus.installPkg.start(pkgname) else: - sisyphus.ebuildinstall.start(pkgname) + sisyphus.installSrc.start(pkgname) @app.command("uninstall") def uninstall(pkgname: List[str], force: bool = typer.Option(False, "--force", "-f")): @@ -161,9 +161,9 @@ def uninstall(pkgname: List[str], force: bool = typer.Option(False, "--force", " will succeed, but the system will be broken """ if not force: - sisyphus.uninstall.start(pkgname) + sisyphus.uninstallAll.start(pkgname) else: - sisyphus.forceuninstall.start(pkgname) + sisyphus.uninstallForceAll.start(pkgname) @app.command("autoremove") def autoremove(): @@ -172,13 +172,13 @@ def autoremove(): In addition, a package may no longer depend on another one, so that other package becomes orphan as well if nothing else requires it. Use this option to check the whole dependency chain for such packages, and uninstall them. """ - sisyphus.autoremove.start() + sisyphus.autoRemoveAll.start() @app.command("update") def update(): """Update the Portage tree, the Redcore Overlay(s), Portage configs and Sisyphus's package database.""" - if sisyphus.check.root(): - sisyphus.update.start() + if sisyphus.checkEnvironment.root(): + sisyphus.updateAll.start() else: sys.exit("\nYou need root permissions to do this, exiting!\n") @@ -203,9 +203,9 @@ def upgrade(ebuild: bool = typer.Option(False, "--ebuild", "-e")): You can use the --ebuild option even if you don't have any ebuild(source) packages installed; It will fall back to binary packages only. """ if not ebuild: - sisyphus.upgrade.start() + sisyphus.upgradePkg.start() else: - sisyphus.ebuildupgrade.start() + sisyphus.upgradeSrc.start() @app.command("spmsync") def spmsync(): @@ -213,7 +213,7 @@ def spmsync(): When you install something with Portage directly (emerge), Sisyphus is not aware of that package, and it doesn't track it in it's database. Use this command to synchronize Sisyphus's package database with Portage's package database. """ - sisyphus.spmsync.start() + sisyphus.syncSPM.start() @app.command("rescue") def rescue(): @@ -222,7 +222,7 @@ def rescue(): If Portage's package database is corrupted (in this case you're screwed anyway :D), only a partial resurrection will be possible. If Portage's package database is intact, full resurrection will be possible. """ - sisyphus.rescue.start() + sisyphus.recoverDatabase.start() class Branch(str, Enum): master = 'master' @@ -267,24 +267,24 @@ def branch(branch: Branch = typer.Argument(...), remote: Remote = typer.Option(R sisyphus mirror set 8 """ - sisyphus.branchsetup.start(branch.value, remote.value) + sisyphus.setBranch.start(branch.value, remote.value) @app.command("sysinfo") def sysinfo(): """Display information about installed core packages and portage configuration.""" - sisyphus.sysinfo.show() + sisyphus.sysInfo.show() @mirrorSetup.command("list") def mirrorlist(): """List available binary package repository mirrors (the active one is marked with *).""" - sisyphus.mirror.printList() + sisyphus.setMirror.printList() @mirrorSetup.command("set") def mirrorset(index: int): """Change the binary package repository to the selected mirror.""" - sisyphus.mirror.setActive(index) + sisyphus.setMirror.setActive(index) if __name__ == "__main__": if len(sys.argv) > 1 and not '--help' in sys.argv: - sisyphus.setjobs.start() + sisyphus.setJobs.start() app() diff --git a/src/frontend/gui/sisyphus-gui.py b/src/frontend/gui/sisyphus-gui.py index 75c4bc2..2606a77 100644 --- a/src/frontend/gui/sisyphus-gui.py +++ b/src/frontend/gui/sisyphus-gui.py @@ -196,7 +196,7 @@ class Sisyphus(QtWidgets.QMainWindow): AND iv <> av ''' % (Sisyphus.applicationView, Sisyphus.searchTerm, noVirtual)), ]) - with sqlite3.connect(sisyphus.filesystem.localDatabase) as db: + with sqlite3.connect(sisyphus.getFilesystem.localDatabase) as db: cursor = db.cursor() cursor.execute('%s' % (self.SELECTS[Sisyphus.databaseView])) rows = cursor.fetchall() @@ -304,7 +304,7 @@ class MirrorConfiguration(QtWidgets.QMainWindow): super(MirrorConfiguration, self).__init__() uic.loadUi('/usr/share/sisyphus/ui/mirrorcfg.ui', self) self.centerOnScreen() - self.MIRRORLIST = sisyphus.mirror.getList() + self.MIRRORLIST = sisyphus.setMirror.getList() self.updateMirrorList() self.applyButton.pressed.connect(self.mirrorCfgApply) self.applyButton.released.connect(self.mirrorCfgExit) @@ -335,7 +335,7 @@ class MirrorConfiguration(QtWidgets.QMainWindow): self.MIRRORLIST[self.ACTIVEMIRRORINDEX]['isActive'] = True def mirrorCfgApply(self): - sisyphus.mirror.writeList(self.MIRRORLIST) + sisyphus.setMirror.writeList(self.MIRRORLIST) def mirrorCfgExit(self): self.close() @@ -374,34 +374,34 @@ class MainWorker(QtCore.QObject): @QtCore.pyqtSlot() def startUpdate(self): self.started.emit() - sisyphus.setjobs.start() - sisyphus.update.startqt() + sisyphus.setJobs.start() + sisyphus.updateAll.startqt() self.finished.emit() @QtCore.pyqtSlot() def startInstall(self): self.started.emit() pkgname = Sisyphus.pkgname - sisyphus.install.startqt(pkgname) + sisyphus.installPkg.startqt(pkgname) self.finished.emit() @QtCore.pyqtSlot() def startUninstall(self): self.started.emit() pkgname = Sisyphus.pkgname - sisyphus.uninstall.startqt(pkgname) + sisyphus.uninstallAll.startqt(pkgname) self.finished.emit() @QtCore.pyqtSlot() def startUpgrade(self): self.started.emit() - sisyphus.upgrade.startqt() + sisyphus.upgradePkg.startqt() self.finished.emit() @QtCore.pyqtSlot() def startAutoremove(self): self.started.emit() - sisyphus.autoremove.startqt() + sisyphus.autoRemoveAll.startqt() self.finished.emit() |