diff --git a/catalyst b/catalyst index 82b4dc9..71a842e 100755 --- a/catalyst +++ b/catalyst @@ -61,7 +61,7 @@ def parse_config(myconfig): "sharedir":"/usr/share/catalyst","distdir":"/usr/portage/distfiles",\ "portdir":"/usr/portage","options":"",\ "snapshot_cache":"/var/tmp/catalyst/snapshot_cache",\ - "hash_function":"crc32"} + "hash_function":"crc32","tmpfs_opts":""} # first, try the one passed (presumably from the cmdline) if myconfig: @@ -152,6 +152,10 @@ def parse_config(myconfig): print "Use of metadata_overlay module for portage enabled." conf_values["METADATA_OVERLAY"]="1" + if "tmpfs" in conf_values["options"].split(): + print "Use of tmpfs enabled." + conf_values["TMPFS"]="1" + # if "tarball" in string.split(conf_values["options"]): # print "Tarball creation enabled." # conf_values["TARBALL"]="1" diff --git a/files/catalyst.conf b/files/catalyst.conf index b4e2385..855ce23 100644 --- a/files/catalyst.conf +++ b/files/catalyst.conf @@ -58,6 +58,9 @@ hash_function="crc32" # snapcache = cache the snapshot so that it can be bind-mounted into the chroot. # WARNING: moving parts of the portage tree from within fsscript *will* break # your cache. The cache is unlinked before any empty or rm processing, though. +# tmpfs = Mount tmpfs on /var/tmp/portage to speed up builds. You can set the +# size of the tmpfs by using tmpfs_opts. If tmpfs_opts is not set the +# tmpfs will be the default size. EX: tmpfs_opts="size=1G,nr_inodes=10k" # # (These options can be used together) options="autoresume kerncache metadata_overlay pkgcache seedcache snapcache" diff --git a/modules/generic_stage_target.py b/modules/generic_stage_target.py index 92ec381..47d9eed 100644 --- a/modules/generic_stage_target.py +++ b/modules/generic_stage_target.py @@ -19,7 +19,7 @@ class generic_stage_target(generic_target): self.valid_values.extend(["version_stamp","target","subarch",\ "rel_type","profile","snapshot","source_subpath","portage_confdir",\ "cflags","cxxflags","ldflags","cbuild","hostuse","portage_overlay",\ - "distcc_hosts","makeopts","pkgcache_path","kerncache_path"]) + "distcc_hosts","makeopts","pkgcache_path","kerncache_path","tmpfs_opts"]) self.set_valid_build_kernel_vars(addlargs) generic_target.__init__(self,myspec,addlargs) @@ -229,6 +229,10 @@ class generic_stage_target(generic_target): self.mountmap["/var/cache/icecream"]="/var/cache/icecream" self.env["PATH"]="/usr/lib/icecc/bin:"+self.env["PATH"] + if self.settings.has_key("TMPFS"): + self.mounts.append("/var/tmp/portage") + self.mountmap["/var/tmp/portage"]="tmpfs" + def override_cbuild(self): if self.makeconf.has_key("CBUILD"): self.settings["CBUILD"]=self.makeconf["CBUILD"] @@ -882,6 +886,13 @@ class generic_stage_target(generic_target): else: retval=os.system("mount_nullfs "+src+" "+\ self.settings["chroot_path"]+x) + elif src == "tmpfs": + tmpfs_o="" + if self.settings.has_key("tmpfs_opts"): + tmpfs_o="-o "+self.settings["tmpfs_opts"] + retval=os.system("mount " + tmpfs_o +\ + " -t tmpfs catalyst_tmpfs "+\ + self.settings["chroot_path"]+x) else: retval=os.system("mount --bind "+src+" "+\ self.settings["chroot_path"]+x)