summaryrefslogtreecommitdiff
path: root/src/backend/libsisyphus.py
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2019-03-21 11:59:08 +0000
committerV3n3RiX <venerix@redcorelinux.org>2019-03-21 11:59:08 +0000
commitb741ff730128eca27c70ebc591a67ace44bff1db (patch)
tree79375e52c108d535cc794df328896e834ba614fa /src/backend/libsisyphus.py
parent42df0bc391b29cd42dff591c7e6cbe08558ae29c (diff)
make syncing more robust, rely on git, not emerge
Diffstat (limited to 'src/backend/libsisyphus.py')
-rw-r--r--src/backend/libsisyphus.py74
1 files changed, 40 insertions, 34 deletions
diff --git a/src/backend/libsisyphus.py b/src/backend/libsisyphus.py
index a01c137..43910be 100644
--- a/src/backend/libsisyphus.py
+++ b/src/backend/libsisyphus.py
@@ -12,8 +12,10 @@ import io
import wget
from dateutil import parser
-portageCfg = '/opt/redcore-build/'
-portageCache = '/var/cache/packages/'
+gentooEbuildDir = '/usr/ports/gentoo'
+redcoreEbuildDir = '/usr/ports/redcore'
+portageConfigDir = '/opt/redcore-build'
+portageCacheDir = '/var/cache/packages'
remotePkgsDB = '/var/lib/sisyphus/csv/remotePackagesPre.csv'
remoteDscsDB = '/var/lib/sisyphus/csv/remoteDescriptionsPre.csv'
localPkgsDB = '/var/lib/sisyphus/csv/localPackagesPre.csv'
@@ -170,10 +172,14 @@ def syncLocalDatabase():
sisyphusdb.close()
def syncPortageTree():
- subprocess.call(['emerge', '--sync', '--quiet'])
+ os.chdir(gentooEbuildDir)
+ subprocess.call(['git', 'pull', '--quiet'])
+
+ os.chdir(redcoreEbuildDir)
+ subprocess.call(['git', 'pull', '--quiet'])
def syncPortageCfg():
- os.chdir(portageCfg)
+ os.chdir(portageConfigDir)
subprocess.call(['git', 'pull', '--quiet'])
@animation.wait('syncing remote database')
@@ -241,7 +247,7 @@ def startInstall(pkgList):
if len(areSources) == 0:
if not len(areBinaries) == 0:
- os.chdir(portageCache)
+ os.chdir(portageCacheDir)
print("\n" + "These are the binary packages that would be merged, in order:" + "\n\n" + str(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, url in enumerate([binhostURL + package + '.tbz2' for package in areBinaries]):
@@ -258,11 +264,11 @@ def startInstall(pkgList):
CATEGORY = subprocess.check_output(['qxpak', '-x', '-O'] + str(binpkg + '.xpak').split() + ['CATEGORY'])
os.remove(str(binpkg + '.xpak'))
- if os.path.isdir(portageCache + CATEGORY.decode().strip()):
- shutil.move(str(binpkg + '.tbz2'), os.path.join(portageCache + CATEGORY.decode().strip(), os.path.basename(str(binpkg + '.tbz2'))))
+ if os.path.isdir(portageCacheDir + CATEGORY.decode().strip()):
+ shutil.move(str(binpkg + '.tbz2'), os.path.join(portageCacheDir + CATEGORY.decode().strip(), os.path.basename(str(binpkg + '.tbz2'))))
else:
- os.makedirs(portageCache + CATEGORY.decode().strip())
- shutil.move(str(binpkg + '.tbz2'), os.path.join(portageCache + CATEGORY.decode().strip(), os.path.basename(str(binpkg + '.tbz2'))))
+ os.makedirs(portageCacheDir + CATEGORY.decode().strip())
+ shutil.move(str(binpkg + '.tbz2'), os.path.join(portageCacheDir + CATEGORY.decode().strip(), os.path.basename(str(binpkg + '.tbz2'))))
if os.path.exists(str(binpkg + '.tbz2')):
os.remove(str(binpkg + '.tbz2'))
@@ -293,7 +299,7 @@ def startHybridInstall(pkgList):
if needsConfig == 0:
if len(areSources) == 0:
if not len(areBinaries) == 0:
- os.chdir(portageCache)
+ os.chdir(portageCacheDir)
print("\n" + "These are the binary packages that would be merged, in order:" + "\n\n" + str(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, url in enumerate([binhostURL + package + '.tbz2' for package in areBinaries]):
@@ -310,11 +316,11 @@ def startHybridInstall(pkgList):
CATEGORY = subprocess.check_output(['qxpak', '-x', '-O'] + str(binpkg + '.xpak').split() + ['CATEGORY'])
os.remove(str(binpkg + '.xpak'))
- if os.path.isdir(portageCache + CATEGORY.decode().strip()):
- shutil.move(str(binpkg + '.tbz2'), os.path.join(portageCache + CATEGORY.decode().strip(), os.path.basename(str(binpkg + '.tbz2'))))
+ if os.path.isdir(portageCacheDir + CATEGORY.decode().strip()):
+ shutil.move(str(binpkg + '.tbz2'), os.path.join(portageCacheDir + CATEGORY.decode().strip(), os.path.basename(str(binpkg + '.tbz2'))))
else:
- os.makedirs(portageCache + CATEGORY.decode().strip())
- shutil.move(str(binpkg + '.tbz2'), os.path.join(portageCache + CATEGORY.decode().strip(), os.path.basename(str(binpkg + '.tbz2'))))
+ os.makedirs(portageCacheDir + CATEGORY.decode().strip())
+ shutil.move(str(binpkg + '.tbz2'), os.path.join(portageCacheDir + CATEGORY.decode().strip(), os.path.basename(str(binpkg + '.tbz2'))))
if os.path.exists(str(binpkg + '.tbz2')):
os.remove(str(binpkg + '.tbz2'))
@@ -334,7 +340,7 @@ def startHybridInstall(pkgList):
sys.exit("\n" + "No package found; Quitting." + "\n")
else:
if not len(areBinaries) == 0:
- os.chdir(portageCache)
+ os.chdir(portageCacheDir)
print("\n" + "These are the binary packages that would be merged, in order:" + "\n\n" + str(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" + str(areSources) + "\n\n" + "Total:" + " " + str(len(areSources)) + " " + "source package(s)" + "\n")
if input("Would you like to proceed?" + " " + "[y/N]" + " ").lower().strip()[:1] == "y":
@@ -352,11 +358,11 @@ def startHybridInstall(pkgList):
CATEGORY = subprocess.check_output(['qxpak', '-x', '-O'] + str(binpkg + '.xpak').split() + ['CATEGORY'])
os.remove(str(binpkg + '.xpak'))
- if os.path.isdir(portageCache + CATEGORY.decode().strip()):
- shutil.move(str(binpkg + '.tbz2'), os.path.join(portageCache + CATEGORY.decode().strip(), os.path.basename(str(binpkg + '.tbz2'))))
+ if os.path.isdir(portageCacheDir + CATEGORY.decode().strip()):
+ shutil.move(str(binpkg + '.tbz2'), os.path.join(portageCacheDir + CATEGORY.decode().strip(), os.path.basename(str(binpkg + '.tbz2'))))
else:
- os.makedirs(portageCache + CATEGORY.decode().strip())
- shutil.move(str(binpkg + '.tbz2'), os.path.join(portageCache + CATEGORY.decode().strip(), os.path.basename(str(binpkg + '.tbz2'))))
+ os.makedirs(portageCacheDir + CATEGORY.decode().strip())
+ shutil.move(str(binpkg + '.tbz2'), os.path.join(portageCacheDir + CATEGORY.decode().strip(), os.path.basename(str(binpkg + '.tbz2'))))
if os.path.exists(str(binpkg + '.tbz2')):
os.remove(str(binpkg + '.tbz2'))
@@ -407,7 +413,7 @@ def startUpgrade():
if len(areSources) == 0:
if not len(areBinaries) == 0:
- os.chdir(portageCache)
+ os.chdir(portageCacheDir)
print("\n" + "These are the binary packages that would be merged, in order:" + "\n\n" + str(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, url in enumerate([binhostURL + package + '.tbz2' for package in areBinaries]):
@@ -424,11 +430,11 @@ def startUpgrade():
CATEGORY = subprocess.check_output(['qxpak', '-x', '-O'] + str(binpkg + '.xpak').split() + ['CATEGORY'])
os.remove(str(binpkg + '.xpak'))
- if os.path.isdir(portageCache + CATEGORY.decode().strip()):
- shutil.move(str(binpkg + '.tbz2'), os.path.join(portageCache + CATEGORY.decode().strip(), os.path.basename(str(binpkg + '.tbz2'))))
+ if os.path.isdir(portageCacheDir + CATEGORY.decode().strip()):
+ shutil.move(str(binpkg + '.tbz2'), os.path.join(portageCacheDir + CATEGORY.decode().strip(), os.path.basename(str(binpkg + '.tbz2'))))
else:
- os.makedirs(portageCache + CATEGORY.decode().strip())
- shutil.move(str(binpkg + '.tbz2'), os.path.join(portageCache + CATEGORY.decode().strip(), os.path.basename(str(binpkg + '.tbz2'))))
+ os.makedirs(portageCacheDir + CATEGORY.decode().strip())
+ shutil.move(str(binpkg + '.tbz2'), os.path.join(portageCacheDir + CATEGORY.decode().strip(), os.path.basename(str(binpkg + '.tbz2'))))
if os.path.exists(str(binpkg + '.tbz2')):
os.remove(str(binpkg + '.tbz2'))
@@ -459,7 +465,7 @@ def startHybridUpgrade():
if needsConfig == 0:
if len(areSources) == 0:
if not len(areBinaries) == 0:
- os.chdir(portageCache)
+ os.chdir(portageCacheDir)
print("\n" + "These are the binary packages that would be merged, in order:" + "\n\n" + str(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, url in enumerate([binhostURL + package + '.tbz2' for package in areBinaries]):
@@ -476,11 +482,11 @@ def startHybridUpgrade():
CATEGORY = subprocess.check_output(['qxpak', '-x', '-O'] + str(binpkg + '.xpak').split() + ['CATEGORY'])
os.remove(str(binpkg + '.xpak'))
- if os.path.isdir(portageCache + CATEGORY.decode().strip()):
- shutil.move(str(binpkg + '.tbz2'), os.path.join(portageCache + CATEGORY.decode().strip(), os.path.basename(str(binpkg + '.tbz2'))))
+ if os.path.isdir(portageCacheDir + CATEGORY.decode().strip()):
+ shutil.move(str(binpkg + '.tbz2'), os.path.join(portageCacheDir + CATEGORY.decode().strip(), os.path.basename(str(binpkg + '.tbz2'))))
else:
- os.makedirs(portageCache + CATEGORY.decode().strip())
- shutil.move(str(binpkg + '.tbz2'), os.path.join(portageCache + CATEGORY.decode().strip(), os.path.basename(str(binpkg + '.tbz2'))))
+ os.makedirs(portageCacheDir + CATEGORY.decode().strip())
+ shutil.move(str(binpkg + '.tbz2'), os.path.join(portageCacheDir + CATEGORY.decode().strip(), os.path.basename(str(binpkg + '.tbz2'))))
if os.path.exists(str(binpkg + '.tbz2')):
os.remove(str(binpkg + '.tbz2'))
@@ -500,7 +506,7 @@ def startHybridUpgrade():
sys.exit("\n" + "No package upgrades found; Quitting." + "\n")
else:
if not len(areBinaries) == 0:
- os.chdir(portageCache)
+ os.chdir(portageCacheDir)
print("\n" + "These are the binary packages that would be merged, in order:" + "\n\n" + str(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" + str(areSources) + "\n\n" + "Total:" + " " + str(len(areSources)) + " " + "source package(s)" + "\n")
if input("Would you like to proceed?" + " " + "[y/N]" + " ").lower().strip()[:1] == "y":
@@ -518,11 +524,11 @@ def startHybridUpgrade():
CATEGORY = subprocess.check_output(['qxpak', '-x', '-O'] + str(binpkg + '.xpak').split() + ['CATEGORY'])
os.remove(str(binpkg + '.xpak'))
- if os.path.isdir(portageCache + CATEGORY.decode().strip()):
- shutil.move(str(binpkg + '.tbz2'), os.path.join(portageCache + CATEGORY.decode().strip(), os.path.basename(str(binpkg + '.tbz2'))))
+ if os.path.isdir(portageCacheDir + CATEGORY.decode().strip()):
+ shutil.move(str(binpkg + '.tbz2'), os.path.join(portageCacheDir + CATEGORY.decode().strip(), os.path.basename(str(binpkg + '.tbz2'))))
else:
- os.makedirs(portageCache + CATEGORY.decode().strip())
- shutil.move(str(binpkg + '.tbz2'), os.path.join(portageCache + CATEGORY.decode().strip(), os.path.basename(str(binpkg + '.tbz2'))))
+ os.makedirs(portageCacheDir + CATEGORY.decode().strip())
+ shutil.move(str(binpkg + '.tbz2'), os.path.join(portageCacheDir + CATEGORY.decode().strip(), os.path.basename(str(binpkg + '.tbz2'))))
if os.path.exists(str(binpkg + '.tbz2')):
os.remove(str(binpkg + '.tbz2'))