summaryrefslogtreecommitdiff
path: root/src/backend/download.py
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2023-01-16 13:02:03 +0000
committerV3n3RiX <venerix@koprulu.sector>2023-01-16 13:02:03 +0000
commit5997105bebeb1f3ea15be1c9ee00e36daf5d534d (patch)
tree5f86262c60ce42a2aedc2b9a16352911f2d3a406 /src/backend/download.py
parent3ebd08b3abf4ce930cc8f3be313e3d49f541affd (diff)
new download method is more reliable, but slower...speed it up againv5.2301.1
Diffstat (limited to 'src/backend/download.py')
-rw-r--r--src/backend/download.py99
1 files changed, 99 insertions, 0 deletions
diff --git a/src/backend/download.py b/src/backend/download.py
new file mode 100644
index 0000000..fce0148
--- /dev/null
+++ b/src/backend/download.py
@@ -0,0 +1,99 @@
+#!/usr/bin/python3
+
+import atexit
+import io
+import os
+import subprocess
+import pickle
+import sisyphus.getfs
+import sisyphus.killemerge
+
+
+def pkgbinpkgonly():
+ fetchList = []
+ areBinaries, areSources, needsConfig = pickle.load(open(os.path.join(
+ sisyphus.getfs.portageMetadataDir, "sisyphus_pkgdeps.pickle"), "rb"))
+
+ for index, binary in enumerate(['=' + package for package in areBinaries]):
+ fetchList.append(binary)
+
+ portageExec = subprocess.Popen(['emerge', '--nodeps', '--quiet', '--verbose', '--getbinpkg', '--getbinpkgonly', '--fetchonly',
+ '--rebuilt-binaries', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n'] + list(fetchList))
+ portageExec.wait()
+
+
+def pkgbinpkg():
+ fetchList = []
+ areBinaries, areSources, needsConfig = pickle.load(open(os.path.join(
+ sisyphus.getfs.portageMetadataDir, "sisyphus_pkgdeps.pickle"), "rb"))
+
+ for index, binary in enumerate(['=' + package for package in areBinaries]):
+ fetchList.append(binary)
+
+ portageExec = subprocess.Popen(['emerge', '--nodeps', '--quiet', '--verbose', '--getbinpkg', '--fetchonly',
+ '--rebuilt-binaries', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n'] + list(fetchList))
+ portageExec.wait()
+
+
+def xpkgbinpkgonly():
+ fetchList = []
+ areBinaries, areSources, needsConfig = pickle.load(open(os.path.join(
+ sisyphus.getfs.portageMetadataDir, "sisyphus_pkgdeps.pickle"), "rb"))
+
+ for index, binary in enumerate(['=' + package for package in areBinaries]):
+ fetchList.append(binary)
+
+ portageExec = subprocess.Popen(['emerge', '--nodeps', '--quiet', '--verbose', '--getbinpkg', '--getbinpkgonly', '--fetchonly', '--rebuilt-binaries',
+ '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n'] + list(fetchList), 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()
+
+
+def worldbinpkgonly():
+ fetchList = []
+ areBinaries, areSources, needsConfig = pickle.load(open(os.path.join(
+ sisyphus.getfs.portageMetadataDir, "sisyphus_worlddeps.pickle"), "rb"))
+
+ for index, binary in enumerate(['=' + package for package in areBinaries]):
+ fetchList.append(binary)
+
+ portageExec = subprocess.Popen(['emerge', '--nodeps', '--quiet', '--verbose', '--getbinpkg', '--getbinpkgonly', '--fetchonly',
+ '--rebuilt-binaries', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n'] + list(fetchList))
+ portageExec.wait()
+
+
+def worldbinpkg():
+ fetchList = []
+ areBinaries, areSources, needsConfig = pickle.load(open(os.path.join(
+ sisyphus.getfs.portageMetadataDir, "sisyphus_worlddeps.pickle"), "rb"))
+
+ for index, binary in enumerate(['=' + package for package in areBinaries]):
+ fetchList.append(binary)
+
+ portageExec = subprocess.Popen(['emerge', '--nodeps', '--quiet', '--verbose', '--getbinpkg', '--fetchonly',
+ '--rebuilt-binaries', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n'] + list(fetchList))
+ portageExec.wait()
+
+
+def xworldbinpkgonly():
+ fetchList = []
+ areBinaries, areSources, needsConfig = pickle.load(open(os.path.join(
+ sisyphus.getfs.portageMetadataDir, "sisyphus_worlddeps.pickle"), "rb"))
+
+ for index, binary in enumerate(['=' + package for package in areBinaries]):
+ fetchList.append(binary)
+
+ portageExec = subprocess.Popen(['emerge', '--nodeps', '--quiet', '--verbose', '--getbinpkg', '--getbinpkgonly', '--fetchonly', '--rebuilt-binaries',
+ '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n'] + list(fetchList), 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()