From 93baf2a6d49e0d8d16b17ba814b5879cfe01b4ff Mon Sep 17 00:00:00 2001
From: V3n3RiX <venerix@redcorelinux.org>
Date: Wed, 27 Feb 2019 11:41:04 +0000
Subject: libsisyphus backend :   * detect when a package needs a keyword or
 mask change in order to proceed   * print the requierd changes to stdout, and
 suggest user to appply them in order to proceed   * this fixes a bug when
 sisyphus would start to download the binary dependencies of keyworded or
 masked packages but fail to install them due to missing keyword or mask
 changes sisyphus-gui :   * adjust to libsisyphus backend changes

---
 src/backend/libsisyphus.py       | 392 +++++++++++++++++++++------------------
 src/frontend/gui/sisyphus-gui.py |   4 +-
 2 files changed, 210 insertions(+), 186 deletions(-)

(limited to 'src')

diff --git a/src/backend/libsisyphus.py b/src/backend/libsisyphus.py
index 1fd9eab..0de7f95 100644
--- a/src/backend/libsisyphus.py
+++ b/src/backend/libsisyphus.py
@@ -224,7 +224,7 @@ def startInstall(pkgList):
     syncAll()
 
     binhostURL = getBinhostURL()
-    areBinaries,areSources = getPackageDeps(pkgList)
+    areBinaries,areSources,needsConfig = getPackageDeps(pkgList)
     binaryPkgs = []
 
     if len(areSources) == 0:
@@ -275,110 +275,122 @@ def startHybridInstall(pkgList):
     syncAll()
 
     binhostURL = getBinhostURL()
-    areBinaries,areSources = getPackageDeps(pkgList)
+    areBinaries,areSources,needsConfig = getPackageDeps(pkgList)
     binaryPkgs = []
 
-    if len(areSources) == 0:
-        if not len(areBinaries) == 0:
-            os.chdir(portageCache)
-            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, url in enumerate([binhostURL + package + '.tbz2' for package in areBinaries]):
-                    print(">>> Fetching" + " " + url)
-                    wget.download(url)
-                    print("\n")
-
-                for index, binpkg in enumerate(areBinaries):
-                    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', '--usepkg', '--usepkgonly', '--rebuilt-binaries', '--misspell-suggestion=n', '--fuzzy-search=n'] + pkgList, stdout=subprocess.PIPE)
-
-                for portageOutput in io.TextIOWrapper(portageExec.stdout, encoding="utf-8"):
-                    if not "These are the packages that would be merged, in order:" in portageOutput.rstrip():
-                        if not "Calculating dependencies" in portageOutput.rstrip():
-                            print(portageOutput.rstrip())
-
-                portageExec.wait()
-                syncLocalDatabase()
+    if needsConfig == 0:
+        if len(areSources) == 0:
+            if not len(areBinaries) == 0:
+                os.chdir(portageCache)
+                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, url in enumerate([binhostURL + package + '.tbz2' for package in areBinaries]):
+                        print(">>> Fetching" + " " + url)
+                        wget.download(url)
+                        print("\n")
+
+                    for index, binpkg in enumerate(areBinaries):
+                        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', '--usepkg', '--usepkgonly', '--rebuilt-binaries', '--misspell-suggestion=n', '--fuzzy-search=n'] + pkgList, stdout=subprocess.PIPE)
+
+                    for portageOutput in io.TextIOWrapper(portageExec.stdout, encoding="utf-8"):
+                        if not "These are the packages that would be merged, in order:" in portageOutput.rstrip():
+                            if not "Calculating dependencies" in portageOutput.rstrip():
+                                print(portageOutput.rstrip())
+
+                    portageExec.wait()
+                    syncLocalDatabase()
+                else:
+                    sys.exit("\n" + "Ok; Quitting." + "\n")
             else:
-                sys.exit("\n" + "Ok; Quitting." + "\n")
+                sys.exit("\n" + "No package found; Quitting." + "\n")
         else:
-            sys.exit("\n" + "No package found; Quitting." + "\n")
-    else:
-        if not len(areBinaries) == 0:
-            os.chdir(portageCache)
-            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":
-                for index, url in enumerate([binhostURL + package + '.tbz2' for package in areBinaries]):
-                    print(">>> Fetching" + " " + url)
-                    wget.download(url)
-                    print("\n")
-
-                for index, binpkg in enumerate(areBinaries):
-                    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', '--usepkg', '--rebuilt-binaries', '--misspell-suggestion=n', '--fuzzy-search=n'] + pkgList, stdout=subprocess.PIPE)
-
-                for portageOutput in io.TextIOWrapper(portageExec.stdout, encoding="utf-8"):
-                    if not "These are the packages that would be merged, in order:" in portageOutput.rstrip():
-                        if not "Calculating dependencies" in portageOutput.rstrip():
-                            print(portageOutput.rstrip())
-
-                portageExec.wait()
-                syncLocalDatabase()
+            if not len(areBinaries) == 0:
+                os.chdir(portageCache)
+                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":
+                    for index, url in enumerate([binhostURL + package + '.tbz2' for package in areBinaries]):
+                        print(">>> Fetching" + " " + url)
+                        wget.download(url)
+                        print("\n")
+
+                    for index, binpkg in enumerate(areBinaries):
+                        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', '--usepkg', '--rebuilt-binaries', '--misspell-suggestion=n', '--fuzzy-search=n'] + pkgList, stdout=subprocess.PIPE)
+
+                    for portageOutput in io.TextIOWrapper(portageExec.stdout, encoding="utf-8"):
+                        if not "These are the packages that would be merged, in order:" in portageOutput.rstrip():
+                            if not "Calculating dependencies" in portageOutput.rstrip():
+                                print(portageOutput.rstrip())
+
+                    portageExec.wait()
+                    syncLocalDatabase()
+                else:
+                    sys.exit("\n" + "Ok; Quitting." + "\n")
             else:
-                sys.exit("\n" + "Ok; Quitting." + "\n")
-        else:
-            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":
-                portageExec = subprocess.Popen(['emerge', '--misspell-suggestion=n', '--fuzzy-search=n'] + pkgList, stdout=subprocess.PIPE)
+                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":
+                    portageExec = subprocess.Popen(['emerge', '--misspell-suggestion=n', '--fuzzy-search=n'] + pkgList, stdout=subprocess.PIPE)
+
+                    for portageOutput in io.TextIOWrapper(portageExec.stdout, encoding="utf-8"):
+                        if not "These are the packages that would be merged, in order:" in portageOutput.rstrip():
+                            if not "Calculating dependencies" in portageOutput.rstrip():
+                                print(portageOutput.rstrip())
+
+                    portageExec.wait()
+                    syncLocalDatabase()
+                else:
+                    sys.exit("\n" + "Ok; Quitting." + "\n")
+    else:
+        portageExec = subprocess.Popen(['emerge', '--quiet', '--pretend', '--getbinpkg', '--rebuilt-binaries', '--misspell-suggestion=n', '--fuzzy-search=n'] + pkgList, stdout=subprocess.PIPE)
 
-                for portageOutput in io.TextIOWrapper(portageExec.stdout, encoding="utf-8"):
-                    if not "These are the packages that would be merged, in order:" in portageOutput.rstrip():
-                        if not "Calculating dependencies" in portageOutput.rstrip():
-                            print(portageOutput.rstrip())
+        for portageOutput in io.TextIOWrapper(portageExec.stdout, encoding="utf-8"):
+            if not "Local copy of remote index is up-to-date and will be used." in portageOutput.rstrip():
+                if not "ebuild" in portageOutput.rstrip():
+                    if not "binary" in portageOutput.rstrip():
+                        print(portageOutput.rstrip())
 
-                portageExec.wait()
-                syncLocalDatabase()
-            else:
-                sys.exit("\n" + "Ok; Quitting." + "\n")
+        portageExec.wait()
+        sys.exit("\n" + "Cannot proceed; Apply the above changes to your portage configuration files and try again; Quitting." + "\n")
 
 def startUpgrade():
     syncAll()
 
     binhostURL = getBinhostURL()
-    areBinaries,areSources = getWorldDeps()
+    areBinaries,areSources,needsConfig = getWorldDeps()
     binaryPkgs = []
 
     if len(areSources) == 0:
@@ -429,104 +441,116 @@ def startHybridUpgrade():
     syncAll()
 
     binhostURL = getBinhostURL()
-    areBinaries,areSources = getWorldDeps()
+    areBinaries,areSources,needsConfig = getWorldDeps()
     binaryPkgs = []
 
-    if len(areSources) == 0:
-        if not len(areBinaries) == 0:
-            os.chdir(portageCache)
-            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, url in enumerate([binhostURL + package + '.tbz2' for package in areBinaries]):
-                    print(">>> Fetching" + " " + url)
-                    wget.download(url)
-                    print("\n")
-
-                for index, binpkg in enumerate(areBinaries):
-                    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', '--update', '--deep', '--newuse', '--usepkg', '--usepkgonly', '--rebuilt-binaries', '--backtrack=100', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n', '@world'], stdout=subprocess.PIPE)
-
-                for portageOutput in io.TextIOWrapper(portageExec.stdout, encoding="utf-8"):
-                    if not "These are the packages that would be merged, in order:" in portageOutput.rstrip():
-                        if not "Calculating dependencies" in portageOutput.rstrip():
-                            print(portageOutput.rstrip())
-
-                portageExec.wait()
-                syncLocalDatabase()
+    if needsConfig == 0:
+        if len(areSources) == 0:
+            if not len(areBinaries) == 0:
+                os.chdir(portageCache)
+                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, url in enumerate([binhostURL + package + '.tbz2' for package in areBinaries]):
+                        print(">>> Fetching" + " " + url)
+                        wget.download(url)
+                        print("\n")
+
+                    for index, binpkg in enumerate(areBinaries):
+                        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', '--update', '--deep', '--newuse', '--usepkg', '--usepkgonly', '--rebuilt-binaries', '--backtrack=100', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n', '@world'], stdout=subprocess.PIPE)
+
+                    for portageOutput in io.TextIOWrapper(portageExec.stdout, encoding="utf-8"):
+                        if not "These are the packages that would be merged, in order:" in portageOutput.rstrip():
+                            if not "Calculating dependencies" in portageOutput.rstrip():
+                                print(portageOutput.rstrip())
+
+                    portageExec.wait()
+                    syncLocalDatabase()
+                else:
+                    sys.exit("\n" + "Ok; Quitting." + "\n")
             else:
-                sys.exit("\n" + "Ok; Quitting." + "\n")
+                sys.exit("\n" + "No package upgrades found; Quitting." + "\n")
         else:
-            sys.exit("\n" + "No package upgrades found; Quitting." + "\n")
-    else:
-        if not len(areBinaries) == 0:
-            os.chdir(portageCache)
-            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":
-                for index, url in enumerate([binhostURL + package + '.tbz2' for package in areBinaries]):
-                    print(">>> Fetching" + " " + url)
-                    wget.download(url)
-                    print("\n")
-
-                for index, binpkg in enumerate(areBinaries):
-                    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', '--update', '--deep', '--newuse', '--usepkg', '--rebuilt-binaries', '--backtrack=100', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n', '@world'], stdout=subprocess.PIPE)
-
-                for portageOutput in io.TextIOWrapper(portageExec.stdout, encoding="utf-8"):
-                    if not "These are the packages that would be merged, in order:" in portageOutput.rstrip():
-                        if not "Calculating dependencies" in portageOutput.rstrip():
-                            print(portageOutput.rstrip())
-
-                portageExec.wait()
-                syncLocalDatabase()
+            if not len(areBinaries) == 0:
+                os.chdir(portageCache)
+                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":
+                    for index, url in enumerate([binhostURL + package + '.tbz2' for package in areBinaries]):
+                        print(">>> Fetching" + " " + url)
+                        wget.download(url)
+                        print("\n")
+
+                    for index, binpkg in enumerate(areBinaries):
+                        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', '--update', '--deep', '--newuse', '--usepkg', '--rebuilt-binaries', '--backtrack=100', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n', '@world'], stdout=subprocess.PIPE)
+
+                    for portageOutput in io.TextIOWrapper(portageExec.stdout, encoding="utf-8"):
+                        if not "These are the packages that would be merged, in order:" in portageOutput.rstrip():
+                            if not "Calculating dependencies" in portageOutput.rstrip():
+                                print(portageOutput.rstrip())
+
+                    portageExec.wait()
+                    syncLocalDatabase()
+                else:
+                    sys.exit("\n" + "Ok; Quitting." + "\n")
             else:
-                sys.exit("\n" + "Ok; Quitting." + "\n")
-        else:
-            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":
-                portageExec = subprocess.Popen(['emerge', '--update', '--deep', '--newuse', '--backtrack=100', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n', '@world'], stdout=subprocess.PIPE)
+                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":
+                    portageExec = subprocess.Popen(['emerge', '--update', '--deep', '--newuse', '--backtrack=100', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n', '@world'], stdout=subprocess.PIPE)
+
+                    for portageOutput in io.TextIOWrapper(portageExec.stdout, encoding="utf-8"):
+                        if not "These are the packages that would be merged, in order:" in portageOutput.rstrip():
+                            if not "Calculating dependencies" in portageOutput.rstrip():
+                                print(portageOutput.rstrip())
+
+                    portageExec.wait()
+                    syncLocalDatabase()
+                else:
+                    sys.exit("\n" + "Ok; Quitting." + "\n")
+    else:
+        portageExec = subprocess.Popen(['emerge', '--quiet', '--update', '--deep', '--newuse', '--pretend', '--getbinpkg', '--rebuilt-binaries', '--backtrack=100', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n', '@world'], stdout=subprocess.PIPE)
 
-                for portageOutput in io.TextIOWrapper(portageExec.stdout, encoding="utf-8"):
-                    if not "These are the packages that would be merged, in order:" in portageOutput.rstrip():
-                        if not "Calculating dependencies" in portageOutput.rstrip():
-                            print(portageOutput.rstrip())
+        for portageOutput in io.TextIOWrapper(portageExec.stdout, encoding="utf-8"):
+            if not "Local copy of remote index is up-to-date and will be used." in portageOutput.rstrip():
+                if not "ebuild" in portageOutput.rstrip():
+                    if not "binary" in portageOutput.rstrip():
+                        print(portageOutput.rstrip())
 
-                portageExec.wait()
-                syncLocalDatabase()
-            else:
-                sys.exit("\n" + "Ok; Quitting." + "\n")
+        portageExec.wait()
+        sys.exit("\n" + "Cannot proceed; Apply the above changes to your portage configuration files and try again; Quitting." + "\n")
 
 def startUninstall(pkgList):
     portageExec = subprocess.Popen(['emerge', '--quiet', '--depclean', '--ask'] + pkgList)
diff --git a/src/frontend/gui/sisyphus-gui.py b/src/frontend/gui/sisyphus-gui.py
index 56c4ed2..7d88fa6 100644
--- a/src/frontend/gui/sisyphus-gui.py
+++ b/src/frontend/gui/sisyphus-gui.py
@@ -366,7 +366,7 @@ class MainWorker(QtCore.QObject):
         pkgList = Sisyphus.pkgList
 
         binhostURL = getBinhostURL()
-        areBinaries,areSources = getPackageDeps(pkgList)
+        areBinaries,areSources,needsConfig = getPackageDeps(pkgList)
         binaryPkgs = []
 
         os.chdir(portageCache)
@@ -427,7 +427,7 @@ class MainWorker(QtCore.QObject):
         self.started.emit()
 
         binhostURL = getBinhostURL()
-        areBinaries,areSources = getWorldDeps()
+        areBinaries,areSources,needsConfig = getWorldDeps()
         binaryPkgs = []
 
         os.chdir(portageCache)
-- 
cgit v1.2.3