summaryrefslogtreecommitdiff
path: root/src/backend/upgrade.py
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2023-04-14 21:09:24 +0100
committerV3n3RiX <venerix@koprulu.sector>2023-04-14 21:09:24 +0100
commit44f62d1aba2751d2d2909cc6eec5cb659a8ecde4 (patch)
tree7a06857867ca15bc4b2436556c6bf535fe96c85a /src/backend/upgrade.py
parentcaec9c75a15a9eb86217e33692667d6d583b2f40 (diff)
don't allow alien packages to be reinstalled from gui; catch them early
Diffstat (limited to 'src/backend/upgrade.py')
-rw-r--r--src/backend/upgrade.py37
1 files changed, 22 insertions, 15 deletions
diff --git a/src/backend/upgrade.py b/src/backend/upgrade.py
index 58049d8..3f25ee7 100644
--- a/src/backend/upgrade.py
+++ b/src/backend/upgrade.py
@@ -39,7 +39,7 @@ def start(ebuild=False, gfx_ui=False):
bin_list, src_list, need_cfg = pickle.load(
open(os.path.join(sisyphus.getfs.p_mtd_dir, "sisyphus_worlddeps.pickle"), "rb"))
- if need_cfg != 0:
+ if need_cfg != 0: # catch aliens
p_exe = subprocess.Popen(['emerge', '--quiet', '--update', '--deep', '--newuse', '--pretend', '--getbinpkg',
'--rebuilt-binaries', '--backtrack=100', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n', '@world'])
try:
@@ -51,11 +51,16 @@ def start(ebuild=False, gfx_ui=False):
except subprocess.TimeoutExpired:
p_exe.kill()
sys.exit()
- print(sisyphus.getcolor.bright_red +
- "\nCannot proceed!\n" + sisyphus.getcolor.reset)
- print(sisyphus.getcolor.bright_yellow +
- "Apply the above changes to your portage configuration files and try again" + sisyphus.getcolor.reset)
- sys.exit()
+ if gfx_ui:
+ print("\nCannot proceed!\n")
+ print(
+ "Apply the above changes to your portage configuration files and try again")
+ else:
+ print(sisyphus.getcolor.bright_red +
+ "\nCannot proceed!\n" + sisyphus.getcolor.reset)
+ print(sisyphus.getcolor.bright_yellow +
+ "Apply the above changes to your portage configuration files and try again" + sisyphus.getcolor.reset)
+ sys.exit()
else:
if len(bin_list) == 0 and len(src_list) == 0:
if gfx_ui:
@@ -66,7 +71,7 @@ def start(ebuild=False, gfx_ui=False):
sys.exit()
if ebuild: # ebuild mode
- if len(bin_list) == 0 and len(src_list) != 0: # source only
+ if len(bin_list) == 0 and len(src_list) != 0: # source only, ignore aliens
print("\n" + sisyphus.getcolor.green + "These are the source packages that would be merged, in order:" + sisyphus.getcolor.reset + "\n\n" + sisyphus.getcolor.green + ", ".join(
src_list) + sisyphus.getcolor.reset + "\n\n" + sisyphus.getcolor.bright_white + "Total:" + " " + str(len(src_list)) + " " + "source package(s)" + sisyphus.getcolor.reset + "\n")
while True:
@@ -92,7 +97,7 @@ def start(ebuild=False, gfx_ui=False):
print("\nSorry, response" + " " + "'" +
user_input + "'" + " " + "not understood.\n")
continue
- elif len(bin_list) != 0 and len(src_list) != 0: # binary and source
+ elif len(bin_list) != 0 and len(src_list) != 0: # binary and source, ignore aliens
print("\n" + sisyphus.getcolor.green + "These are the binary packages that would be merged, in order:" + sisyphus.getcolor.reset + "\n\n" + sisyphus.getcolor.magenta + ", ".join(
bin_list) + sisyphus.getcolor.reset + "\n\n" + sisyphus.getcolor.bright_white + "Total:" + " " + str(len(bin_list)) + " " + "binary package(s)" + sisyphus.getcolor.reset + "\n")
print("\n" + sisyphus.getcolor.green + "These are the source packages that would be merged, in order:" + sisyphus.getcolor.reset + "\n\n" + sisyphus.getcolor.green + ", ".join(
@@ -122,7 +127,7 @@ def start(ebuild=False, gfx_ui=False):
print("\nSorry, response" + " " + "'" +
user_input + "'" + " " + "not understood.\n")
continue
- elif len(bin_list) != 0 and len(src_list) == 0: # binary only (fallback)
+ elif len(bin_list) != 0 and len(src_list) == 0: # binary only, fallback
print("\n" + sisyphus.getcolor.green + "These are the binary packages that would be merged, in order:" + sisyphus.getcolor.reset + "\n\n" + sisyphus.getcolor.magenta + ", ".join(
bin_list) + sisyphus.getcolor.reset + "\n\n" + sisyphus.getcolor.bright_white + "Total:" + " " + str(len(bin_list)) + " " + "binary package(s)" + sisyphus.getcolor.reset + "\n")
while True:
@@ -151,20 +156,22 @@ def start(ebuild=False, gfx_ui=False):
user_input + "'" + " " + "not understood.\n")
continue
else: # non-ebuild mode
- if len(bin_list) == 0 and len(src_list) != 0: # source only (noop)
+ if len(bin_list) == 0 and len(src_list) != 0: # source only (noop), catch aliens
if gfx_ui:
- print("\n" + "Source package(s) found in the mix;" + " " + "Use sisyphus CLI:" + " " + "'" +
- "sisyphus upgrade --ebuild" + "'" + " " + "to perform the upgrade;" + " " + "Aborting." + "\n")
+ print("\nSource package(s) found in the mix!\n")
+ print("Use sisyphus CLI:" + " " + "'" + "sisyphus upgrade --ebuild" +
+ "'" + " " + "to perform the upgrade;" + " " + "Aborting.")
else:
print(sisyphus.getcolor.bright_red +
"\nSource package(s) found in the mix!\n" + sisyphus.getcolor.reset)
print(sisyphus.getcolor.bright_yellow + "Use" +
sisyphus.getcolor.reset + " " + "'" + "sisyphus upgrade --ebuild" + "'")
sys.exit()
- elif len(bin_list) != 0 and len(src_list) != 0: # binary and source (noop)
+ elif len(bin_list) != 0 and len(src_list) != 0: # binary and source (noop), catch aliens
if gfx_ui:
- print("\n" + "Source package(s) found in the mix;" + " " + "Use sisyphus CLI:" + " " + "'" +
- "sisyphus upgrade --ebuild" + "'" + " " + "to perform the upgrade;" + " " + "Aborting." + "\n")
+ print("\nSource package(s) found in the mix!\n")
+ print("Use sisyphus CLI:" + " " + "'" + "sisyphus upgrade --ebuild" +
+ "'" + " " + "to perform the upgrade;" + " " + "Aborting.")
else:
print(sisyphus.getcolor.bright_red +
"\nSource package(s) found in the mix!\n" + sisyphus.getcolor.reset)