summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/backend/__init__.py2
-rw-r--r--src/backend/autoRemoveAll.py4
-rw-r--r--src/backend/getCSV.py17
-rw-r--r--src/backend/getEnvironment.py28
-rw-r--r--src/backend/installPkg.py4
-rw-r--r--src/backend/installSrc.py6
-rw-r--r--src/backend/recoverDatabase.py4
-rw-r--r--src/backend/syncDatabase.py16
-rw-r--r--src/backend/syncSPM.py2
-rw-r--r--src/backend/uninstallAll.py4
-rw-r--r--src/backend/uninstallAllForce.py2
-rw-r--r--src/backend/updateAll.py2
-rw-r--r--src/backend/upgradePkg.py4
-rw-r--r--src/backend/upgradeSrc.py6
14 files changed, 56 insertions, 45 deletions
diff --git a/src/backend/__init__.py b/src/backend/__init__.py
index d34f90c..26e1487 100644
--- a/src/backend/__init__.py
+++ b/src/backend/__init__.py
@@ -1,7 +1,7 @@
from .autoRemoveAll import *
from .checkEnvironment import *
from .getBinhost import *
-from .getCSV import *
+from .getEnvironment import *
from .getFilesystem import *
from .installPkg import *
from .installSrc import *
diff --git a/src/backend/autoRemoveAll.py b/src/backend/autoRemoveAll.py
index 191c10e..982c7b3 100644
--- a/src/backend/autoRemoveAll.py
+++ b/src/backend/autoRemoveAll.py
@@ -12,7 +12,7 @@ def start():
if sisyphus.checkEnvironment.root():
portageExec = subprocess.Popen(['emerge', '--quiet', '--depclean', '--ask'])
portageExec.wait()
- sisyphus.syncDatabase.syncLocal()
+ sisyphus.syncDatabase.localTable()
else:
sys.exit("\nYou need root permissions to do this, exiting!\n")
@@ -25,4 +25,4 @@ def startqt():
print(portageOutput.rstrip())
portageExec.wait()
- sisyphus.syncDatabase.syncLocal()
+ sisyphus.syncDatabase.localTable()
diff --git a/src/backend/getCSV.py b/src/backend/getCSV.py
deleted file mode 100644
index 798f163..0000000
--- a/src/backend/getCSV.py
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/usr/bin/python3
-
-import sisyphus.getBinhost
-
-def start():
- isPackageCsv = []
- isDescriptionCsv = []
- isBinhost = sisyphus.getBinhost.start()
-
- if "packages-next" in isBinhost:
- isPackageCsv = isBinhost.replace('packages-next', 'csv-next') + 'remotePackagesPre.csv'
- isDescriptionCsv = isBinhost.replace('packages-next', 'csv-next') + 'remoteDescriptionsPre.csv'
- else:
- isPackageCsv = isBinhost.replace('packages', 'csv') + 'remotePackagesPre.csv'
- isDescriptionCsv = isBinhost.replace('packages', 'csv') + 'remoteDescriptionsPre.csv'
-
- return isPackageCsv,isDescriptionCsv
diff --git a/src/backend/getEnvironment.py b/src/backend/getEnvironment.py
new file mode 100644
index 0000000..4214986
--- /dev/null
+++ b/src/backend/getEnvironment.py
@@ -0,0 +1,28 @@
+#!/usr/bin/python3
+
+import subprocess
+
+def binhostURL():
+ binhostURL = []
+ portageExec = subprocess.Popen(['emerge', '--info', '--verbose'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ stdout, stderr = portageExec.communicate()
+
+ for portageOutput in stdout.decode('ascii').splitlines():
+ if "PORTAGE_BINHOST" in portageOutput:
+ binhostURL = portageOutput.rstrip().split("=")[1].strip('\"')
+
+ return binhostURL
+
+def csvURL():
+ csvURL = binhostURL()
+ packagesCsvURL = []
+ descriptionsCsvURL = []
+
+ if "packages-next" in csvURL:
+ packagesCsvURL = csvURL.replace('packages-next', 'csv-next') + 'remotePackagesPre.csv'
+ descriptionsCsvURL = csvURL.replace('packages-next', 'csv-next') + 'remoteDescriptionsPre.csv'
+ else:
+ packagesCsvURL = csvURL.replace('packages', 'csv') + 'remotePackagesPre.csv'
+ descriptionsCsvURL = csvURL.replace('packages', 'csv') + 'remoteDescriptionsPre.csv'
+
+ return packagesCsvURL,descriptionsCsvURL
diff --git a/src/backend/installPkg.py b/src/backend/installPkg.py
index e9373da..d827a3a 100644
--- a/src/backend/installPkg.py
+++ b/src/backend/installPkg.py
@@ -49,7 +49,7 @@ def start(pkgname):
print(portageOutput.rstrip())
portageExec.wait()
- sisyphus.syncDatabase.syncLocal()
+ sisyphus.syncDatabase.localTable()
else:
sys.exit("\n" + "Ok; Quitting." + "\n")
else:
@@ -92,4 +92,4 @@ def startqt(pkgname):
print(portageOutput.rstrip())
portageExec.wait()
- sisyphus.syncDatabase.syncLocal()
+ sisyphus.syncDatabase.localTable()
diff --git a/src/backend/installSrc.py b/src/backend/installSrc.py
index d5fc92b..115091d 100644
--- a/src/backend/installSrc.py
+++ b/src/backend/installSrc.py
@@ -48,7 +48,7 @@ def start(pkgname):
print(portageOutput.rstrip())
portageExec.wait()
- sisyphus.syncDatabase.syncLocal()
+ sisyphus.syncDatabase.localTable()
else:
sys.exit("\n" + "Ok; Quitting." + "\n")
else:
@@ -81,7 +81,7 @@ def start(pkgname):
print(portageOutput.rstrip())
portageExec.wait()
- sisyphus.syncDatabase.syncLocal()
+ sisyphus.syncDatabase.localTable()
else:
sys.exit("\n" + "Ok; Quitting." + "\n")
else:
@@ -95,7 +95,7 @@ def start(pkgname):
print(portageOutput.rstrip())
portageExec.wait()
- sisyphus.syncDatabase.syncLocal()
+ sisyphus.syncDatabase.localTable()
else:
sys.exit("\n" + "Ok; Quitting." + "\n")
else:
diff --git a/src/backend/recoverDatabase.py b/src/backend/recoverDatabase.py
index a17c9f1..03e57a2 100644
--- a/src/backend/recoverDatabase.py
+++ b/src/backend/recoverDatabase.py
@@ -16,5 +16,5 @@ def start():
if os.path.exists(sisyphus.getFilesystem.localDatabase):
os.remove(sisyphus.getFilesystem.localDatabase)
- sisyphus.syncDatabase.syncRemote()
- sisyphus.syncDatabase.syncLocal()
+ sisyphus.syncDatabase.remoteTable()
+ sisyphus.syncDatabase.localTable()
diff --git a/src/backend/syncDatabase.py b/src/backend/syncDatabase.py
index 9aa72d6..e70a75c 100644
--- a/src/backend/syncDatabase.py
+++ b/src/backend/syncDatabase.py
@@ -5,11 +5,11 @@ import shutil
import urllib3
import sqlite3
import subprocess
-import sisyphus.getCSV
+import sisyphus.getEnvironment
import sisyphus.getFilesystem
-def getRemote():
- isPackageCsv,isDescriptionCsv = sisyphus.getCSV.start()
+def remoteCSV():
+ packagesCsvURL,descriptionCsvURL = sisyphus.getEnvironment.csvURL()
http = urllib3.PoolManager()
with http.request('GET', isPackageCsv, preload_content=False) as tmp_buffer, open(sisyphus.getFilesystem.remotePackagesCsv, 'wb') as output_file:
@@ -18,11 +18,11 @@ def getRemote():
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():
+def localCSV():
subprocess.call(['/usr/share/sisyphus/helpers/make_local_csv'])
-def syncRemote():
- getRemote()
+def remoteTable():
+ remoteCSV()
sisyphusdb = sqlite3.connect(sisyphus.getFilesystem.localDatabase)
sisyphusdb.cursor().execute('''drop table if exists remote_packages''')
@@ -41,8 +41,8 @@ def syncRemote():
sisyphusdb.commit()
sisyphusdb.close()
-def syncLocal():
- makeLocal()
+def localTable():
+ localCSV()
sisyphusdb = sqlite3.connect(sisyphus.getFilesystem.localDatabase)
sisyphusdb.cursor().execute('''drop table if exists local_packages''')
diff --git a/src/backend/syncSPM.py b/src/backend/syncSPM.py
index 89cc5df..c049c64 100644
--- a/src/backend/syncSPM.py
+++ b/src/backend/syncSPM.py
@@ -5,4 +5,4 @@ import sisyphus.syncDatabase
@animation.wait('syncing spm changes')
def start():
- sisyphus.syncDatabase.syncLocal()
+ sisyphus.syncDatabase.localTable()
diff --git a/src/backend/uninstallAll.py b/src/backend/uninstallAll.py
index 1bf8664..4dfe2cc 100644
--- a/src/backend/uninstallAll.py
+++ b/src/backend/uninstallAll.py
@@ -12,7 +12,7 @@ def start(pkgname):
if sisyphus.checkEnvironment.root():
portageExec = subprocess.Popen(['emerge', '--quiet', '--depclean', '--ask'] + list(pkgname))
portageExec.wait()
- sisyphus.syncDatabase.syncLocal()
+ sisyphus.syncDatabase.localTable()
else:
sys.exit("\nYou need root permissions to do this, exiting!\n")
@@ -25,4 +25,4 @@ def startqt(pkgname):
print(portageOutput.rstrip())
portageExec.wait()
- sisyphus.syncDatabase.syncLocal()
+ sisyphus.syncDatabase.localTable()
diff --git a/src/backend/uninstallAllForce.py b/src/backend/uninstallAllForce.py
index d3e78ed..d2acc2d 100644
--- a/src/backend/uninstallAllForce.py
+++ b/src/backend/uninstallAllForce.py
@@ -9,6 +9,6 @@ def start(pkgname):
if sisyphus.checkEnvironment.root():
portageExec = subprocess.Popen(['emerge', '--quiet', '--unmerge', '--ask'] + list(pkgname))
portageExec.wait()
- sisyphus.syncDatabase.syncLocal()
+ sisyphus.syncDatabase.localTable()
else:
sys.exit("\nYou need root permissions to do this, exiting!\n")
diff --git a/src/backend/updateAll.py b/src/backend/updateAll.py
index dedb8d4..7dfd157 100644
--- a/src/backend/updateAll.py
+++ b/src/backend/updateAll.py
@@ -14,7 +14,7 @@ def syncAll():
sisyphus.syncEnvironment.gentooRepo()
sisyphus.syncEnvironment.redcoreRepo()
sisyphus.syncEnvironment.portageConfigRepo()
- sisyphus.syncDatabase.syncRemote()
+ sisyphus.syncDatabase.remoteTable()
@animation.wait('fetching updates')
def start():
diff --git a/src/backend/upgradePkg.py b/src/backend/upgradePkg.py
index d284402..28a6220 100644
--- a/src/backend/upgradePkg.py
+++ b/src/backend/upgradePkg.py
@@ -50,7 +50,7 @@ def start():
print(portageOutput.rstrip())
portageExec.wait()
- sisyphus.syncDatabase.syncLocal()
+ sisyphus.syncDatabase.localTable()
else:
sys.exit("\n" + "Ok; Quitting." + "\n")
else:
@@ -97,6 +97,6 @@ def startqt():
print(portageOutput.rstrip())
portageExec.wait()
- sisyphus.syncDatabase.syncLocal()
+ sisyphus.syncDatabase.localTable()
else:
print("\n" + "No package upgrades found; Quitting." + "\n")
diff --git a/src/backend/upgradeSrc.py b/src/backend/upgradeSrc.py
index 9badd95..9c226f9 100644
--- a/src/backend/upgradeSrc.py
+++ b/src/backend/upgradeSrc.py
@@ -48,7 +48,7 @@ def start():
print(portageOutput.rstrip())
portageExec.wait()
- sisyphus.syncDatabase.syncLocal()
+ sisyphus.syncDatabase.localTable()
else:
sys.exit("\n" + "Ok; Quitting." + "\n")
else:
@@ -81,7 +81,7 @@ def start():
print(portageOutput.rstrip())
portageExec.wait()
- sisyphus.syncDatabase.syncLocal()
+ sisyphus.syncDatabase.localTable()
else:
sys.exit("\n" + "Ok; Quitting." + "\n")
else:
@@ -95,7 +95,7 @@ def start():
print(portageOutput.rstrip())
portageExec.wait()
- sisyphus.syncDatabase.syncLocal()
+ sisyphus.syncDatabase.localTable()
else:
sys.exit("\n" + "Ok; Quitting." + "\n")
else: