Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 24 Dec 2010 04:52:53 +0000 (UTC)
From:      Doug Barton <dougb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r216684 - user/dougb/portmaster
Message-ID:  <201012240452.oBO4qrhh078998@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dougb
Date: Fri Dec 24 04:52:53 2010
New Revision: 216684
URL: http://svn.freebsd.org/changeset/base/216684

Log:
  Clean up empty directories WRKDIRPREFIX when the parent exits
  
  This is not only tidier, but it also helps the situation when
  portmaster is occasionally run as root even though most usage
  is with the built-in sudo support.

Modified:
  user/dougb/portmaster/portmaster

Modified: user/dougb/portmaster/portmaster
==============================================================================
--- user/dougb/portmaster/portmaster	Fri Dec 24 01:37:13 2010	(r216683)
+++ user/dougb/portmaster/portmaster	Fri Dec 24 04:52:53 2010	(r216684)
@@ -146,6 +146,9 @@ parent_exit () {
 
 	for f in ${TMPDIR}/f-${PM_PARENT_PID}-*; do pm_unlink $f ; done
 
+	[ -n "$PM_WRKDIRPREFIX" ] &&
+		find -d $PM_WRKDIRPREFIX -mindepth 1 -type d -empty -delete 2>/dev/null
+
 	case "$DISPLAY_LIST" in
 	*' '*)	if [ -n "$1" ]; then
 			echo "===>>> There are messages from installed ports to display,"
@@ -3042,7 +3045,11 @@ fi
 # Do these things first time through
 if [ -z "$PM_INDEX_ONLY" -a -z "$PM_BUILDING" -a -z "$SHOW_WORK" -a -z "$NO_ACTION" ]; then
 	# Do not start this in the background until we are sure we are going to build
-	[ "$$" -eq "$PM_PARENT_PID" -a -n "$DI_FILES" ] && (read_distinfos)&
+	if [ "$$" -eq "$PM_PARENT_PID" ]; then
+		[ -n "$DI_FILES" ] && (read_distinfos)&
+		
+		PM_WRKDIRPREFIX=`pm_make_b -V WRKDIRPREFIX`
+	fi
 
 	# Handle the problem of manual fetching
 	[ -z "$PM_PACKAGES" ] && master_sites=`pm_make -V MASTER_SITES`



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201012240452.oBO4qrhh078998>