summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-03-11 03:54:02 +0000
committerZac Medico <zmedico@gentoo.org>2009-03-11 03:54:02 +0000
commit8c1a78f0796eb624d6ad30b7c9af28cf92e70c3e (patch)
treed6bcda356ffcd0a40acad02b9858ea86ca49924d
parentc98efe1c7742fecea912f0e78c04f492621df65e (diff)
downloadportage-8c1a78f0796eb624d6ad30b7c9af28cf92e70c3e.tar.gz
portage-8c1a78f0796eb624d6ad30b7c9af28cf92e70c3e.tar.bz2
portage-8c1a78f0796eb624d6ad30b7c9af28cf92e70c3e.zip
Bug #258433 - In portage.fetch(), check for missing ${FILE} parameter in
FETCHCOMMAND or RESUMECOMMAND and bail out early if necessary. (trunk r12600) svn path=/main/branches/2.1.6/; revision=12881
-rw-r--r--pym/portage/__init__.py67
1 files changed, 50 insertions, 17 deletions
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index ae4e7a120..3c2807a53 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -3641,10 +3641,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
@@ -3959,14 +3955,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:
@@ -3987,11 +4025,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