public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] portage r12600 - main/trunk/pym/portage
@ 2009-02-12  3:20 Zac Medico (zmedico)
  0 siblings, 0 replies; only message in thread
From: Zac Medico (zmedico) @ 2009-02-12  3:20 UTC (permalink / raw
  To: gentoo-commits

Author: zmedico
Date: 2009-02-12 03:20:05 +0000 (Thu, 12 Feb 2009)
New Revision: 12600

Modified:
   main/trunk/pym/portage/__init__.py
Log:
Bug #258433 - In portage.fetch(), check for missing ${FILE} parameter in
FETCHCOMMAND or RESUMECOMMAND and bail out early if necessary.


Modified: main/trunk/pym/portage/__init__.py
===================================================================
--- main/trunk/pym/portage/__init__.py	2009-02-11 20:34:40 UTC (rev 12599)
+++ main/trunk/pym/portage/__init__.py	2009-02-12 03:20:05 UTC (rev 12600)
@@ -3651,10 +3651,6 @@
 	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,15 +3965,57 @@
 					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:
 						try:
@@ -3997,11 +4035,6 @@
 						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




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-02-12  3:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-12  3:20 [gentoo-commits] portage r12600 - main/trunk/pym/portage Zac Medico (zmedico)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox