diff options
-rw-r--r-- | pym/portage/__init__.py | 67 |
1 files changed, 50 insertions, 17 deletions
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index 7fcebe949..3c4ceb819 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -3651,10 +3651,6 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir=".locks", if listonly: can_fetch = False - for var_name in ("FETCHCOMMAND", "RESUMECOMMAND"): - if not mysettings.get(var_name, None): - can_fetch = False - if can_fetch and not fetch_to_ro: global _userpriv_test_write_file_cache dirmode = 02070 @@ -3969,14 +3965,56 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir=".locks", continue # allow different fetchcommands per protocol protocol = loc[0:loc.find("://")] - if "FETCHCOMMAND_" + protocol.upper() in mysettings: - fetchcommand=mysettings["FETCHCOMMAND_"+protocol.upper()] - else: - fetchcommand=mysettings["FETCHCOMMAND"] - if "RESUMECOMMAND_" + protocol.upper() in mysettings: - resumecommand=mysettings["RESUMECOMMAND_"+protocol.upper()] - else: - resumecommand=mysettings["RESUMECOMMAND"] + + missing_file_param = False + fetchcommand_var = "FETCHCOMMAND_" + protocol.upper() + fetchcommand = mysettings.get(fetchcommand_var) + if fetchcommand is None: + fetchcommand_var = "FETCHCOMMAND" + fetchcommand = mysettings.get(fetchcommand_var) + if fetchcommand is None: + portage.util.writemsg_level( + ("!!! %s is unset. It should " + \ + "have been defined in\n!!! %s/make.globals.\n") \ + % (fetchcommand_var, + portage.const.GLOBAL_CONFIG_PATH), + level=logging.ERROR, noiselevel=-1) + return 0 + if "${FILE}" not in fetchcommand: + portage.util.writemsg_level( + ("!!! %s does not contain the required ${FILE}" + \ + " parameter.\n") % fetchcommand_var, + level=logging.ERROR, noiselevel=-1) + missing_file_param = True + + resumecommand_var = "RESUMECOMMAND_" + protocol.upper() + resumecommand = mysettings.get(resumecommand_var) + if resumecommand is None: + resumecommand_var = "RESUMECOMMAND" + resumecommand = mysettings.get(resumecommand_var) + if resumecommand is None: + portage.util.writemsg_level( + ("!!! %s is unset. It should " + \ + "have been defined in\n!!! %s/make.globals.\n") \ + % (resumecommand_var, + portage.const.GLOBAL_CONFIG_PATH), + noiselevel=-1) + return 0 + if "${FILE}" not in resumecommand: + portage.util.writemsg_level( + ("!!! %s does not contain the required ${FILE}" + \ + " parameter.\n") % resumecommand_var, + level=logging.ERROR, noiselevel=-1) + missing_file_param = True + + if missing_file_param: + portage.util.writemsg_level( + "!!! Refer to the make.conf(5) man page for " + \ + "information about how to\n!!! correctly specify " + \ + "FETCHCOMMAND and RESUMECOMMAND.\n", + level=logging.ERROR, noiselevel=-1) + if myfile != os.path.basename(loc): + return 0 if not can_fetch: if fetched != 2: @@ -3997,11 +4035,6 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir=".locks", else: writemsg(("!!! File %s is incorrect size, " + \ "but unable to retry.\n") % myfile, noiselevel=-1) - for var_name in ("FETCHCOMMAND", "RESUMECOMMAND"): - if not mysettings.get(var_name, None): - writemsg(("!!! %s is unset. It should " + \ - "have been defined in /etc/make.globals.\n") \ - % var_name, noiselevel=-1) return 0 else: continue |