diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/branchmaster.py | 16 | ||||
-rw-r--r-- | src/backend/branchnext.py | 16 | ||||
-rw-r--r-- | src/backend/branchreset.py | 24 | ||||
-rw-r--r-- | src/backend/check.py | 4 | ||||
-rw-r--r-- | src/backend/csvfiles.py | 14 | ||||
-rw-r--r-- | src/backend/database.py | 22 | ||||
-rw-r--r-- | src/backend/filesystem.py | 12 | ||||
-rw-r--r-- | src/backend/rescue.py | 16 | ||||
-rw-r--r-- | src/backend/sync.py | 4 | ||||
-rw-r--r-- | src/frontend/gui/sisyphus-gui.py | 2 |
10 files changed, 65 insertions, 65 deletions
diff --git a/src/backend/branchmaster.py b/src/backend/branchmaster.py index 6a114c5..d9a2b09 100644 --- a/src/backend/branchmaster.py +++ b/src/backend/branchmaster.py @@ -7,8 +7,8 @@ import sisyphus.filesystem @animation.wait('injecting gentoo linux portage tree - branch master') def setGitlabMasterStage1(): - if not os.path.isdir(os.path.join(sisyphus.filesystem.gentooEbuildDir, '.git')): - os.chdir(sisyphus.filesystem.gentooEbuildDir) + if not os.path.isdir(os.path.join(sisyphus.filesystem.portageRepoDir, '.git')): + os.chdir(sisyphus.filesystem.portageRepoDir) subprocess.call(['git', 'init', '-q']) subprocess.call(['git', 'remote', 'add', 'origin', 'https://gitlab.com/redcore/portage.git']) subprocess.call(['git', 'fetch', '--depth=1', 'origin', 'master', '--quiet']) @@ -16,8 +16,8 @@ def setGitlabMasterStage1(): @animation.wait('injecting redcore linux ebuild tree - branch master') def setGitlabMasterStage2(): - if not os.path.isdir(os.path.join(sisyphus.filesystem.redcoreEbuildDir, '.git')): - os.chdir(sisyphus.filesystem.redcoreEbuildDir) + if not os.path.isdir(os.path.join(sisyphus.filesystem.redcoreRepoDir, '.git')): + os.chdir(sisyphus.filesystem.redcoreRepoDir) subprocess.call(['git', 'init', '-q']) subprocess.call(['git', 'remote', 'add', 'origin', 'https://gitlab.com/redcore/redcore-desktop.git']) subprocess.call(['git', 'fetch', '--depth=1', 'origin', 'master', '--quiet']) @@ -39,8 +39,8 @@ def gitlabStart(): @animation.wait('injecting gentoo linux portage tree - branch master') def setPagureMasterStage1(): - if not os.path.isdir(os.path.join(sisyphus.filesystem.gentooEbuildDir, '.git')): - os.chdir(sisyphus.filesystem.gentooEbuildDir) + if not os.path.isdir(os.path.join(sisyphus.filesystem.portageRepoDir, '.git')): + os.chdir(sisyphus.filesystem.portageRepoDir) subprocess.call(['git', 'init', '-q']) subprocess.call(['git', 'remote', 'add', 'origin', 'https://pagure.io/redcore/portage.git']) subprocess.call(['git', 'fetch', '--depth=1', 'origin', 'master', '--quiet']) @@ -48,8 +48,8 @@ def setPagureMasterStage1(): @animation.wait('injecting redcore linux ebuild tree - branch master') def setPagureMasterStage2(): - if not os.path.isdir(os.path.join(sisyphus.filesystem.redcoreEbuildDir, '.git')): - os.chdir(sisyphus.filesystem.redcoreEbuildDir) + if not os.path.isdir(os.path.join(sisyphus.filesystem.redcoreRepoDir, '.git')): + os.chdir(sisyphus.filesystem.redcoreRepoDir) subprocess.call(['git', 'init', '-q']) subprocess.call(['git', 'remote', 'add', 'origin', 'https://pagure.io/redcore/redcore-desktop.git']) subprocess.call(['git', 'fetch', '--depth=1', 'origin', 'master', '--quiet']) diff --git a/src/backend/branchnext.py b/src/backend/branchnext.py index 5c9e390..858de86 100644 --- a/src/backend/branchnext.py +++ b/src/backend/branchnext.py @@ -7,8 +7,8 @@ import sisyphus.filesystem @animation.wait('injecting gentoo linux portage tree - branch next') def setGitlabNextStage1(): - if not os.path.isdir(os.path.join(sisyphus.filesystem.gentooEbuildDir, '.git')): - os.chdir(sisyphus.filesystem.gentooEbuildDir) + if not os.path.isdir(os.path.join(sisyphus.filesystem.portageRepoDir, '.git')): + os.chdir(sisyphus.filesystem.portageRepoDir) subprocess.call(['git', 'init', '-q']) subprocess.call(['git', 'remote', 'add', 'origin', 'https://gitlab.com/redcore/portage.git']) subprocess.call(['git', 'fetch', '--depth=1', 'origin', 'next', '--quiet']) @@ -16,8 +16,8 @@ def setGitlabNextStage1(): @animation.wait('injecting redcore linux ebuild tree - branch next') def setGitlabNextStage2(): - if not os.path.isdir(os.path.join(sisyphus.filesystem.redcoreEbuildDir, '.git')): - os.chdir(sisyphus.filesystem.redcoreEbuildDir) + if not os.path.isdir(os.path.join(sisyphus.filesystem.redcoreRepoDir, '.git')): + os.chdir(sisyphus.filesystem.redcoreRepoDir) subprocess.call(['git', 'init', '-q']) subprocess.call(['git', 'remote', 'add', 'origin', 'https://gitlab.com/redcore/redcore-desktop.git']) subprocess.call(['git', 'fetch', '--depth=1', 'origin', 'next', '--quiet']) @@ -39,8 +39,8 @@ def startGitlab(): @animation.wait('injecting gentoo linux portage tree - branch next') def setPagureNextStage1(): - if not os.path.isdir(os.path.join(sisyphus.filesystem.gentooEbuildDir, '.git')): - os.chdir(sisyphus.filesystem.gentooEbuildDir) + if not os.path.isdir(os.path.join(sisyphus.filesystem.portageRepoDir, '.git')): + os.chdir(sisyphus.filesystem.portageRepoDir) subprocess.call(['git', 'init', '-q']) subprocess.call(['git', 'remote', 'add', 'origin', 'https://pagure.io/redcore/portage.git']) subprocess.call(['git', 'fetch', '--depth=1', 'origin', 'next', '--quiet']) @@ -48,8 +48,8 @@ def setPagureNextStage1(): @animation.wait('injecting redcore linux ebuild tree - branch next') def setPagureNextStage2(): - if not os.path.isdir(os.path.join(sisyphus.filesystem.redcoreEbuildDir, '.git')): - os.chdir(sisyphus.filesystem.redcoreEbuildDir) + if not os.path.isdir(os.path.join(sisyphus.filesystem.redcoreRepoDir, '.git')): + os.chdir(sisyphus.filesystem.redcoreRepoDir) subprocess.call(['git', 'init', '-q']) subprocess.call(['git', 'remote', 'add', 'origin', 'https://pagure.io/redcore/redcore-desktop.git']) subprocess.call(['git', 'fetch', '--depth=1', 'origin', 'next', '--quiet']) diff --git a/src/backend/branchreset.py b/src/backend/branchreset.py index def225a..6df4347 100644 --- a/src/backend/branchreset.py +++ b/src/backend/branchreset.py @@ -7,23 +7,23 @@ import sisyphus.filesystem @animation.wait('resetting branch configuration') def start(): - if os.path.isdir(sisyphus.filesystem.gentooEbuildDir): - for files in os.listdir(sisyphus.filesystem.gentooEbuildDir): - if os.path.isfile(os.path.join(sisyphus.filesystem.gentooEbuildDir, files)): - os.remove(os.path.join(sisyphus.filesystem.gentooEbuildDir, files)) + 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.gentooEbuildDir, files)) + shutil.rmtree(os.path.join(sisyphus.filesystem.portageRepoDir, files)) else: - os.makedirs(sisyphus.filesystem.gentooEbuildDir) + os.makedirs(sisyphus.filesystem.portageRepoDir) - if os.path.isdir(sisyphus.filesystem.redcoreEbuildDir): - for files in os.listdir(sisyphus.filesystem.redcoreEbuildDir): - if os.path.isfile(os.path.join(sisyphus.filesystem.redcoreEbuildDir, files)): - os.remove(os.path.join(sisyphus.filesystem.redcoreEbuildDir, files)) + 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.redcoreEbuildDir, files)) + shutil.rmtree(os.path.join(sisyphus.filesystem.redcoreRepoDir, files)) else: - os.makedirs(sisyphus.filesystem.redcoreEbuildDir) + os.makedirs(sisyphus.filesystem.redcoreRepoDir) if os.path.isdir(sisyphus.filesystem.portageConfigDir): for files in os.listdir(sisyphus.filesystem.portageConfigDir): diff --git a/src/backend/check.py b/src/backend/check.py index ee580a2..9c0a878 100644 --- a/src/backend/check.py +++ b/src/backend/check.py @@ -10,7 +10,7 @@ def root(): sys.exit("\nYou need root permissions to do this, exiting!\n") def portage(): - os.chdir(sisyphus.filesystem.gentooEbuildDir) + os.chdir(sisyphus.filesystem.portageRepoDir) needsPortageSync = int() localBranch = subprocess.check_output(['git', 'rev-parse', '--abbrev-ref', 'HEAD']) @@ -26,7 +26,7 @@ def portage(): return needsPortageSync def overlay(): - os.chdir(sisyphus.filesystem.redcoreEbuildDir) + os.chdir(sisyphus.filesystem.redcoreRepoDir) needsOverlaySync = int() localBranch = subprocess.check_output(['git', 'rev-parse', '--abbrev-ref', 'HEAD']) diff --git a/src/backend/csvfiles.py b/src/backend/csvfiles.py index 67daec4..0c91e81 100644 --- a/src/backend/csvfiles.py +++ b/src/backend/csvfiles.py @@ -4,18 +4,18 @@ import subprocess import io def getURL(): - remotePkgCsv = [] - remoteDescCsv = [] + remotePackagesCsvURL = [] + remoteDescriptionsCsvURL = [] portageExec = subprocess.Popen(['emerge', '--info', '--verbose'], stdout=subprocess.PIPE) for portageOutput in io.TextIOWrapper(portageExec.stdout, encoding="utf-8"): if "PORTAGE_BINHOST" in portageOutput.rstrip(): if "packages-next" in portageOutput.rstrip(): - remotePkgCsv = str(portageOutput.rstrip().split("=")[1].strip('\"').replace('packages-next', 'csv-next') + 'remotePackagesPre.csv') - remoteDescCsv = str(portageOutput.rstrip().split("=")[1].strip('\"').replace('packages-next', 'csv-next') + 'remoteDescriptionsPre.csv') + remotePackagesCsvURL = str(portageOutput.rstrip().split("=")[1].strip('\"').replace('packages-next', 'csv-next') + 'remotePackagesPre.csv') + remoteDescriptionsCsvURL = str(portageOutput.rstrip().split("=")[1].strip('\"').replace('packages-next', 'csv-next') + 'remoteDescriptionsPre.csv') else: - remotePkgCsv = str(portageOutput.rstrip().split("=")[1].strip('\"').replace('packages', 'csv') + 'remotePackagesPre.csv') - remoteDescCsv = str(portageOutput.rstrip().split("=")[1].strip('\"').replace('packages', 'csv') + 'remoteDescriptionsPre.csv') + remotePackagesCsvURL = str(portageOutput.rstrip().split("=")[1].strip('\"').replace('packages', 'csv') + 'remotePackagesPre.csv') + remoteDescriptionsCsvURL = str(portageOutput.rstrip().split("=")[1].strip('\"').replace('packages', 'csv') + 'remoteDescriptionsPre.csv') portageExec.wait() - return remotePkgCsv,remoteDescCsv + return remotePackagesCsvURL,remoteDescriptionsCsvURL diff --git a/src/backend/database.py b/src/backend/database.py index 21db17e..9eb3bf5 100644 --- a/src/backend/database.py +++ b/src/backend/database.py @@ -9,13 +9,13 @@ import sisyphus.csvfiles import sisyphus.filesystem def getRemote(): - remotePkgCsv,remoteDescCsv = sisyphus.csvfiles.getURL() + remotePackagesCsvURL,remoteDescriptionsCsvURL = sisyphus.csvfiles.getURL() http = urllib3.PoolManager() - with http.request('GET', remotePkgCsv, preload_content=False) as tmp_buffer, open(sisyphus.filesystem.remotePkgsDB, 'wb') as output_file: + with http.request('GET', remotePackagesCsvURL, preload_content=False) as tmp_buffer, open(sisyphus.filesystem.remotePackagesCsv, 'wb') as output_file: shutil.copyfileobj(tmp_buffer, output_file) - with http.request('GET', remoteDescCsv, preload_content=False) as tmp_buffer, open(sisyphus.filesystem.remoteDscsDB, 'wb') as output_file: + with http.request('GET', remoteDescriptionsCsvURL, preload_content=False) as tmp_buffer, open(sisyphus.filesystem.remoteDescriptionsCsv, 'wb') as output_file: shutil.copyfileobj(tmp_buffer, output_file) def makeLocal(): @@ -24,18 +24,18 @@ def makeLocal(): def syncRemote(): getRemote() - sisyphusdb = sqlite3.connect(sisyphus.filesystem.sisyphusDB) + sisyphusdb = sqlite3.connect(sisyphus.filesystem.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.remotePkgsDB) as rmtCsv: - for row in csv.reader(rmtCsv): + with open(sisyphus.filesystem.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.remoteDscsDB) as rmtCsv: - for row in csv.reader(rmtCsv): + with open(sisyphus.filesystem.remoteDescriptionsCsv) as input_file: + for row in csv.reader(input_file): sisyphusdb.cursor().execute("insert into remote_descriptions (category, name, description) values (?, ?, ?);", row) sisyphusdb.commit() @@ -44,12 +44,12 @@ def syncRemote(): def syncLocal(): makeLocal() - sisyphusdb = sqlite3.connect(sisyphus.filesystem.sisyphusDB) + sisyphusdb = sqlite3.connect(sisyphus.filesystem.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.localPkgsDB) as lclCsv: - for row in csv.reader(lclCsv): + with open(sisyphus.filesystem.localPackagesCsv) as input_file: + for row in csv.reader(input_file): sisyphusdb.cursor().execute("insert into local_packages (category, name, version, slot) values (?, ?, ?, ?);", row) sisyphusdb.commit() diff --git a/src/backend/filesystem.py b/src/backend/filesystem.py index 4338a2a..5b17bca 100644 --- a/src/backend/filesystem.py +++ b/src/backend/filesystem.py @@ -1,12 +1,12 @@ #!/usr/bin/python3 -gentooEbuildDir = '/usr/ports/gentoo' -redcoreEbuildDir = '/usr/ports/redcore' +portageRepoDir = '/usr/ports/gentoo' +redcoreRepoDir = '/usr/ports/redcore' portageConfigDir = '/opt/redcore-build' portageCacheDir = '/var/cache/packages' portageMetadataDir = '/var/cache/edb' -remotePkgsDB = '/var/lib/sisyphus/csv/remotePackagesPre.csv' -remoteDscsDB = '/var/lib/sisyphus/csv/remoteDescriptionsPre.csv' -localPkgsDB = '/var/lib/sisyphus/csv/localPackagesPre.csv' -sisyphusDB = '/var/lib/sisyphus/db/sisyphus.db' +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' mirrorCfg = '/etc/sisyphus/mirrors.conf' diff --git a/src/backend/rescue.py b/src/backend/rescue.py index 96d347f..26e7c68 100644 --- a/src/backend/rescue.py +++ b/src/backend/rescue.py @@ -7,14 +7,14 @@ import sisyphus.filesystem @animation.wait('recovering databases') def start(): - if os.path.exists(sisyphus.filesystem.remotePkgsDB): - os.remove(sisyphus.filesystem.remotePkgsDB) - if os.path.exists(sisyphus.filesystem.remoteDscsDB): - os.remove(sisyphus.filesystem.remoteDscsDB) - if os.path.exists(sisyphus.filesystem.localPkgsDB): - os.remove(sisyphus.filesystem.localPkgsDB) - if os.path.exists(sisyphus.filesystem.sisyphusDB): - os.remove(sisyphus.filesystem.sisyphusDB) + 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/sync.py b/src/backend/sync.py index 65afd2f..5d3ac23 100644 --- a/src/backend/sync.py +++ b/src/backend/sync.py @@ -5,7 +5,7 @@ import subprocess import sisyphus.filesystem def portage(): - os.chdir(sisyphus.filesystem.gentooEbuildDir) + os.chdir(sisyphus.filesystem.portageRepoDir) localBranch = subprocess.check_output(['git', 'rev-parse', '--abbrev-ref', 'HEAD']) remoteBranch = subprocess.check_output(['git', 'rev-parse', '--symbolic-full-name', '@{u}']) @@ -15,7 +15,7 @@ def portage(): gitExecStage2.wait() def overlay(): - os.chdir(sisyphus.filesystem.redcoreEbuildDir) + os.chdir(sisyphus.filesystem.redcoreRepoDir) 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/frontend/gui/sisyphus-gui.py b/src/frontend/gui/sisyphus-gui.py index 15ef316..a3f1375 100644 --- a/src/frontend/gui/sisyphus-gui.py +++ b/src/frontend/gui/sisyphus-gui.py @@ -204,7 +204,7 @@ class Sisyphus(QtWidgets.QMainWindow): AND iv <> av ''' % (Sisyphus.applicationView, Sisyphus.searchTerm, noVirtual)), ]) - with sqlite3.connect(sisyphus.filesystem.sisyphusDB) as db: + with sqlite3.connect(sisyphus.filesystem.localDatabase) as db: cursor = db.cursor() cursor.execute('%s' % (self.SELECTS[Sisyphus.databaseView])) rows = cursor.fetchall() |