diff options
-rw-r--r-- | src/backend/libsisyphus.py | 80 |
1 files changed, 74 insertions, 6 deletions
diff --git a/src/backend/libsisyphus.py b/src/backend/libsisyphus.py index 64ffaaf..541aec8 100644 --- a/src/backend/libsisyphus.py +++ b/src/backend/libsisyphus.py @@ -227,7 +227,7 @@ def startInstall(pkgList): if not len(binaryDeps) == 0: os.chdir(portageCache) - print("\n" + "These are the binary packages that would be merged, in order:" + "\n\n" + str(binaryDeps) + "\n\n" + "Total:" + " " + str(len(binaryDeps)) + " " + "package(s)" + "\n") + print("\n" + "These are the binary packages that would be merged, in order:" + "\n\n" + str(binaryDeps) + "\n\n" + "Total:" + " " + str(len(binaryDeps)) + " " + "binary package(s)" + "\n") if input("Would you like to proceed?" + " " + "[y/N]" + " ").lower().strip()[:1] == "y": for index, url in enumerate([binhostURL + package + '.tbz2' for package in binaryDeps]): print(">>> Fetching" + " " + url) @@ -271,7 +271,7 @@ def startHybridInstall(pkgList): if len(sourceDeps) == 0: if not len(binaryDeps) == 0: os.chdir(portageCache) - print("\n" + "These are the binary packages that would be merged, in order:" + "\n\n" + str(binaryDeps) + "\n\n" + "Total:" + " " + str(len(binaryDeps)) + " " + "package(s)" + "\n") + print("\n" + "These are the binary packages that would be merged, in order:" + "\n\n" + str(binaryDeps) + "\n\n" + "Total:" + " " + str(len(binaryDeps)) + " " + "binary package(s)" + "\n") if input("Would you like to proceed?" + " " + "[y/N]" + " ").lower().strip()[:1] == "y": for index, url in enumerate([binhostURL + package + '.tbz2' for package in binaryDeps]): print(">>> Fetching" + " " + url) @@ -304,7 +304,41 @@ def startHybridInstall(pkgList): else: sys.exit("\n" + "No such binary package; quitting." + "\n") else: - sys.exit("\n" + "This part is not yet implemented; quitting." + "\n") + if not len(binaryDeps) == 0: + os.chdir(portageCache) + print("\n" + "These are the binary packages that would be merged, in order:" + "\n\n" + str(binaryDeps) + "\n\n" + "Total:" + " " + str(len(binaryDeps)) + " " + "binary package(s)" + "\n") + print("\n" + "These are the source packages that would be merged, in order:" + "\n\n" + str(sourceDeps) + "\n\n" + "Total:" + " " + str(len(sourceDeps)) + " " + "source package(s)" + "\n") + if input("Would you like to proceed?" + " " + "[y/N]" + " ").lower().strip()[:1] == "y": + for index, url in enumerate([binhostURL + package + '.tbz2' for package in binaryDeps]): + print(">>> Fetching" + " " + url) + wget.download(url) + print("\n") + + for index, binpkg in enumerate(binaryDeps): + binaryPkg = str(binpkg.rstrip().split("/")[1]) + binaryPkgs.append(binaryPkg) + + for index, binpkg in enumerate(binaryPkgs): + subprocess.call(['qtbz2', '-x'] + str(binpkg + '.tbz2').split()) + CATEGORY = subprocess.check_output(['qxpak', '-x', '-O'] + str(binpkg + '.xpak').split() + ['CATEGORY']) + os.remove(str(binpkg + '.xpak')) + + if os.path.isdir(portageCache + CATEGORY.decode().strip()): + shutil.move(str(binpkg + '.tbz2'), os.path.join(portageCache + CATEGORY.decode().strip(), os.path.basename(str(binpkg + '.tbz2')))) + else: + os.makedirs(portageCache + CATEGORY.decode().strip()) + shutil.move(str(binpkg + '.tbz2'), os.path.join(portageCache + CATEGORY.decode().strip(), os.path.basename(str(binpkg + '.tbz2')))) + + if os.path.exists(str(binpkg + '.tbz2')): + os.remove(str(binpkg + '.tbz2')) + + portageExec = subprocess.Popen(['emerge', '--quiet', '--usepkg', '--rebuilt-binaries', '--misspell-suggestion=n', '--fuzzy-search=n'] + pkgList) + portageExec.wait() + syncLocalDatabase() + else: + sys.exit("\n" + "Ok; quitting.") + else: + sys.exit("\n" + "This part is not yet implemented; quitting." + "\n") def startUpgrade(): syncAll() @@ -315,7 +349,7 @@ def startUpgrade(): if not len(binaryDeps) == 0: os.chdir(portageCache) - print("\n" + "These are the binary packages that would be merged, in order:" + "\n\n" + str(binaryDeps) + "\n\n" + "Total:" + " " + str(len(binaryDeps)) + " " + "package(s)" + "\n") + print("\n" + "These are the binary packages that would be merged, in order:" + "\n\n" + str(binaryDeps) + "\n\n" + "Total:" + " " + str(len(binaryDeps)) + " " + "binary package(s)" + "\n") if input("Would you like to proceed?" + " " + "[y/N]" + " ").lower().strip()[:1] == "y": for index, url in enumerate([binhostURL + package + '.tbz2' for package in binaryDeps]): print(">>> Fetching" + " " + url) @@ -359,7 +393,7 @@ def startHybridUpgrade(): if len(sourceDeps) == 0: if not len(binaryDeps) == 0: os.chdir(portageCache) - print("\n" + "These are the binary packages that would be merged, in order:" + "\n\n" + str(binaryDeps) + "\n\n" + "Total:" + " " + str(len(binaryDeps)) + " " + "package(s)" + "\n") + print("\n" + "These are the binary packages that would be merged, in order:" + "\n\n" + str(binaryDeps) + "\n\n" + "Total:" + " " + str(len(binaryDeps)) + " " + "binary package(s)" + "\n") if input("Would you like to proceed?" + " " + "[y/N]" + " ").lower().strip()[:1] == "y": for index, url in enumerate([binhostURL + package + '.tbz2' for package in binaryDeps]): print(">>> Fetching" + " " + url) @@ -392,7 +426,41 @@ def startHybridUpgrade(): else: sys.exit("\n" + "Nothing to upgrade; quitting." + "\n") else: - sys.exit("\n" + "This part is not yet implemented; quitting." + "\n") + if not len(binaryDeps) == 0: + os.chdir(portageCache) + print("\n" + "These are the binary packages that would be merged, in order:" + "\n\n" + str(binaryDeps) + "\n\n" + "Total:" + " " + str(len(binaryDeps)) + " " + "binary package(s)" + "\n") + print("\n" + "These are the source packages that would be merged, in order:" + "\n\n" + str(sourceDeps) + "\n\n" + "Total:" + " " + str(len(sourceDeps)) + " " + "source package(s)" + "\n") + if input("Would you like to proceed?" + " " + "[y/N]" + " ").lower().strip()[:1] == "y": + for index, url in enumerate([binhostURL + package + '.tbz2' for package in binaryDeps]): + print(">>> Fetching" + " " + url) + wget.download(url) + print("\n") + + for index, worldpkg in enumerate(binaryDeps): + binaryPkg = str(worldpkg.rstrip().split("/")[1]) + binaryPkgs.append(binaryPkg) + + for index, worldpkg in enumerate(binaryPkgs): + subprocess.call(['qtbz2', '-x'] + str(worldpkg + '.tbz2').split()) + CATEGORY = subprocess.check_output(['qxpak', '-x', '-O'] + str(worldpkg + '.xpak').split() + ['CATEGORY']) + os.remove(str(worldpkg + '.xpak')) + + if os.path.isdir(portageCache + CATEGORY.decode().strip()): + shutil.move(str(worldpkg + '.tbz2'), os.path.join(portageCache + CATEGORY.decode().strip(), os.path.basename(str(worldpkg + '.tbz2')))) + else: + os.makedirs(portageCache + CATEGORY.decode().strip()) + shutil.move(str(worldpkg + '.tbz2'), os.path.join(portageCache + CATEGORY.decode().strip(), os.path.basename(str(worldpkg + '.tbz2')))) + + if os.path.exists(str(worldpkg + '.tbz2')): + os.remove(str(worldpkg + '.tbz2')) + + portageExec = subprocess.Popen(['emerge', '--quiet', '--update', '--deep', '--newuse', '--usepkg', '--rebuilt-binaries', '--backtrack=100', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n', '@world']) + portageExec.wait() + syncLocalDatabase() + else: + sys.exit("\n" + "Ok; quitting.") + else: + sys.exit("\n" + "This part is not yet implemented; quitting." + "\n") def startUninstall(pkgList): portageExec = subprocess.Popen(['emerge', '--quiet', '--depclean', '--ask'] + pkgList) |