capitalista wrote:
I'd be happier if, pending you indeed went the source route, you'd
source directories and not files. You could have another file that
would contain info on the other directories, or maybe put in a
variable in make.conf like PORTDIR_OVERLAY, creating
/etc/portage/includes style functionality anywhere. Still, a source
command just seems like more of a hassle than it needs to be for the
end user.


I have created a slightly modified version of my previous patch that introduces 
an environment variable called USER_OVERRIDES (as a replacement for 
/etc/portage/includes).  If USER_OVERRIDES is unset then it defaults to 
/etc/portage (traditional behavior).  With this variable you can set a space 
separated list of directories (if you leave out /etc/portage then it will _not_ 
be included).

The functionality that this new USER_OVERRIDES variable introduces is somewhat like a 
"source" command, but it applies to directories (and is easier to implement).  
Directories listed later in the variable will override earlier ones.

Zac
Index: pym/portage.py
===================================================================
--- pym/portage.py	(revision 2314)
+++ pym/portage.py	(working copy)
@@ -81,7 +81,7 @@
 	  EBUILD_SH_BINARY, SANDBOX_BINARY, BASH_BINARY, \
 	  MOVE_BINARY, PRELINK_BINARY, WORLD_FILE, MAKE_CONF_FILE, MAKE_DEFAULTS_FILE, \
 	  DEPRECATED_PROFILE_FILE, USER_VIRTUALS_FILE, EBUILD_SH_ENV_FILE, \
-	  INVALID_ENV_FILE, CUSTOM_MIRRORS_FILE, CONFIG_MEMORY_FILE,\
+	  INVALID_ENV_FILE, CONFIG_MEMORY_FILE,\
 	  INCREMENTALS, STICKIES, EAPI
 
 	from portage_data import ostype, lchown, userland, secpass, uid, wheelgid, \
@@ -1114,13 +1114,20 @@
 				self.pkeywordsdict = {}
 				self.punmaskdict = {}
 			else:
-				locations = [self["PORTDIR"] + "/profiles", USER_CONFIG_PATH]
+				self.backupenv.setdefault("USER_OVERRIDES",USER_CONFIG_PATH)
+				# user_overrides for package.use, package.keywords, and package.unmask
+				user_overrides=self["USER_OVERRIDES"].split()
+
+				# locations for categories and package.mask (order does not matter)
+				locations = [self["PORTDIR"] + "/profiles"] + user_overrides
 				for ov in self["PORTDIR_OVERLAY"].split():
 					ov = os.path.normpath(ov)
 					if os.path.isdir(ov+"/profiles"):
 						locations.append(ov+"/profiles")
 
-				pusedict=grabdict_package(USER_CONFIG_PATH+"/package.use")
+				pusedict={}
+				for config_path in user_overrides:
+					pusedict.update(grabdict_package(config_path+"/package.use"))
 				self.pusedict = {}
 				for key in pusedict.keys():
 					cp = dep_getkey(key)
@@ -1129,7 +1136,9 @@
 					self.pusedict[cp][key] = pusedict[key]
 
 				#package.keywords
-				pkgdict=grabdict_package(USER_CONFIG_PATH+"/package.keywords")
+				pkgdict={}
+				for config_path in user_overrides:
+					pkgdict.update(grabdict_package(config_path+"/package.keywords"))
 				self.pkeywordsdict = {}
 				for key in pkgdict.keys():
 					# default to ~arch if no specific keyword is given
@@ -1149,7 +1158,9 @@
 					self.pkeywordsdict[cp][key] = pkgdict[key]
 
 				#package.unmask
-				pkgunmasklines = grabfile_package(USER_CONFIG_PATH+"/package.unmask")
+				pkgunmasklines=[]
+				for config_path in user_overrides:
+					pkgunmasklines.extend(grabfile_package(config_path+"/package.unmask"))
 				self.punmaskdict = {}
 				for x in pkgunmasklines:
 					mycatpkg=dep_getkey(x)
@@ -1688,7 +1699,9 @@
 
 	check_config_instance(mysettings)
 
-	custommirrors=grabdict(CUSTOM_MIRRORS_FILE)
+	custommirrors={}
+	for config_path in mysettings["USER_OVERRIDES"].split():
+		custommirrors.update(grabdict(os.path.join(config_path,"mirrors")))
 
 	mymirrors=[]
 
Index: pym/portage_const.py
===================================================================
--- pym/portage_const.py	(revision 2314)
+++ pym/portage_const.py	(working copy)
@@ -36,7 +36,6 @@
 USER_VIRTUALS_FILE      = USER_CONFIG_PATH+"/virtuals"
 EBUILD_SH_ENV_FILE      = USER_CONFIG_PATH+"/bashrc"
 INVALID_ENV_FILE        = "/etc/spork/is/not/valid/profile.env"
-CUSTOM_MIRRORS_FILE     = USER_CONFIG_PATH+"/mirrors"
 CONFIG_MEMORY_FILE      = PRIVATE_PATH + "/config"
 
 INCREMENTALS=["USE","USE_EXPAND","FEATURES","ACCEPT_KEYWORDS","ACCEPT_LICENSE","CONFIG_PROTECT_MASK","CONFIG_PROTECT","PRELINK_PATH","PRELINK_PATH_MASK"]

Reply via email to