diff options
author | V3n3RiX <venerix@redcorelinux.org> | 2020-06-06 20:37:56 +0100 |
---|---|---|
committer | V3n3RiX <venerix@redcorelinux.org> | 2020-06-06 20:37:56 +0100 |
commit | ed88746cd33c0f861e9c45bf05bf9e44d86089ba (patch) | |
tree | e6656f3d54bd738383d048c744d330dca2c15e4c /src/backend/upgrade.py | |
parent | 2d86cd9ddc5d9442e4a8e8fb50d72480a8293a4a (diff) |
filesystem module : gather all the folder and file paths used by sisyphus under one module, and expose them to other modules from there
Diffstat (limited to 'src/backend/upgrade.py')
-rw-r--r-- | src/backend/upgrade.py | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/src/backend/upgrade.py b/src/backend/upgrade.py index 0a3762d..d2961d6 100644 --- a/src/backend/upgrade.py +++ b/src/backend/upgrade.py @@ -8,11 +8,10 @@ import io import wget import sisyphus.binhost import sisyphus.database +import sisyphus.filesystem import sisyphus.solvedeps import sisyphus.update -portageCacheDir = '/var/cache/packages' - def start(): sisyphus.update.start() @@ -22,7 +21,7 @@ def start(): if needsConfig == 0: if len(areSources) == 0: if not len(areBinaries) == 0: - os.chdir(portageCacheDir) + os.chdir(sisyphus.filesystem.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, binary in enumerate([package + '.tbz2' for package in areBinaries]): @@ -36,11 +35,11 @@ def start(): if os.path.exists(binary.rstrip().split("/")[1].replace('tbz2', 'xpak')): os.remove(binary.rstrip().split("/")[1].replace('tbz2', 'xpak')) - if os.path.isdir(os.path.join(portageCacheDir, CATEGORY.decode().strip())): - shutil.move(binary.rstrip().split("/")[1], os.path.join(os.path.join(portageCacheDir, CATEGORY.decode().strip()), os.path.basename(binary.rstrip().split("/")[1]))) + if os.path.isdir(os.path.join(sisyphus.filesystem.portageCacheDir, CATEGORY.decode().strip())): + shutil.move(binary.rstrip().split("/")[1], os.path.join(os.path.join(sisyphus.filesystem.portageCacheDir, CATEGORY.decode().strip()), os.path.basename(binary.rstrip().split("/")[1]))) else: - os.makedirs(os.path.join(portageCacheDir, CATEGORY.decode().strip())) - shutil.move(binary.rstrip().split("/")[1], os.path.join(os.path.join(portageCacheDir, CATEGORY.decode().strip()), os.path.basename(binary.rstrip().split("/")[1]))) + os.makedirs(os.path.join(sisyphus.filesystem.portageCacheDir, CATEGORY.decode().strip())) + shutil.move(binary.rstrip().split("/")[1], os.path.join(os.path.join(sisyphus.filesystem.portageCacheDir, CATEGORY.decode().strip()), os.path.basename(binary.rstrip().split("/")[1]))) if os.path.exists(binary.rstrip().split("/")[1]): os.remove(binary.rstrip().split("/")[1]) @@ -60,7 +59,7 @@ def start(): sys.exit("\n" + "No package upgrades found; Quitting." + "\n") else: if not len(areBinaries) == 0: - os.chdir(portageCacheDir) + os.chdir(sisyphus.filesystem.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": @@ -75,11 +74,11 @@ def start(): if os.path.exists(binary.rstrip().split("/")[1].replace('tbz2', 'xpak')): os.remove(binary.rstrip().split("/")[1].replace('tbz2', 'xpak')) - if os.path.isdir(os.path.join(portageCacheDir, CATEGORY.decode().strip())): - shutil.move(binary.rstrip().split("/")[1], os.path.join(os.path.join(portageCacheDir, CATEGORY.decode().strip()), os.path.basename(binary.rstrip().split("/")[1]))) + if os.path.isdir(os.path.join(sisyphus.filesystem.portageCacheDir, CATEGORY.decode().strip())): + shutil.move(binary.rstrip().split("/")[1], os.path.join(os.path.join(sisyphus.filesystem.portageCacheDir, CATEGORY.decode().strip()), os.path.basename(binary.rstrip().split("/")[1]))) else: - os.makedirs(os.path.join(portageCacheDir, CATEGORY.decode().strip())) - shutil.move(binary.rstrip().split("/")[1], os.path.join(os.path.join(portageCacheDir, CATEGORY.decode().strip()), os.path.basename(binary.rstrip().split("/")[1]))) + os.makedirs(os.path.join(sisyphus.filesystem.portageCacheDir, CATEGORY.decode().strip())) + shutil.move(binary.rstrip().split("/")[1], os.path.join(os.path.join(sisyphus.filesystem.portageCacheDir, CATEGORY.decode().strip()), os.path.basename(binary.rstrip().split("/")[1]))) if os.path.exists(binary.rstrip().split("/")[1]): os.remove(binary.rstrip().split("/")[1]) |