summaryrefslogtreecommitdiff
path: root/src/backend/download.py
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2022-11-04 01:17:57 +0000
committerV3n3RiX <venerix@koprulu.sector>2022-11-04 01:17:57 +0000
commitaebc9aec0b456a848c4266c76b5aa8c20b0ccaaf (patch)
tree4a7a62e0dd2a9a4d46ec7d05c928873f38ed38e2 /src/backend/download.py
parent30f0ed9e0fa8b93b98ce707b4b432c3959dc764c (diff)
Revert "backend : maintain some consistency, shave off some more lines of code"
This reverts commit 30f0ed9e0fa8b93b98ce707b4b432c3959dc764c.
Diffstat (limited to 'src/backend/download.py')
-rw-r--r--src/backend/download.py25
1 files changed, 17 insertions, 8 deletions
diff --git a/src/backend/download.py b/src/backend/download.py
index e21d068..c48b9d2 100644
--- a/src/backend/download.py
+++ b/src/backend/download.py
@@ -7,8 +7,10 @@ import wget
import sisyphus.getenv
import sisyphus.getfs
+def package(pkgname):
+ binhostURL = sisyphus.getenv.binhostURL()
+ areBinaries,areSources,needsConfig = pickle.load(open(os.path.join(sisyphus.getfs.portageMetadataDir, "sisyphus_solvedeps_pkg.pickle"), "rb"))
-def fetchAll():
for index, binary in enumerate([package + '.tbz2' for package in areBinaries], start=1):
print(">>> Downloading binary ({}".format(index) + " " + "of" + " " + str(len(areBinaries)) + ")" + " " + binary)
wget.download(binhostURL + binary)
@@ -24,13 +26,20 @@ def fetchAll():
os.remove(binary.rstrip().split("/")[1])
-def pkg(pkgname):
- binhostURL = sisyphus.getenv.binhostURL()
- areBinaries,areSources,needsConfig = pickle.load(open(os.path.join(sisyphus.getfs.portageMetadataDir, "sisyphus_solvedeps_pkg.pickle"), "rb"))
- fetchAll()
-
-
def world():
binhostURL = sisyphus.getenv.binhostURL()
areBinaries,areSources,needsConfig = pickle.load(open(os.path.join(sisyphus.getfs.portageMetadataDir, "sisyphus_solvedeps_world.pickle"), "rb"))
- fetchAll()
+
+ for index, binary in enumerate([package + '.tbz2' for package in areBinaries], start=1):
+ print(">>> Downloading binary ({}".format(index) + " " + "of" + " " + str(len(areBinaries)) + ")" + " " + binary)
+ 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])