public inbox for gentoo-catalyst@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-catalyst]  [PATCH] Use Portage's make.conf parser, allow user-specified extra bind mount points, allow absolute profile paths
@ 2007-06-11 14:38 Charles Duffy
  2007-06-12 19:06 ` Chris Gianelloni
  0 siblings, 1 reply; 2+ messages in thread
From: Charles Duffy @ 2007-06-11 14:38 UTC (permalink / raw
  To: gentoo-catalyst

[-- Attachment #1: Type: text/plain, Size: 779 bytes --]

Attached is a collection of enhancements I'm using in my local catalyst
installation. In particular:

 - Uses the make.conf parser from portage_utils. This handles source
directives, multi-line constants, and other goodness the catalyst one
doesn't.
 - Adds a new directive, "extra_mounts", allows user-specified bind
mount points. If for some reason an advanced user who's doing funky
things wants extra bind mounts into the build region, this permits it.
 - Allow absolute profile paths. Necessary for folks using custom
profiles not within /usr/portage/profiles. (In my case, that profile is
coming off a network filesystem for which a bind mount is set up via the
extra_mounts directive).

If 'yall want me to split patch this out into multiple pieces, I'd be
glad to do so.

[-- Attachment #2: catalyst-misc_enhancements.patch --]
[-- Type: text/x-patch, Size: 4497 bytes --]

diff -ru catalyst-2.0.4.orig/examples/generic_stage_template.spec catalyst-2.0.4/examples/generic_stage_template.spec
--- catalyst-2.0.4.orig/examples/generic_stage_template.spec	2007-04-12 07:00:25.000000000 -0500
+++ catalyst-2.0.4/examples/generic_stage_template.spec	2007-06-11 09:32:09.000000000 -0500
@@ -105,3 +105,11 @@
 # example:
 # ldflags: -Wl,-O1 -Wl,-z,now
 ldflags:
+
+# Extra bind mounts to be created within the chroot. Not used for releases;
+# don't touch this unless you've extremely sure you know what you're doing.
+# Syntax: [chroot_path]:[target_path]
+# If the two values match, the latter may be left out.
+# example:
+# extra_mounts: /afs
+extra_mounts:
Only in catalyst-2.0.4/examples: generic_stage_template.spec~
diff -ru catalyst-2.0.4.orig/modules/catalyst_support.py catalyst-2.0.4/modules/catalyst_support.py
--- catalyst-2.0.4.orig/modules/catalyst_support.py	2007-04-12 07:00:25.000000000 -0500
+++ catalyst-2.0.4/modules/catalyst_support.py	2007-06-11 09:26:40.000000000 -0500
@@ -1,5 +1,5 @@
 
-import sys,string,os,types,re,signal,traceback,time
+import portage_util,sys,string,os,types,re,signal,traceback,time
 #import md5,sha
 selinux_capable = False
 #userpriv_capable = (os.getuid() == 0)
@@ -612,6 +612,14 @@
 		else:
 			myline=mylines[pos]
 			mobj=pat.match(myline)
+			if mobj == None:
+				source_match = re.match('source\s+(.*)$', myline)
+				if source_match:
+					mymakeconf.update(parse_makeconf(open(source_match.group(1).strip(), 'r').readlines()))
+				else:
+					print '>> Parse error; dumping make.conf'
+					for line in mylines: sys.stdout.write('  ' + line)
+					raise Exception('Unparsable line %r' % myline)
 			pos += 1
 			if mobj.group(2):
 			    clean_string = re.sub(r"\"",r"",mobj.group(2))
@@ -630,12 +638,9 @@
 def read_makeconf(mymakeconffile):
 	if os.path.exists(mymakeconffile):
 	    try:
-		    myf=open(mymakeconffile,"r")
-		    mylines=myf.readlines()
-		    myf.close()
-		    return parse_makeconf(mylines)
+		return portage_util.getconfig(mymakeconffile, allow_sourcing=True)
 	    except:
-		    raise CatalystError, "Could not open make.conf file "+mymakeconffile
+		raise CatalystError, "Could not open make.conf file "+mymakeconffile
 	else:
 	    makeconf={}
 	    return makeconf
diff -ru catalyst-2.0.4.orig/modules/generic_stage_target.py catalyst-2.0.4/modules/generic_stage_target.py
--- catalyst-2.0.4.orig/modules/generic_stage_target.py	2007-06-08 16:35:29.000000000 -0500
+++ catalyst-2.0.4/modules/generic_stage_target.py	2007-06-11 09:26:40.000000000 -0500
@@ -18,7 +18,7 @@
 		self.valid_values.extend(["version_stamp","target","subarch",\
 			"rel_type","profile","snapshot","source_subpath","portage_confdir",\
 			"cflags","cxxflags","ldflags","cbuild","chost","hostuse","portage_overlay",\
-			"distcc_hosts","makeopts","pkgcache_path","kerncache_path"])
+			"distcc_hosts","makeopts","pkgcache_path","kerncache_path","extra_mounts"])
 		
 		self.set_valid_build_kernel_vars(addlargs)
 		generic_target.__init__(self,myspec,addlargs)
@@ -198,6 +198,15 @@
 			self.mounts.append("/tmp/kerncache")
 			self.mountmap["/tmp/kerncache"]=self.settings["kerncache_path"]
 
+		if self.settings.has_key("extra_mounts"):
+			for extra_mount in self.settings["extra_mounts"].split():
+				if ':' in extra_mount:
+					extra_mount_source, extra_mount_target = extra_mount.split(':', 1)
+				else:
+					extra_mount_source = extra_mount_target = extra_mount
+				self.mounts.append(extra_mount_target)
+				self.mountmap[extra_mount_target] = extra_mount_source
+
 		if self.settings.has_key("CCACHE"):
 			if os.environ.has_key("CCACHE_DIR"):
 				ccdir=os.environ["CCACHE_DIR"]
@@ -736,8 +745,12 @@
 			print "Configuring profile link..."
 			cmd("rm -f "+self.settings["chroot_path"]+"/etc/make.profile",\
 					"Error zapping profile link",env=self.env)
-	    		cmd("ln -sf ../usr/portage/profiles/"+self.settings["target_profile"]+\
-		    		" "+self.settings["chroot_path"]+"/etc/make.profile","Error creating profile link",env=self.env)
+			if self.settings['target_profile'][0] == '/':
+				symlink_target = self.settings["target_profile"]
+			else:
+				symlink_target = "../usr/portage/profiles/"+self.settings["target_profile"]
+	    		cmd("ln -sf " + symlink_target + " " + \
+		    		self.settings["chroot_path"]+"/etc/make.profile","Error creating profile link",env=self.env)
 		    	touch(self.settings["autoresume_path"]+"config_profile_link")
 				       
 	def setup_confdir(self):	

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [gentoo-catalyst]  [PATCH] Use Portage's make.conf parser, allow user-specified extra bind mount points, allow absolute profile paths
  2007-06-11 14:38 [gentoo-catalyst] [PATCH] Use Portage's make.conf parser, allow user-specified extra bind mount points, allow absolute profile paths Charles Duffy
@ 2007-06-12 19:06 ` Chris Gianelloni
  0 siblings, 0 replies; 2+ messages in thread
From: Chris Gianelloni @ 2007-06-12 19:06 UTC (permalink / raw
  To: gentoo-catalyst

[-- Attachment #1: Type: text/plain, Size: 502 bytes --]

On Mon, 2007-06-11 at 09:38 -0500, Charles Duffy wrote:
> If 'yall want me to split patch this out into multiple pieces, I'd be
> glad to do so.

Please do.  The things you've added all seem fine and would likely all
be included, but I much prefer a "one patch per change" approach so we
can easily back them out, if necessary.

-- 
Chris Gianelloni
Release Engineering Strategic Lead
Alpha/AMD64/x86 Architecture Teams
Games Developer/Council Member/Foundation Trustee
Gentoo Foundation

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-06-12 19:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-11 14:38 [gentoo-catalyst] [PATCH] Use Portage's make.conf parser, allow user-specified extra bind mount points, allow absolute profile paths Charles Duffy
2007-06-12 19:06 ` Chris Gianelloni

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