summaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/__init__.py1
-rw-r--r--src/backend/download.py57
-rw-r--r--src/backend/getfs.py1
-rw-r--r--src/backend/install.py23
-rw-r--r--src/backend/purgeenv.py8
-rw-r--r--src/backend/update.py1
-rw-r--r--src/backend/upgrade.py23
7 files changed, 45 insertions, 69 deletions
diff --git a/src/backend/__init__.py b/src/backend/__init__.py
index 9c38585..9ea56c6 100644
--- a/src/backend/__init__.py
+++ b/src/backend/__init__.py
@@ -1,6 +1,5 @@
from .autoremove import *
from .checkenv import *
-from .download import *
from .getcolor import *
from .getenv import *
from .getfs import *
diff --git a/src/backend/download.py b/src/backend/download.py
deleted file mode 100644
index cd250f0..0000000
--- a/src/backend/download.py
+++ /dev/null
@@ -1,57 +0,0 @@
-#!/usr/bin/python3
-
-import os
-import pickle
-import shutil
-import wget
-import sisyphus.getcolor
-import sisyphus.getenv
-import sisyphus.getfs
-
-
-def pkg(pkgname):
- binhostURL = sisyphus.getenv.binhostURL()
- areBinaries, areSources, needsConfig = pickle.load(open(os.path.join(
- sisyphus.getfs.portageMetadataDir, "sisyphus_pkgdeps.pickle"), "rb"))
-
- for index, binary in enumerate([package + '.tbz2' for package in areBinaries], start=1):
- print(">>> Downloading binary" + "(" + sisyphus.getcolor.bright_yellow + "{}".format(index) + sisyphus.getcolor.reset + " " + "of" + " " + sisyphus.getcolor.bright_yellow +
- str(len(areBinaries)) + sisyphus.getcolor.reset + ")" + " " + sisyphus.getcolor.magenta + binary.replace('.tbz2', ' ') + sisyphus.getcolor.reset)
- wget.download(binhostURL + binary)
- print("")
-
- 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.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])
-
-
-def world():
- binhostURL = sisyphus.getenv.binhostURL()
- areBinaries, areSources, needsConfig = pickle.load(open(os.path.join(
- sisyphus.getfs.portageMetadataDir, "sisyphus_worlddeps.pickle"), "rb"))
-
- for index, binary in enumerate([package + '.tbz2' for package in areBinaries], start=1):
- print(">>> Downloading binary" + "(" + sisyphus.getcolor.bright_yellow + "{}".format(index) + sisyphus.getcolor.reset + " " + "of" + " " + sisyphus.getcolor.bright_yellow +
- str(len(areBinaries)) + sisyphus.getcolor.reset + ")" + " " + sisyphus.getcolor.magenta + binary.replace('.tbz2', ' ') + sisyphus.getcolor.reset)
- wget.download(binhostURL + binary)
- print("")
-
- 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.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/getfs.py b/src/backend/getfs.py
index 72b058b..32fb225 100644
--- a/src/backend/getfs.py
+++ b/src/backend/getfs.py
@@ -14,6 +14,7 @@ gentooRepoDir = '/usr/ports/gentoo'
redcoreRepoDir = '/usr/ports/redcore'
portageConfigDir = '/opt/redcore-build'
portageCacheDir = '/var/cache/packages'
+portageDistDir = '/var/cache/distfiles'
portageMetadataDir = '/var/cache/edb'
remotePackagesCsv = '/var/lib/sisyphus/csv/remotePackagesPre.csv'
diff --git a/src/backend/install.py b/src/backend/install.py
index 83e2c68..b1bdb0a 100644
--- a/src/backend/install.py
+++ b/src/backend/install.py
@@ -7,7 +7,6 @@ import pickle
import subprocess
import sys
import sisyphus.checkenv
-import sisyphus.download
import sisyphus.getcolor
import sisyphus.getfs
import sisyphus.killemerge
@@ -33,7 +32,9 @@ def start(pkgname):
user_input = input(sisyphus.getcolor.bright_white + "Would you like to proceed?" + sisyphus.getcolor.reset + " " +
"[" + sisyphus.getcolor.bright_green + "Yes" + sisyphus.getcolor.reset + "/" + sisyphus.getcolor.bright_red + "No" + sisyphus.getcolor.reset + "]" + " ")
if user_input.lower() in ['yes', 'y', '']:
- sisyphus.download.pkg(pkgname)
+ portageExec = subprocess.Popen(['emerge', '--quiet', '--verbose', '--getbinpkg', '--getbinpkgonly', '--fetchonly',
+ '--rebuilt-binaries', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n'] + list(pkgname))
+ portageExec.wait()
portageExec = subprocess.Popen(['emerge', '--quiet', '--verbose', '--usepkg', '--usepkgonly',
'--rebuilt-binaries', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n'] + list(pkgname))
portageExec.wait()
@@ -88,7 +89,9 @@ def estart(pkgname):
user_input = input(sisyphus.getcolor.bright_white + "Would you like to proceed?" + sisyphus.getcolor.reset + " " +
"[" + sisyphus.getcolor.bright_green + "Yes" + sisyphus.getcolor.reset + "/" + sisyphus.getcolor.bright_red + "No" + sisyphus.getcolor.reset + "]" + " ")
if user_input.lower() in ['yes', 'y', '']:
- sisyphus.download.pkg(pkgname)
+ portageExec = subprocess.Popen(['emerge', '--quiet', '--verbose', '--getbinpkg', '--getbinpkgonly', '--fetchonly',
+ '--rebuilt-binaries', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n'] + list(pkgname))
+ portageExec.wait()
portageExec = subprocess.Popen(['emerge', '--quiet', '--verbose', '--usepkg', '--usepkgonly',
'--rebuilt-binaries', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n'] + list(pkgname))
portageExec.wait()
@@ -118,7 +121,9 @@ def estart(pkgname):
user_input = input(sisyphus.getcolor.bright_white + "Would you like to proceed?" + sisyphus.getcolor.reset + " " +
"[" + sisyphus.getcolor.bright_green + "Yes" + sisyphus.getcolor.reset + "/" + sisyphus.getcolor.bright_red + "No" + sisyphus.getcolor.reset + "]" + " ")
if user_input.lower() in ['yes', 'y', '']:
- sisyphus.download.pkg(pkgname)
+ portageExec = subprocess.Popen(['emerge', '--quiet', '--verbose', '--getbinpkg', '--fetchonly',
+ '--rebuilt-binaries', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n'] + list(pkgname))
+ portageExec.wait()
portageExec = subprocess.Popen(['emerge', '--quiet', '--verbose', '--usepkg', '--rebuilt-binaries',
'--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n'] + list(pkgname))
portageExec.wait()
@@ -177,7 +182,15 @@ def xstart(pkgname):
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")
- sisyphus.download.pkg(pkgname)
+ portageExec = subprocess.Popen(['emerge', '--quiet', '--verbose', '--getbinpkg', '--getbinpkgonly', '--fetchonly',
+ '--rebuilt-binaries', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n'] + pkgname, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ # kill portage if the program dies or it's terminated by the user
+ atexit.register(sisyphus.killemerge.start, portageExec)
+
+ for portageOutput in io.TextIOWrapper(portageExec.stdout, encoding="utf-8"):
+ print(portageOutput.rstrip())
+
+ portageExec.wait()
portageExec = subprocess.Popen(['emerge', '--quiet', '--verbose', '--usepkg', '--usepkgonly', '--rebuilt-binaries',
'--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n'] + pkgname, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
# kill portage if the program dies or it's terminated by the user
diff --git a/src/backend/purgeenv.py b/src/backend/purgeenv.py
index d9b12c9..b2c96f7 100644
--- a/src/backend/purgeenv.py
+++ b/src/backend/purgeenv.py
@@ -48,6 +48,14 @@ def cache():
shutil.rmtree(os.path.join(
sisyphus.getfs.portageCacheDir, files))
+ if os.path.isdir(sisyphus.getfs.portageDistDir):
+ for files in os.listdir(sisyphus.getfs.portageDistDir):
+ if os.path.isfile(os.path.join(sisyphus.getfs.portageDistDir, files)):
+ os.remove(os.path.join(sisyphus.getfs.portageDistDir, files))
+ else:
+ shutil.rmtree(os.path.join(
+ sisyphus.getfs.portageDistDir, files))
+
def metadata():
if os.path.isdir(sisyphus.getfs.portageMetadataDir):
diff --git a/src/backend/update.py b/src/backend/update.py
index 45d231e..82f66d4 100644
--- a/src/backend/update.py
+++ b/src/backend/update.py
@@ -12,7 +12,6 @@ import sisyphus.syncenv
def syncAll():
- sisyphus.purgeenv.cache()
sisyphus.syncenv.gentooRepo()
sisyphus.syncenv.redcoreRepo()
sisyphus.syncenv.portageConfigRepo()
diff --git a/src/backend/upgrade.py b/src/backend/upgrade.py
index 0ec707c..f3a21c0 100644
--- a/src/backend/upgrade.py
+++ b/src/backend/upgrade.py
@@ -7,7 +7,6 @@ import pickle
import subprocess
import sys
import sisyphus.checkenv
-import sisyphus.download
import sisyphus.getcolor
import sisyphus.getfs
import sisyphus.killemerge
@@ -33,7 +32,9 @@ def start():
user_input = input(sisyphus.getcolor.bright_white + "Would you like to proceed?" + sisyphus.getcolor.reset + " " +
"[" + sisyphus.getcolor.bright_green + "Yes" + sisyphus.getcolor.reset + "/" + sisyphus.getcolor.bright_red + "No " + sisyphus.getcolor.reset + "]" + " ")
if user_input.lower() in ['yes', 'y', '']:
- sisyphus.download.world()
+ portageExec = subprocess.Popen(['emerge', '--quiet', '--verbose', '--update', '--deep', '--newuse', '--getbinpkg', '--getbinpkgonly',
+ '--fetchonly', '--rebuilt-binaries', '--backtrack=100', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n', '@world'])
+ portageExec.wait()
portageExec = subprocess.Popen(['emerge', '--quiet', '--verbose', '--update', '--deep', '--newuse', '--usepkg', '--usepkgonly',
'--rebuilt-binaries', '--backtrack=100', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n', '@world'])
portageExec.wait()
@@ -88,7 +89,9 @@ def estart():
user_input = input(sisyphus.getcolor.bright_white + "Would you like to proceed?" + sisyphus.getcolor.reset + " " +
"[" + sisyphus.getcolor.bright_green + "Yes" + sisyphus.getcolor.reset + "/" + sisyphus.getcolor.bright_red + "No" + sisyphus.getcolor.reset + "]" + " ")
if user_input.lower() in ['yes', 'y', '']:
- sisyphus.download.world()
+ portageExec = subprocess.Popen(['emerge', '--quiet', '--verbose', '--update', '--deep', '--newuse', '--getbinpkg', '--getbinpkgonly',
+ '--fetchonly', '--rebuilt-binaries', '--backtrack=100', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n', '@world'])
+ portageExec.wait()
portageExec = subprocess.Popen(['emerge', '--quiet', '--verbose', '--update', '--deep', '--newuse', '--usepkg', '--usepkgonly',
'--rebuilt-binaries', '--backtrack=100', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n', '@world'])
portageExec.wait()
@@ -118,7 +121,9 @@ def estart():
user_input = input(sisyphus.getcolor.bright_white + "Would you like to proceed?" + sisyphus.getcolor.reset + " " +
"[" + sisyphus.getcolor.bright_green + "Yes" + sisyphus.getcolor.reset + "/" + sisyphus.getcolor.bright_red + "No" + sisyphus.getcolor.reset + "]" + " ")
if user_input.lower() in ['yes', 'y', '']:
- sisyphus.download.world()
+ portageExec = subprocess.Popen(['emerge', '--quiet', '--verbose', '--update', '--deep', '--newuse', '--getbinpkg', '--fetchonly',
+ '--rebuilt-binaries', '--backtrack=100', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n', '@world'])
+ poortageExec.wait()
portageExec = subprocess.Popen(['emerge', '--quiet', '--verbose', '--update', '--deep', '--newuse', '--usepkg',
'--rebuilt-binaries', '--backtrack=100', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n', '@world'])
portageExec.wait()
@@ -182,7 +187,15 @@ def xstart():
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")
- sisyphus.download.world()
+ portageExec = subprocess.Popen(['emerge', '--quiet', '--verbose', '--update', '--deep', '--newuse', '--getbinpkg', '--getbinpkgonly', '--fetchonly', '--rebuilt-binaries',
+ '--backtrack=100', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n', '@world'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ # kill portage if the program dies or it's terminated by the user
+ atexit.register(sisyphus.killemerge.start, portageExec)
+
+ for portageOutput in io.TextIOWrapper(portageExec.stdout, encoding="utf-8"):
+ print(portageOutput.rstrip())
+
+ portageExec.wait()
portageExec = subprocess.Popen(['emerge', '--quiet', '--verbose', '--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)
# kill portage if the program dies or it's terminated by the user