[PC-BSD Commits] r13321 - in pcbsd/current/src-sh/pbi-manager: . man8

svn at pcbsd.org svn at pcbsd.org
Wed Oct 12 11:52:49 PDT 2011


Author: kris
Date: 2011-10-12 11:52:49 -0700 (Wed, 12 Oct 2011)
New Revision: 13321

Modified:
   pcbsd/current/src-sh/pbi-manager/man8/pbi_autobuild.8
   pcbsd/current/src-sh/pbi-manager/man8/pbi_makeport.8
   pcbsd/current/src-sh/pbi-manager/pbi-manager
Log:

Add new --tmpfs options to pbi_makeport and pbi_autobuild commands, which enables using TMPFS for
a ports MKDIRPREFIX, speeding up the compiles and reducing disk IO



Modified: pcbsd/current/src-sh/pbi-manager/man8/pbi_autobuild.8
===================================================================
--- pcbsd/current/src-sh/pbi-manager/man8/pbi_autobuild.8	2011-10-12 17:20:10 UTC (rev 13320)
+++ pcbsd/current/src-sh/pbi-manager/man8/pbi_autobuild.8	2011-10-12 18:52:49 UTC (rev 13321)
@@ -13,6 +13,7 @@
 .Op Fl -genpatch
 .Op Fl -keep Ar num
 .Op Fl -prune
+.Op Fl -tmpfs
 .Op Fl -sign Ar keyfile
 .Sh DESCRIPTION
 The utility,
@@ -47,6 +48,9 @@
 command to generate update patch files.
 .It Fl -prune
 Remove any PBIs which no longer have an associated module in confdir. 
+.It Fl -tmpfs
+Automatically create and mount a TMPFS file system and use it for WRKDIRPREFIX.
+This can be used to speed up port compiles on systems with available RAM.
 .It Fl -sign Ar keyfile
 Digitially sign the PBI file with the openssl private key file specified
 .Sh NOTES

Modified: pcbsd/current/src-sh/pbi-manager/man8/pbi_makeport.8
===================================================================
--- pcbsd/current/src-sh/pbi-manager/man8/pbi_makeport.8	2011-10-12 17:20:10 UTC (rev 13320)
+++ pcbsd/current/src-sh/pbi-manager/man8/pbi_makeport.8	2011-10-12 18:52:49 UTC (rev 13321)
@@ -15,6 +15,7 @@
 .Op Fl -delbuild
 .Op Fl -mkdebug
 .Op Fl -no-prune
+.Op Fl -tmpfs
 .Op Fl -sign Ar keyfile
 .Op Ar port
 .Sh DESCRIPTION
@@ -57,6 +58,9 @@
 Disable auto-pruning of non REQUIREDBY ports after the compile phase.
 By default any ports which are used solely building and not required
 for program execution will be pruned. 
+.It Fl -tmpfs
+Automatically create and mount a TMPFS file system and use it for WRKDIRPREFIX.
+This can be used to speed up port compiles on systems with available RAM. 
 .It Fl -sign Ar keyfile
 Digitially sign the PBI file with the openssl private key file specified
 .Sh NOTES

Modified: pcbsd/current/src-sh/pbi-manager/pbi-manager
===================================================================
--- pcbsd/current/src-sh/pbi-manager/pbi-manager	2011-10-12 17:20:10 UTC (rev 13320)
+++ pcbsd/current/src-sh/pbi-manager/pbi-manager	2011-10-12 18:52:49 UTC (rev 13321)
@@ -62,6 +62,7 @@
   --genpatch   -- Generate patch files (*.pbp) from archived PBIs to current
   --keep <num> -- Keep <num> old versions in archive folder for each built PBI
   --prune      -- Remove files from 'outdir' that no longer have a module
+  --tmpfs      -- Use TMPFS for port WRKDIRPREFIX
   --sign key   -- Sign the PBI(s) with specified openssl key
 
 EOF
@@ -116,6 +117,7 @@
   -p prefix    -- Specify alternate PBI Compile PREFIX
   --delbuild   -- Delete existing build dirs if they exist
   --mkdebug    -- Drop to debug shell if port make fails
+  --tmpfs      -- Use TMPFS for port WRKDIRPREFIX
   --no-prune   -- Do not prune non REQUIREDBY ports
   --sign key   -- Sign the PBI with specified openssl key
 
@@ -969,6 +971,8 @@
                         ;;
            --prune)     PBI_AB_PRUNE="YES" 
                         ;;
+           --tmpfs)     PBI_AB_TMPFS="YES" 
+                        ;;
             --sign)     if [ $# -eq 1 ]; then usage_autob_pbi; fi
                         shift; PBI_AB_SSLPRIVKEY="$1"
                         ;;
@@ -1097,6 +1101,8 @@
                         ;;
                 --mkdebug)	MKDEBUG="YES"
                         ;;
+                --tmpfs)	MKTMPFS="YES"
+                        ;;
                 -o)	if [ $# -eq 1 ]; then usage_make_pbi; fi
                         shift
 			get_abspath "$1"
@@ -1314,6 +1320,7 @@
         # User overridable variables
 	MKDELBUILD=""
 	MKDEBUG=""
+	MKTMPFS=""
 	PBI_AB_ARCHIVENUM=""
 	PBI_AB_CONFDIR=""
 	PBI_AB_GENPATCH="NO"
@@ -1321,6 +1328,7 @@
 	PBI_AB_OUTDIR=""
 	PBI_AB_SSLPRIVKEY=""
 	PBI_AB_PRUNE=""
+	PBI_AB_TMPFS=""
 	PBI_BUILDONLY="NO"
 	PBI_CAUTHOR=""
 	PBI_CBACKUP=""
@@ -1409,7 +1417,6 @@
 		rm -rf "${PBI_PROGDIRPATH}" >/dev/null 2>/dev/null
 		chflags -R noschg "${PBI_PROGDIRPATH}" >/dev/null 2>/dev/null
 		rm -rf "${PBI_PROGDIRPATH}" >/dev/null 2>/dev/null
-		rm -rf /ramfs/build.$$ >/dev/null 2>/dev/null
 	fi
 	if [ -z "$PBI_CHROOTDIR" ] ; then return ; fi
 	chroot_make_cleanup
@@ -1419,7 +1426,7 @@
 load_pbi_conffile() {
   	if [ ! -d "${PBI_CONFDIR}" ] ; then return 0 ; fi
   	if [ -e "${PBI_CONFDIR}/${PBI_CONFFILE}" ] ; then
-		unset PBI_MAKEPORT PBI_BUILDKEY PBI_REQUIRESROOT PBI_PROGNAME PBI_PROGWEB PBI_PROGAUTHOR PBI_PROGICON PBI_MKPORTBEFORE PBI_MKPORTAFTER PBI_MAKEOPTS PBI_EXCLUDELIST PBI_AB_PRIORITY PBI_HASH_EXCLUDES
+		unset PBI_MAKEPORT PBI_BUILDKEY PBI_REQUIRESROOT PBI_PROGNAME PBI_PROGWEB PBI_PROGAUTHOR PBI_PROGICON PBI_MKPORTBEFORE PBI_MKPORTAFTER PBI_MAKEOPTS PBI_EXCLUDELIST PBI_AB_PRIORITY PBI_HASH_EXCLUDES PBI_AB_TMPFS
 		. ${PBI_CONFDIR}/${PBI_CONFFILE}
 	fi
 }
@@ -1563,13 +1570,12 @@
 	echo "NO_IGNORE=yes" >> ${MAKE_CONF}
 	echo "PACKAGE_BUILDING=yes" >> ${MAKE_CONF}
 
-	# If a ramfs dir is present, lets use it
-	if [ -d "/ramfs" ] ; then 
-		mkdir /ramfs/build.$$
-		echo "WRKDIRPREFIX=/ramfs/build.$$" >> ${MAKE_CONF}
+	# If we plan on using TMPFS mount it now
+	if [ "$MKTMPFS" = "YES" ] ; then 
+		echo "WRKDIRPREFIX=/tmpfs" >> ${MAKE_CONF}
+		echo "DEPENDS_CLEAN=YES" >> ${MAKE_CONF}
 	fi
 
-
 	if [ ! -z "$PBI_MAKEOPTS" ] ; then
 		# Check if we have custom make opts
 		echo "${PBI_MAKEOPTS}" >> ${MAKE_CONF}
@@ -5231,7 +5237,7 @@
 	  for pbi in `find . -type f -name "${PBI_CONFFILE}" | grep -v '\.svn' | sort`
 	  do
 		# Figure out the target port for this build
-		unset PBI_MAKEPORT PBI_BUILDKEY PBI_PROGVERSION PBI_REQUIRESROOT PBI_PROGNAME PBI_PROGWEB PBI_PROGAUTHOR PBI_PROGICON PBI_MKPORTBEFORE PBI_MKPORTAFTER PBI_MAKEOPTS PBI_EXCLUDELIST PBI_AB_PRIORITY PBI_HASH_EXCLUDES
+		unset PBI_MAKEPORT PBI_BUILDKEY PBI_PROGVERSION PBI_REQUIRESROOT PBI_PROGNAME PBI_PROGWEB PBI_PROGAUTHOR PBI_PROGICON PBI_MKPORTBEFORE PBI_MKPORTAFTER PBI_MAKEOPTS PBI_EXCLUDELIST PBI_AB_PRIORITY PBI_HASH_EXCLUDES PBI_AB_TMPFS
 		. ${pbi}
 
 		# If we have a PBI already and this one has no version we can continue
@@ -5295,7 +5301,7 @@
 	  # We have something to build lets do it!
 	  if [ "$AB_FOUND" = "1" ] ; then 
 	      pbi="$CUR_WORKING_PBI"
-	      unset PBI_MAKEPORT PBI_BUILDKEY PBI_PROGVERSION PBI_REQUIRESROOT PBI_PROGNAME PBI_PROGWEB PBI_PROGAUTHOR PBI_PROGICON PBI_MKPORTBEFORE PBI_MKPORTAFTER PBI_MAKEOPTS PBI_EXCLUDELIST PBI_AB_PRIORITY PBI_HASH_EXCLUDES
+	      unset PBI_MAKEPORT PBI_BUILDKEY PBI_PROGVERSION PBI_REQUIRESROOT PBI_PROGNAME PBI_PROGWEB PBI_PROGAUTHOR PBI_PROGICON PBI_MKPORTBEFORE PBI_MKPORTAFTER PBI_MAKEOPTS PBI_EXCLUDELIST PBI_AB_PRIORITY PBI_HASH_EXCLUDES PBI_AB_TMPFS
 	      . ${pbi}
 	      get_pbi_progversion
 
@@ -5356,6 +5362,11 @@
 		_flags="${_flags} --sign ${PBI_AB_SSLPRIVKEY}"
 	fi
 
+	# Check if we need to enable tmpfs
+ 	if [ "$PBI_AB_TMPFS" = "YES" ] ; then
+		_flags="${_flags} --tmpfs"
+	fi
+
         unset PBI_PROGVERSION
 	get_pbi_progversion
 
@@ -5961,11 +5972,6 @@
 	# Check if we created a linux app, and need to copy files for it
 	auto_copy_linuxbase
 
-	# Delete the tmp ramfs
-	if [ -d "/ramfs/build.$$" ] ; then
-		rm -rf /ramfs/build.$$ >/dev/null 2>/dev/null
-	fi
-
   	# Break here if we are only doing a build
 	if [ "${PBI_BUILDONLY}" = "YES" ] ; then exit_trap; fi
 
@@ -6006,7 +6012,7 @@
 	umount ${PBI_CHROOTDIR}/dev >/dev/null 2>/dev/null
 	umount ${PBI_CHROOTDIR}/compat/linux/proc >/dev/null 2>/dev/null
 	umount ${PBI_CHROOTDIR}/usr/ports/distfiles >/dev/null 2>/dev/null
-	umount ${PBI_CHROOTDIR}/ramfs >/dev/null 2>/dev/null
+	umount ${PBI_CHROOTDIR}/tmpfs >/dev/null 2>/dev/null
 	rm -rf "${PBI_CHROOTDIR}" >/dev/null 2>/dev/null
 	chflags -R noschg ${PBI_CHROOTDIR} >/dev/null 2>/dev/null
 	rm -rf "${PBI_CHROOTDIR}" >/dev/null 2>/dev/null
@@ -6041,13 +6047,12 @@
 		mkdir -p ${PORTSDIR}/distfiles
 	fi
 	mount_nullfs ${PORTSDIR}/distfiles ${PBI_CHROOTDIR}/usr/ports/distfiles
+
+	if [ "$MKTMPFS" = "YES" ] ; then 
+		mkdir ${PBI_CHROOTDIR}/tmpfs
+		mount -t tmpfs tmpfs ${PBI_CHROOTDIR}/tmpfs
+	fi
 	
-	# Check if the ramfs dir exists, and if so mount it for fast port building
-	if [ -d "${PBI_APPDIR}/ramfs" ] ; then
-		mkdir ${PBI_CHROOTDIR}/ramfs
-		mount_nullfs ${PBI_APPDIR}/ramfs ${PBI_CHROOTDIR}/ramfs
-	fi
-
 	# Now copy over the pbi_* scripts
 	mkdir ${PBI_CHROOTDIR}/usr/local/sbin
 	cp ${PROGBASE}/sbin/pbi_* ${PBI_CHROOTDIR}/usr/local/sbin



More information about the Commits mailing list