Gentoo Logo
Gentoo Spaceship




Note: Due to technical difficulties, the Archives are currently not up to date. GMANE provides an alternative service for most mailing lists.
c.f. bug 424647
List Archive: gentoo-portage-dev
Navigation:
Lists: gentoo-portage-dev: < Prev By Thread Next > < Prev By Date Next >
Headers:
To: gentoo-portage-dev@g.o
From: Alec Warner <antarus@g.o>
Subject: Config Cleanup Last Call
Date: Fri, 24 Feb 2006 20:40:48 -0500
Please review for badness, otherwise I'll commit this soon ;)
--- portage.py	2006-01-15 00:08:06.170717008 -0500
+++ -	2006-01-15 00:22:00.597106000 -0500
@@ -931,17 +931,8 @@
 			self.use_defs = copy.deepcopy(clone.use_defs)
 			self.usemask  = copy.deepcopy(clone.usemask)
 
-			self.configlist = copy.deepcopy(clone.configlist)
-			self.configlist[-1] = os.environ.copy()
-			self.configdict = { "globals":   self.configlist[0],
-			                    "defaults":  self.configlist[1],
-			                    "conf":      self.configlist[2],
-			                    "pkg":       self.configlist[3],
-			                    "auto":      self.configlist[4],
-			                    "backupenv": self.configlist[5],
-			                    "env":       self.configlist[6] }
+			self.configdict = copy.deepcopy(clone.configdict)
 			self.profiles = copy.deepcopy(clone.profiles)
-			self.backupenv  = copy.deepcopy(clone.backupenv)
 			self.pusedict   = copy.deepcopy(clone.pusedict)
 			self.categories = copy.deepcopy(clone.categories)
 			self.pkeywordsdict = copy.deepcopy(clone.pkeywordsdict)
@@ -980,11 +971,8 @@
 			}
 
 			self.usemask=[]
-			self.configlist=[]
-			self.backupenv={}
 			# back up our incremental variables:
 			self.configdict={}
-			# configlist will contain: [ globals, defaults, conf, pkg, auto, backupenv (incrementals), origenv ]
 
 			# The symlink might not exist or might not be a symlink.
 			try:
@@ -1043,8 +1031,7 @@
 				writemsg("!!! Incorrect multiline literals can cause this. Do not use them.\n")
 				writemsg("!!! Errors in this file should be reported on bugs.gentoo.org.\n")
 				sys.exit(1)
-			self.configlist.append(self.mygcfg)
-			self.configdict["globals"]=self.configlist[-1]
+			self.configdict["globals"] = self.mygcfg
 
 			self.mygcfg = {}
 			if self.profiles:
@@ -1062,8 +1049,7 @@
 					writemsg("!!! not then please report this to bugs.gentoo.org and, if possible, a dev\n")
 					writemsg("!!! on #gentoo (irc.freenode.org)\n")
 					sys.exit(1)
-			self.configlist.append(self.mygcfg)
-			self.configdict["defaults"]=self.configlist[-1]
+			self.configdict["defaults"]=self.mygcfg
 
 			try:
 				# XXX: Should depend on root?
@@ -1078,28 +1064,32 @@
 				sys.exit(1)
 
 
-			self.configlist.append(self.mygcfg)
-			self.configdict["conf"]=self.configlist[-1]
+			self.configdict["conf"]=self.mygcfg
 
-			self.configlist.append({})
-			self.configdict["pkg"]=self.configlist[-1]
+			self.configdict["pkg"]={}
 
 			#auto-use:
-			self.configlist.append({})
-			self.configdict["auto"]=self.configlist[-1]
+			self.configdict["auto"]={}
 
 			#backup-env (for recording our calculated incremental variables:)
-			self.backupenv = os.environ.copy()
-			self.configlist.append(self.backupenv) # XXX Why though?
-			self.configdict["backupenv"]=self.configlist[-1]
+			self.configdict["backupenv"]=os.environ.copy() # XXX Why though? ( ferringb? )
 
-			self.configlist.append(os.environ.copy())
-			self.configdict["env"]=self.configlist[-1]
+			### backupenv maybe required to be a clone, and not just a reference
+			### the old code did value copy we do a reference here
+			self.configdict["env"]=self.configdict["backupenv"]
 
 
 			# make lookuplist for loading package.*
-			self.lookuplist=self.configlist[:]
-			self.lookuplist.reverse()
+			# This may look like USE_ORDER, it has nothing to do with it.
+			# Instead this is the way that __getitem__ lookups are performed
+			# So env first, then backupenv, the auto, pkg, conf, defaults...etc.
+			self.lookuplist=[self.configdict["env"],
+					 self.configdict["backupenv"],
+					 self.configdict["auto"],
+					 self.configdict["pkg"],
+					 self.configdict["conf"],
+					 self.configdict["defaults"],
+					 self.configdict["globals"]]
 
 			if os.environ.get("PORTAGE_CALLER","") == "repoman":
 				# repoman shouldn't use local settings.
@@ -1197,8 +1187,14 @@
 				else:
 					self.pprovideddict[mycatpkg]=[x]
 
-		self.lookuplist=self.configlist[:]
-		self.lookuplist.reverse()
+		# make lookuplist for loading package.*
+		self.lookuplist=[self.configdict["env"],
+				 self.configdict["backupenv"],
+				 self.configdict["auto"],
+				 self.configdict["pkg"],
+				 self.configdict["conf"],
+				 self.configdict["defaults"],
+				 self.configdict["globals"]]
 
 		useorder=self["USE_ORDER"]
 		if not useorder:
@@ -1216,7 +1212,7 @@
 				self.uvlist[0:0]=[self.configdict[x]]
 
 		self.configdict["env"]["PORTAGE_GID"]=str(portage_gid)
-		self.backupenv["PORTAGE_GID"]=str(portage_gid)
+		self.configdict["backupenv"]["PORTAGE_GID"]=str(portage_gid)
 
 		if self.has_key("PORT_LOGDIR") and not self["PORT_LOGDIR"]:
 			# port_logdir is defined, but empty.  this causes a traceback in doebuild.
@@ -1301,17 +1297,17 @@
 
 	def backup_changes(self,key=None):
 		if key and self.configdict["env"].has_key(key):
-			self.backupenv[key] = copy.deepcopy(self.configdict["env"][key])
+			self.configdict["backupenv"][key] = copy.deepcopy(self.configdict["env"][key])
 		else:
 			raise KeyError, "No such key defined in environment: %s" % key
 
 	def reset(self,keeping_pkg=0,use_cache=1):
 		"reset environment to original settings"
-		for x in self.configlist[-1].keys():
-			if x not in self.backupenv.keys():
-				del self.configlist[-1][x]
+		for x in self.configdict["env"].keys():
+			if x not in self.configdict["backupenv"].keys():
+				del self.configdict["env"][x]
 
-		self.configdict["env"].update(self.backupenv)
+		self.configdict["env"].update(self.configdict["backupenv"])
 
 		self.modifiedkeys = []
 		if not keeping_pkg:
@@ -1409,7 +1405,8 @@
 				else:
 					self.configdict["auto"]["USE"]=""
 			else:
-				mydbs=self.configlist[:-1]
+				#Abuse the order of lookuplist to emulate old behavior
+				mydbs=self.lookuplist[:-1]
 
 			myflags=[]
 			for curdb in mydbs:
@@ -1442,13 +1439,13 @@
 
 			myflags.sort()
 			#store setting in last element of configlist, the original environment:
-			self.configlist[-1][mykey]=string.join(myflags," ")
+			self.configdict["env"][mykey]=string.join(myflags," ")
 			del myflags
 
 		#cache split-up USE var in a global
 		usesplit=[]
 
-		for x in string.split(self.configlist[-1]["USE"]):
+		for x in string.split(self.configdict["env"]["USE"]):
 			if x not in self.usemask:
 				usesplit.append(x)
 
@@ -1466,7 +1463,7 @@
 				if self.configdict["defaults"]["ARCH"] not in usesplit:
 					usesplit.insert(0,self.configdict["defaults"]["ARCH"])
 
-		self.configlist[-1]["USE"]=string.join(usesplit," ")
+		self.configdict["env"]["USE"]=string.join(usesplit," ")
 
 		self.already_in_regenerate = 0
 
@@ -1585,21 +1582,7 @@
 				match = x[mykey]
 				break
 
-		if 0 and match and mykey in ["PORTAGE_BINHOST"]:
-			# These require HTTP Encoding
-			try:
-				import urllib
-				if urllib.unquote(match) != match:
-					writemsg("Note: %s already contains escape codes." % (mykey))
-				else:
-					match = urllib.quote(match)
-			except SystemExit, e:
-				raise
-			except:
-				writemsg("Failed to fix %s using urllib, attempting to continue.\n"  % (mykey))
-				pass
-
-		elif mykey == "CONFIG_PROTECT_MASK":
+		if mykey == "CONFIG_PROTECT_MASK":
 			match += " /etc/env.d"
 
 		return match
Attachment:
signature.asc (OpenPGP digital signature)
Replies:
Re: Config Cleanup Last Call
-- Jason Stubbs
Re: Config Cleanup Last Call
-- Jason Stubbs
Navigation:
Lists: gentoo-portage-dev: < Prev By Thread Next > < Prev By Date Next >
Previous by thread:
Portage-2.1_pre5
Next by thread:
Re: Config Cleanup Last Call
Previous by date:
Re: Portage-2.1_pre5
Next by date:
Re: Config Cleanup Last Call


Updated Jun 17, 2009

Summary: Archive of the gentoo-portage-dev mailing list.

Donate to support our development efforts.

Copyright 2001-2013 Gentoo Foundation, Inc. Questions, Comments? Contact us.