diff options
Diffstat (limited to 'src/backend/download.py')
-rw-r--r-- | src/backend/download.py | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/src/backend/download.py b/src/backend/download.py index c48b9d2..e21d068 100644 --- a/src/backend/download.py +++ b/src/backend/download.py @@ -7,10 +7,8 @@ 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) @@ -26,20 +24,13 @@ def package(pkgname): os.remove(binary.rstrip().split("/")[1]) -def world(): +def pkg(pkgname): binhostURL = sisyphus.getenv.binhostURL() - areBinaries,areSources,needsConfig = pickle.load(open(os.path.join(sisyphus.getfs.portageMetadataDir, "sisyphus_solvedeps_world.pickle"), "rb")) - - 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("") + areBinaries,areSources,needsConfig = pickle.load(open(os.path.join(sisyphus.getfs.portageMetadataDir, "sisyphus_solvedeps_pkg.pickle"), "rb")) + fetchAll() - 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_solvedeps_world.pickle"), "rb")) + fetchAll() |