public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/catalyst:master commit in: /, files/, modules/
@ 2012-10-25  3:22 Richard Farina
  0 siblings, 0 replies; only message in thread
From: Richard Farina @ 2012-10-25  3:22 UTC (permalink / raw
  To: gentoo-commits

commit:     4fc99aed1c6ba4d262f7d0c70f07cdd3413c18df
Author:     Rick Farina (Zero_Chaos) <zerochaos <AT> gentoo <DOT> org>
AuthorDate: Thu Oct 25 03:20:36 2012 +0000
Commit:     Richard Farina <zerochaos <AT> gentoo <DOT> org>
CommitDate: Thu Oct 25 03:20:36 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=4fc99aed

initial support for /var/tmp/portage in tmpfs

recently a bug in ZFS completely preventing building on my host system,
due to this fact I hacked in this support to get around the issue.
Since building in tmpfs can speed things significantly I've added the
support properly and optionally. Hopefully others like this as much as
I do.
My motivation: https://bugs.gentoo.org/show_bug.cgi?id=411555
Thanks to jmbsvicetto and dol-sen for helping me read catalyst.

---
 catalyst                        |    3 +++
 files/catalyst.conf             |    6 ++++++
 modules/generic_stage_target.py |   18 ++++++++++++------
 3 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/catalyst b/catalyst
index 33e121f..483a6e5 100755
--- a/catalyst
+++ b/catalyst
@@ -165,6 +165,9 @@ def parse_config(myconfig):
 		print "Envscript support enabled."
 		conf_values["ENVSCRIPT"]=myconf["envscript"]
 
+	if myconf.has_key("var_tmpfs_portage"):
+		conf_values["var_tmpfs_portage"]=myconf["var_tmpfs_portage"];
+
 def import_modules():
 	# import catalyst's own modules (i.e. catalyst_support and the arch modules)
 	targetmap={}

diff --git a/files/catalyst.conf b/files/catalyst.conf
index a5ef120..49d2a15 100644
--- a/files/catalyst.conf
+++ b/files/catalyst.conf
@@ -80,3 +80,9 @@ snapshot_cache="/var/tmp/catalyst/snapshot_cache"
 # storedir specifies where catalyst will store everything that it builds, and
 # also where it will put its temporary files and caches.
 storedir="/var/tmp/catalyst"
+
+# var_tmpfs_portage will mount a tmpfs for /var/tmp/portage so building takes place in RAM
+# this feature requires a pretty large tmpfs ({open,libre}office needs ~8GB to build)
+# WARNING: If you use too much RAM everything will fail horribly and it is not our fault.
+# set size of /var/tmp/portage tmpfs in gigabytes
+# var_tmpfs_portage=16

diff --git a/modules/generic_stage_target.py b/modules/generic_stage_target.py
index eb5f490..ae7d97c 100644
--- a/modules/generic_stage_target.py
+++ b/modules/generic_stage_target.py
@@ -174,14 +174,14 @@ class generic_stage_target(generic_target):
 
 		""" Setup our mount points """
 		if self.settings.has_key("SNAPCACHE"):
-			self.mounts=["/proc","/dev","/usr/portage","/usr/portage/distfiles"]
+			self.mounts=["/proc","/dev","/usr/portage","/usr/portage/distfiles","/var/tmp/portage"]
 			self.mountmap={"/proc":"/proc","/dev":"/dev","/dev/pts":"/dev/pts",\
 				"/usr/portage":self.settings["snapshot_cache_path"]+"/portage",\
-				"/usr/portage/distfiles":self.settings["distdir"]}
+				"/usr/portage/distfiles":self.settings["distdir"],"/var/tmp/portage":"tmpfs"}
 		else:
-			self.mounts=["/proc","/dev","/usr/portage/distfiles"]
+			self.mounts=["/proc","/dev","/usr/portage/distfiles","/var/tmp/portage"]
 			self.mountmap={"/proc":"/proc","/dev":"/dev","/dev/pts":"/dev/pts",\
-				"/usr/portage/distfiles":self.settings["distdir"]}
+				"/usr/portage/distfiles":self.settings["distdir"],"/var/tmp/portage":"tmpfs"}
 		if os.uname()[0] == "Linux":
 			self.mounts.append("/dev/pts")
 
@@ -887,8 +887,14 @@ class generic_stage_target(generic_target):
 					retval=os.system("mount_nullfs "+src+" "+\
 						self.settings["chroot_path"]+x)
 			else:
-				retval=os.system("mount --bind "+src+" "+\
-					self.settings["chroot_path"]+x)
+				if src == "tmpfs":
+					if self.settings.has_key("var_tmpfs_portage"):
+						retval=os.system("mount -t tmpfs -o size="+\
+							self.settings["var_tmpfs_portage"]+"G "+src+" "+\
+							self.settings["chroot_path"]+x)
+				else:
+					retval=os.system("mount --bind "+src+" "+\
+						self.settings["chroot_path"]+x)
 			if retval!=0:
 				self.unbind()
 				raise CatalystError,"Couldn't bind mount "+src


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

only message in thread, other threads:[~2012-10-25  3:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-25  3:22 [gentoo-commits] proj/catalyst:master commit in: /, files/, modules/ Richard Farina

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