svn commit: r236996 - user/dougb/portmaster

Doug Barton dougb at FreeBSD.org
Wed Jun 13 06:19:09 UTC 2012


Author: dougb
Date: Wed Jun 13 06:19:08 2012
New Revision: 236996
URL: http://svn.freebsd.org/changeset/base/236996

Log:
  When calling trap_exit() in a child process we need to signal the
  parent(s) that we trap'ed so that the various post-run cleanups and
  updates can still happen properly.
  
  In a related change, in safe_exit() remove a shortcut from r214541 that
  was safe at the time, but isn't any longer because we now have more
  stuff happening after a run so we still need to update the parent even
  if the child fail'ed or trap'ed.
  
  When we're run by script(1) the parent process is going to be [sh], not
  $0, so go back to the less efficient but safer method of safeguarding
  the parent in kill_bad_children().
  
  For -a remove a -v line that is redundant now with the new in-line
  term_printf() code.
  
  In the new in-line printing code for term_printf() use a simpler
  pattern to match $1 that also catches the following ...
  
  In multiport(), update the total number of ports after the first pass
  to account for ports given on the command line that turn out to be
  dependencies of other ports given on the command line, and print a
  summary with the number of parent ports and dependencies prior to the
  confirmation prompt.

Modified:
  user/dougb/portmaster/portmaster

Modified: user/dougb/portmaster/portmaster
==============================================================================
--- user/dougb/portmaster/portmaster	Wed Jun 13 05:47:24 2012	(r236995)
+++ user/dougb/portmaster/portmaster	Wed Jun 13 06:19:08 2012	(r236996)
@@ -73,6 +73,8 @@ trap_exit () {
 	fi
 
 	if [ "$$" -eq "$PM_PARENT_PID" ]; then
+		. $IPC_SAVE
+
 		local n=0
 		while ps -axo pid,ppid,command | grep -v egrep |
 		    egrep -q "(make -DBATCH checksum|/fetch |\[sh\])"; do
@@ -92,6 +94,14 @@ trap_exit () {
 			fi
 			[ -n "$logs" ] && echo ''
 		fi
+	else
+		# Signal the parent if a child trap'ed, or read the file if we are
+		# an intermediate process.
+		if ! ls ${TMPDIR}/f-${PM_PARENT_PID}-TEAC\.* >/dev/null 2>&1; then
+			pm_mktemp TEAC		# Trap Exit Already Called
+		else
+			. $IPC_SAVE
+		fi
 	fi
 	safe_exit 1
 }
@@ -109,8 +119,9 @@ kill_bad_children () {
 			*'make -DBATCH checksum'*|*'/fetch '*|\[sh\]) pm_kill -9 $pid ;;
 			esac ;;
 		*)	[ $pgid -eq $mypgid ] || continue
+			[ $pid -eq $PM_PARENT_PID ] && continue
 			case "$command" in
-			*" $0 "*) [ $pid -ne $PM_PARENT_PID ] && pm_kill $pid ;;
+			*" $0 "*) pm_kill $pid ;;
 			*'make -DBATCH checksum'*|*'/fetch '*|\[sh\]) pm_kill $pid ;;
 			esac ;;
 		esac
@@ -249,8 +260,6 @@ safe_exit () {
 	else
 		[ -n "$grep_deps" ] && pm_unlink $grep_deps
 
-		[ -n "$1" ] && exit $1
-
 		# Save state for the parent process to read back in
 		if [ -z "$PM_FIRST_PASS" ]; then
 			> $IPC_SAVE
@@ -2223,7 +2232,7 @@ check_fetch_only () {
 term_printf () {
 	case "$1" in
 	'')	[ -n "$PM_MULTI_PORTS" ] && echo -e "\n===>>> ${PM_PARENT_PORT}" ;;
-	*\>\>*)	echo -e "\n===>>> ${PM_PARENT_PORT}${1}" ;;
+	*\(*)	echo -e "\n===>>> ${PM_PARENT_PORT}${1}" ;;
 	esac
 
 	[ -n "$PM_NO_TERM_TITLE" ] && return
@@ -2755,7 +2764,6 @@ multiport () {
 		fi
 
 		numports=$(( $numports + 1 ))
-
 		worklist="$worklist $port"
 		portlist="${portlist}\t${port}\n"
 		PM_MULTI_PORTS="${PM_MULTI_PORTS}${port}:"
@@ -2807,6 +2815,8 @@ multiport () {
 		*)		numports=$(( $numports - 1 )) ;;
 		esac
 	done
+	numports=$num
+	PM_PARENT_PORT="Total parent ports: $numports Total dependencies:"
 
 	if [ -n "$PM_URB" ]; then
 		unset PM_URB ; PM_URB=pm_urb_post_first_pass
@@ -2963,8 +2973,6 @@ all_first_pass () {
 	local iport origin
 
 	for iport in "$@"; do
-		pm_v "===>>> $iport"
-
 		case "$CUR_DEPS" in *:${iport}:*) continue ;; esac
 
 		origin=`origin_from_pdb $iport` || {


More information about the svn-src-user mailing list