From 129031c9155d03890ef66f00be1ab60f63327c35 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sun, 30 Oct 2022 14:31:44 +0000 Subject: move getFilesystem -> getfs --- src/backend/__init__.py | 2 +- src/backend/checkenv.py | 6 ++--- src/backend/getFilesystem.py | 28 ------------------- src/backend/getfs.py | 28 +++++++++++++++++++ src/backend/installPkg.py | 22 +++++++-------- src/backend/installSrc.py | 22 +++++++-------- src/backend/purgeEnvironment.py | 58 ++++++++++++++++++++-------------------- src/backend/recoverDatabase.py | 18 ++++++------- src/backend/searchPkg.py | 4 +-- src/backend/setBranch.py | 28 +++++++++---------- src/backend/setMirror.py | 6 ++--- src/backend/syncDatabase.py | 16 +++++------ src/backend/syncEnvironment.py | 8 +++--- src/backend/upgradePkg.py | 22 +++++++-------- src/backend/upgradeSrc.py | 22 +++++++-------- src/frontend/gui/sisyphus-gui.py | 2 +- 16 files changed, 146 insertions(+), 146 deletions(-) delete mode 100644 src/backend/getFilesystem.py create mode 100644 src/backend/getfs.py diff --git a/src/backend/__init__.py b/src/backend/__init__.py index 02c5bf2..f1261c4 100644 --- a/src/backend/__init__.py +++ b/src/backend/__init__.py @@ -1,7 +1,7 @@ from .autoremove import * from .checkenv import * from .getenv import * -from .getFilesystem import * +from .getfs import * from .installPkg import * from .installSrc import * from .killPortage import * diff --git a/src/backend/checkenv.py b/src/backend/checkenv.py index feaab4b..053fc52 100644 --- a/src/backend/checkenv.py +++ b/src/backend/checkenv.py @@ -3,7 +3,7 @@ import os import subprocess import sisyphus.getenv -import sisyphus.getFilesystem +import sisyphus.getfs 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.getFilesystem.gentooRepoDir, '.git')): - os.chdir(sisyphus.getFilesystem.gentooRepoDir) + 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']) if localBranch.decode().strip() == 'master': diff --git a/src/backend/getFilesystem.py b/src/backend/getFilesystem.py deleted file mode 100644 index 5186db4..0000000 --- a/src/backend/getFilesystem.py +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/python3 - -import platform - -remoteGitlab = 'https://gitlab.com/redcore' -remotePagure = 'https://pagure.io/redcore' - -gentooRepo = 'portage.git' -redcoreRepo = 'redcore-desktop.git' -portageConfigRepo = 'redcore-build.git' - -gentooRepoDir = '/usr/ports/gentoo' -redcoreRepoDir = '/usr/ports/redcore' -portageConfigDir = '/opt/redcore-build' -portageCacheDir = '/var/cache/packages' -portageMetadataDir = '/var/cache/edb' - -remotePackagesCsv = '/var/lib/sisyphus/csv/remotePackagesPre.csv' -remoteDescriptionsCsv = '/var/lib/sisyphus/csv/remoteDescriptionsPre.csv' -localPackagesCsv = '/var/lib/sisyphus/csv/localPackagesPre.csv' - -localDatabase = '/var/lib/sisyphus/db/sisyphus.db' - -if platform.uname()[4] == 'x86_64': - mirrorCfg = '/etc/sisyphus/sisyphus-mirrors-amd64.conf' - -if platform.uname()[4] == 'aarch64': - mirrorCfg = '/etc/sisyphus/sisyphus-mirrors-arm64.conf' diff --git a/src/backend/getfs.py b/src/backend/getfs.py new file mode 100644 index 0000000..5186db4 --- /dev/null +++ b/src/backend/getfs.py @@ -0,0 +1,28 @@ +#!/usr/bin/python3 + +import platform + +remoteGitlab = 'https://gitlab.com/redcore' +remotePagure = 'https://pagure.io/redcore' + +gentooRepo = 'portage.git' +redcoreRepo = 'redcore-desktop.git' +portageConfigRepo = 'redcore-build.git' + +gentooRepoDir = '/usr/ports/gentoo' +redcoreRepoDir = '/usr/ports/redcore' +portageConfigDir = '/opt/redcore-build' +portageCacheDir = '/var/cache/packages' +portageMetadataDir = '/var/cache/edb' + +remotePackagesCsv = '/var/lib/sisyphus/csv/remotePackagesPre.csv' +remoteDescriptionsCsv = '/var/lib/sisyphus/csv/remoteDescriptionsPre.csv' +localPackagesCsv = '/var/lib/sisyphus/csv/localPackagesPre.csv' + +localDatabase = '/var/lib/sisyphus/db/sisyphus.db' + +if platform.uname()[4] == 'x86_64': + mirrorCfg = '/etc/sisyphus/sisyphus-mirrors-amd64.conf' + +if platform.uname()[4] == 'aarch64': + mirrorCfg = '/etc/sisyphus/sisyphus-mirrors-arm64.conf' diff --git a/src/backend/installPkg.py b/src/backend/installPkg.py index 7c1f100..fd6035a 100644 --- a/src/backend/installPkg.py +++ b/src/backend/installPkg.py @@ -9,7 +9,7 @@ import sys import wget import sisyphus.checkenv import sisyphus.getenv -import sisyphus.getFilesystem +import sisyphus.getfs import sisyphus.killPortage import sisyphus.resolveDeps import sisyphus.syncDatabase @@ -25,7 +25,7 @@ def cliExec(pkgname): if needsConfig == 0: if len(areSources) == 0: if not len(areBinaries) == 0: - os.chdir(sisyphus.getFilesystem.portageCacheDir) + 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": for index, binary in enumerate([package + '.tbz2' for package in areBinaries], start=1): @@ -33,11 +33,11 @@ def cliExec(pkgname): wget.download(binhostURL + binary) print("\n") - 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]))) + 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]))) else: - 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]))) + 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]) @@ -62,18 +62,18 @@ def guiExec(pkgname): binhostURL = sisyphus.getenv.binhostURL() areBinaries,areSources,needsConfig = sisyphus.resolveDeps.package.__wrapped__(pkgname) #undecorate - os.chdir(sisyphus.getFilesystem.portageCacheDir) + 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") 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") - 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]))) + 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]))) else: - 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]))) + 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/installSrc.py b/src/backend/installSrc.py index d37399e..6abc7b2 100644 --- a/src/backend/installSrc.py +++ b/src/backend/installSrc.py @@ -8,7 +8,7 @@ import sys import wget import sisyphus.checkenv import sisyphus.getenv -import sisyphus.getFilesystem +import sisyphus.getfs import sisyphus.resolveDeps import sisyphus.syncDatabase import sisyphus.updateAll @@ -23,7 +23,7 @@ def cliExec(pkgname): if needsConfig == 0: if len(areSources) == 0: if not len(areBinaries) == 0: - os.chdir(sisyphus.getFilesystem.portageCacheDir) + 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": for index, binary in enumerate([package + '.tbz2' for package in areBinaries], start=1): @@ -31,11 +31,11 @@ def cliExec(pkgname): wget.download(binhostURL + binary) print("\n") - 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]))) + 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]))) else: - 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]))) + 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]) @@ -50,7 +50,7 @@ def cliExec(pkgname): sys.exit("\n" + "No package found; Quitting." + "\n") else: if not len(areBinaries) == 0: - os.chdir(sisyphus.getFilesystem.portageCacheDir) + 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": @@ -59,11 +59,11 @@ def cliExec(pkgname): wget.download(binhostURL + binary) print("\n") - 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]))) + 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]))) else: - 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]))) + 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/purgeEnvironment.py b/src/backend/purgeEnvironment.py index 701d4a9..b5424a6 100644 --- a/src/backend/purgeEnvironment.py +++ b/src/backend/purgeEnvironment.py @@ -3,49 +3,49 @@ import animation import os import shutil -import sisyphus.getFilesystem +import sisyphus.getfs @animation.wait('purging branch configuration') def branch(): - if os.path.isdir(sisyphus.getFilesystem.gentooRepoDir): - for files in os.listdir(sisyphus.getFilesystem.gentooRepoDir): - if os.path.isfile(os.path.join(sisyphus.getFilesystem.gentooRepoDir, files)): - os.remove(os.path.join(sisyphus.getFilesystem.gentooRepoDir, files)) + if os.path.isdir(sisyphus.getfs.gentooRepoDir): + for files in os.listdir(sisyphus.getfs.gentooRepoDir): + 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.getFilesystem.gentooRepoDir, files)) + shutil.rmtree(os.path.join(sisyphus.getfs.gentooRepoDir, files)) else: - os.makedirs(sisyphus.getFilesystem.gentooRepoDir) + os.makedirs(sisyphus.getfs.gentooRepoDir) - 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)) + if os.path.isdir(sisyphus.getfs.redcoreRepoDir): + for files in os.listdir(sisyphus.getfs.redcoreRepoDir): + 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.getFilesystem.redcoreRepoDir, files)) + shutil.rmtree(os.path.join(sisyphus.getfs.redcoreRepoDir, files)) else: - os.makedirs(sisyphus.getFilesystem.redcoreRepoDir) + os.makedirs(sisyphus.getfs.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)) + if os.path.isdir(sisyphus.getfs.portageConfigDir): + for files in os.listdir(sisyphus.getfs.portageConfigDir): + 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.getFilesystem.portageConfigDir, files)) + shutil.rmtree(os.path.join(sisyphus.getfs.portageConfigDir, files)) else: - os.makedirs(sisyphus.getFilesystem.portageConfigDir) + os.makedirs(sisyphus.getfs.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)) + if os.path.isdir(sisyphus.getfs.portageCacheDir): + for files in os.listdir(sisyphus.getfs.portageCacheDir): + 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.getFilesystem.portageCacheDir, files)) + shutil.rmtree(os.path.join(sisyphus.getfs.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)) + 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)) else: - shutil.rmtree(os.path.join(sisyphus.getFilesystem.portageMetadataDir, files)) + shutil.rmtree(os.path.join(sisyphus.getfs.portageMetadataDir, files)) diff --git a/src/backend/recoverDatabase.py b/src/backend/recoverDatabase.py index 2594c72..c429340 100644 --- a/src/backend/recoverDatabase.py +++ b/src/backend/recoverDatabase.py @@ -2,19 +2,19 @@ import animation import os -import sisyphus.getFilesystem +import sisyphus.getfs import sisyphus.syncDatabase @animation.wait('recovering databases') def cliExec(): - 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) + if os.path.exists(sisyphus.getfs.remotePackagesCsv): + os.remove(sisyphus.getfs.remotePackagesCsv) + if os.path.exists(sisyphus.getfs.remoteDescriptionsCsv): + os.remove(sisyphus.getfs.remoteDescriptionsCsv) + if os.path.exists(sisyphus.getfs.localPackagesCsv): + os.remove(sisyphus.getfs.localPackagesCsv) + if os.path.exists(sisyphus.getfs.localDatabase): + os.remove(sisyphus.getfs.localDatabase) sisyphus.syncDatabase.remoteTable() sisyphus.syncDatabase.localTable() diff --git a/src/backend/searchPkg.py b/src/backend/searchPkg.py index 6773a7a..df62001 100644 --- a/src/backend/searchPkg.py +++ b/src/backend/searchPkg.py @@ -2,7 +2,7 @@ import sqlite3 import sisyphus.checkenv -import sisyphus.getFilesystem +import sisyphus.getfs import sisyphus.updateAll def searchDB(filter, cat = '', pn = '', desc = ''): @@ -90,7 +90,7 @@ def searchDB(filter, cat = '', pn = '', desc = ''): AND iv <> av''' } - with sqlite3.connect(sisyphus.getFilesystem.localDatabase) as db: + with sqlite3.connect(sisyphus.getfs.localDatabase) as db: db.row_factory = sqlite3.Row cursor = db.cursor() cursor.execute(SELECTS[filter]) diff --git a/src/backend/setBranch.py b/src/backend/setBranch.py index 601f606..01d570e 100644 --- a/src/backend/setBranch.py +++ b/src/backend/setBranch.py @@ -5,7 +5,7 @@ import git import os import sys import sisyphus.checkenv -import sisyphus.getFilesystem +import sisyphus.getfs import sisyphus.purgeEnvironment import sisyphus.setJobs import sisyphus.setProfile @@ -16,9 +16,9 @@ def getBranchRemote(branch,remote): portageConfigRemote = [] if "master" in branch: if "gitlab" in remote: - remote = sisyphus.getFilesystem.remoteGitlab + remote = sisyphus.getfs.remoteGitlab elif "pagure" in remote: - remote = sisyphus.getFilesystem.remotePagure + 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" + @@ -26,9 +26,9 @@ def getBranchRemote(branch,remote): ) elif "next" in branch: if "gitlab" in remote: - remote = sisyphus.getFilesystem.remoteGitlab + remote = sisyphus.getfs.remoteGitlab elif "pagure" in remote: - remote = sisyphus.getFilesystem.remotePagure + 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" + @@ -40,9 +40,9 @@ def getBranchRemote(branch,remote): "Error: Invalid branch" + " " + "'" + str(branch) + "'" +" " + "(options : master, next)" ) - gentooRemote = [remote, sisyphus.getFilesystem.gentooRepo] - redcoreRemote = [remote, sisyphus.getFilesystem.redcoreRepo] - portageConfigRemote = [remote, sisyphus.getFilesystem.portageConfigRepo] + gentooRemote = [remote, sisyphus.getfs.gentooRepo] + redcoreRemote = [remote, sisyphus.getfs.redcoreRepo] + portageConfigRemote = [remote, sisyphus.getfs.portageConfigRepo] return gentooRemote,redcoreRemote,portageConfigRemote @@ -50,22 +50,22 @@ def getBranchRemote(branch,remote): def injectGentooRepo(branch,remote): gentooRemote,redcoreRemote,portageConfigRemote = getBranchRemote(branch,remote) - if not os.path.isdir(os.path.join(sisyphus.getFilesystem.gentooRepoDir, '.git')): - git.Repo.clone_from("/".join(gentooRemote), sisyphus.getFilesystem.gentooRepoDir, depth=1, branch=branch) + 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) - 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) + 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) - 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) + 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: diff --git a/src/backend/setMirror.py b/src/backend/setMirror.py index b2d4f1f..ad02f58 100644 --- a/src/backend/setMirror.py +++ b/src/backend/setMirror.py @@ -1,11 +1,11 @@ #!/usr/bin/python3 -import sisyphus.getFilesystem +import sisyphus.getfs def getList(): mirrorList = [] - with open(sisyphus.getFilesystem.mirrorCfg) as mirrorFile: + with open(sisyphus.getfs.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.getFilesystem.mirrorCfg, 'w+') as mirrorFile: + with open(sisyphus.getfs.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/syncDatabase.py b/src/backend/syncDatabase.py index 760e3b6..b5d86ae 100644 --- a/src/backend/syncDatabase.py +++ b/src/backend/syncDatabase.py @@ -6,16 +6,16 @@ import urllib3 import sqlite3 import subprocess import sisyphus.getenv -import sisyphus.getFilesystem +import sisyphus.getfs def remoteCSV(): packagesCsvURL,descriptionsCsvURL = sisyphus.getenv.csvURL() http = urllib3.PoolManager() - with http.request('GET', packagesCsvURL, preload_content=False) as tmp_buffer, open(sisyphus.getFilesystem.remotePackagesCsv, 'wb') as output_file: + with http.request('GET', packagesCsvURL, preload_content=False) as tmp_buffer, open(sisyphus.getfs.remotePackagesCsv, 'wb') as output_file: shutil.copyfileobj(tmp_buffer, output_file) - with http.request('GET', descriptionsCsvURL, preload_content=False) as tmp_buffer, open(sisyphus.getFilesystem.remoteDescriptionsCsv, 'wb') as output_file: + 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(): @@ -24,17 +24,17 @@ def localCSV(): def remoteTable(): remoteCSV() - sisyphusdb = sqlite3.connect(sisyphus.getFilesystem.localDatabase) + 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)''') - with open(sisyphus.getFilesystem.remotePackagesCsv) as input_file: + 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) - with open(sisyphus.getFilesystem.remoteDescriptionsCsv) as input_file: + 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) @@ -44,11 +44,11 @@ def remoteTable(): def localTable(): localCSV() - sisyphusdb = sqlite3.connect(sisyphus.getFilesystem.localDatabase) + 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)''') - with open(sisyphus.getFilesystem.localPackagesCsv) as input_file: + 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) diff --git a/src/backend/syncEnvironment.py b/src/backend/syncEnvironment.py index 15ba3c3..2b3277f 100644 --- a/src/backend/syncEnvironment.py +++ b/src/backend/syncEnvironment.py @@ -2,10 +2,10 @@ import os import subprocess -import sisyphus.getFilesystem +import sisyphus.getfs def gentooRepo(): - os.chdir(sisyphus.getFilesystem.gentooRepoDir) + 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}']) @@ -16,7 +16,7 @@ def gentooRepo(): gitExecStage2.wait() def redcoreRepo(): - os.chdir(sisyphus.getFilesystem.redcoreRepoDir) + 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}']) @@ -27,7 +27,7 @@ def redcoreRepo(): gitExecStage2.wait() def portageConfigRepo(): - os.chdir(sisyphus.getFilesystem.portageConfigDir) + 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}']) diff --git a/src/backend/upgradePkg.py b/src/backend/upgradePkg.py index 5110499..d910df3 100644 --- a/src/backend/upgradePkg.py +++ b/src/backend/upgradePkg.py @@ -9,7 +9,7 @@ import sys import wget import sisyphus.checkenv import sisyphus.getenv -import sisyphus.getFilesystem +import sisyphus.getfs import sisyphus.killPortage import sisyphus.resolveDeps import sisyphus.syncDatabase @@ -25,7 +25,7 @@ def cliExec(): if needsConfig == 0: if len(areSources) == 0: if not len(areBinaries) == 0: - os.chdir(sisyphus.getFilesystem.portageCacheDir) + 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": for index, binary in enumerate([package + '.tbz2' for package in areBinaries], start=1): @@ -33,11 +33,11 @@ def cliExec(): wget.download(binhostURL + binary) print("\n") - 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]))) + 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]))) else: - 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]))) + 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]) @@ -66,18 +66,18 @@ def guiExec(): 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.getFilesystem.portageCacheDir) + 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") 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") - 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]))) + 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]))) else: - 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]))) + 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/upgradeSrc.py b/src/backend/upgradeSrc.py index 7251e64..4f06cd2 100644 --- a/src/backend/upgradeSrc.py +++ b/src/backend/upgradeSrc.py @@ -8,7 +8,7 @@ import sys import wget import sisyphus.checkenv import sisyphus.getenv -import sisyphus.getFilesystem +import sisyphus.getfs import sisyphus.resolveDeps import sisyphus.syncDatabase import sisyphus.updateAll @@ -23,7 +23,7 @@ def cliExec(): if needsConfig == 0: if len(areSources) == 0: if not len(areBinaries) == 0: - os.chdir(sisyphus.getFilesystem.portageCacheDir) + 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": for index, binary in enumerate([package + '.tbz2' for package in areBinaries], start=1): @@ -31,11 +31,11 @@ def cliExec(): wget.download(binhostURL + binary) print("\n") - 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]))) + 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]))) else: - 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]))) + 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]) @@ -50,7 +50,7 @@ def cliExec(): sys.exit("\n" + "No package upgrades found; Quitting." + "\n") else: if not len(areBinaries) == 0: - os.chdir(sisyphus.getFilesystem.portageCacheDir) + 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": @@ -59,11 +59,11 @@ def cliExec(): wget.download(binhostURL + binary) print("\n") - 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]))) + 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]))) else: - 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]))) + 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/frontend/gui/sisyphus-gui.py b/src/frontend/gui/sisyphus-gui.py index fe3803e..e2b31ad 100644 --- a/src/frontend/gui/sisyphus-gui.py +++ b/src/frontend/gui/sisyphus-gui.py @@ -212,7 +212,7 @@ class Sisyphus(QtWidgets.QMainWindow): AND iv <> av ''' % (Sisyphus.applicationView, Sisyphus.searchTerm, noVirtual)), ]) - with sqlite3.connect(sisyphus.getFilesystem.localDatabase) as db: + with sqlite3.connect(sisyphus.getfs.localDatabase) as db: cursor = db.cursor() cursor.execute('%s' % (self.SELECTS[Sisyphus.databaseView])) rows = cursor.fetchall() -- cgit v1.2.3