svn commit: r237473 - user/dougb/portmaster

Doug Barton dougb at FreeBSD.org
Sat Jun 23 08:36:50 UTC 2012


Author: dougb
Date: Sat Jun 23 08:36:49 2012
New Revision: 237473
URL: http://svn.freebsd.org/changeset/base/237473

Log:
  Various fixes to IPC_SAVE:
  1. In safe_exit() always zero out the file before writing. This is probably
     redundant now given the following change, but I'll leave it in to be
     safe for now.
  2. Zero out the file after reading it. The change in r236996 could lead
     to the parent process reading a stale file under certain circumstances.
     The combination of things that need to happen for this to occur are
     complex, but not impossible.
  3. Move the writing of $PM_BUILD_ONLY_LIST - related variables into
     safe_exit(). When originally put in the previous location it saved
     what could have been a spurious test, but that test was long ago
     added to safe_exit(). Also, by not writing it there it could be
     missed in certain circumstances where the exit happened without
     reaching that code in the main script.
  
     This brings all the code that writes to the file into safe_exit()
  4. NB_DELETE can only be set while building, so move writing it to that
     section.
  
  When -F, and the port has no distfiles, report that explicitly

Modified:
  user/dougb/portmaster/portmaster

Modified: user/dougb/portmaster/portmaster
==============================================================================
--- user/dougb/portmaster/portmaster	Sat Jun 23 07:49:10 2012	(r237472)
+++ user/dougb/portmaster/portmaster	Sat Jun 23 08:36:49 2012	(r237473)
@@ -261,8 +261,8 @@ safe_exit () {
 		[ -n "$grep_deps" ] && pm_unlink $grep_deps
 
 		# Save state for the parent process to read back in
+		> $IPC_SAVE
 		if [ -z "$PM_FIRST_PASS" ]; then
-			> $IPC_SAVE
 			echo "DISPLAY_LIST='$DISPLAY_LIST'" >> $IPC_SAVE
 			echo "INSTALLED_LIST='$INSTALLED_LIST'" >> $IPC_SAVE
 
@@ -273,9 +273,21 @@ safe_exit () {
 				[ "$i" = "$portdir" ] && continue
 				pnu_temp="${pnu_temp}${i} "
 			done
-
 			PM_NEEDS_UPDATE=" ${pnu_temp}"
+
+			[ -z "$NO_BACKUP" -a -z "$BACKUP" ] && echo "NB_DELETE='$NB_DELETE'" >> $IPC_SAVE
 		else
+			if [ "$PM_BUILD_ONLY_LIST" = pmp_doing_build_deps ]; then
+				echo "build_only_dl_g='$build_only_dl_g'" >> $IPC_SAVE
+				echo "run_dl_g='$run_dl_g'" >> $IPC_SAVE
+				rundep_list=`uniquify_list $rundep_list`
+				echo "rundep_list='$rundep_list'" >> $IPC_SAVE
+				for f in $rundep_list; do
+					eval echo "export $f=\'\$$f\'" >> $IPC_SAVE
+					eval echo "export ${f}_p=\'\$${f}_p\'" >> $IPC_SAVE
+				done
+			fi
+
 			# Do these here so +IGNOREME can modify them
 			echo "num_of_deps='$num_of_deps'" >> $IPC_SAVE
 			echo "build_l='$build_l'" >> $IPC_SAVE
@@ -284,7 +296,6 @@ safe_exit () {
 		echo "CUR_DEPS='$CUR_DEPS'" >> $IPC_SAVE
 		echo "dep_of_deps='$dep_of_deps'" >> $IPC_SAVE
 		echo "PM_NEEDS_UPDATE='$PM_NEEDS_UPDATE'" >> $IPC_SAVE
-		[ -z "$NO_BACKUP" -a -z "$BACKUP" ] && echo "NB_DELETE='$NB_DELETE'" >> $IPC_SAVE
 		if [ -n "$INTERACTIVE_UPDATE" ]; then
 			echo "INTERACTIVE_YES='$INTERACTIVE_YES'" >> $IPC_SAVE
 			echo "INTERACTIVE_NO='$INTERACTIVE_NO'" >> $IPC_SAVE
@@ -2316,7 +2327,7 @@ update_port () {
 
 	if [ -z "$NO_ACTION" -o -n "$PM_FIRST_PASS" ]; then
 		($0 $ARGS $1) || update_failed=update_failed
-		. $IPC_SAVE
+		. $IPC_SAVE && > $IPC_SAVE
 		[ -n "$update_failed" ] && fail "Update for $1 failed"
 	else
 		pm_v "===>>> Build canceled due to -n flag"
@@ -2815,7 +2826,7 @@ multiport () {
 		num=$(( $num + 1 ))
 		init_term_printf "$port ${num}/${numports}"
 		($0 $ARGS $port) || update_failed=update_failed
-		. $IPC_SAVE
+		. $IPC_SAVE && > $IPC_SAVE
 		[ -n "$update_failed" ] && fail "Update for $port failed"
 
 		case "$PM_NEEDS_UPDATE" in
@@ -2859,7 +2870,7 @@ multiport () {
 		num=$(( $num + 1 ))
 		init_term_printf "$port ${num}/${numports}"
 		($0 $ARGS $port) || update_failed=update_failed
-		. $IPC_SAVE
+		. $IPC_SAVE && > $IPC_SAVE
 		[ -n "$update_failed" ] && fail "Update for $port failed"
 	done
 
@@ -3281,6 +3292,8 @@ if [ -z "$PM_INDEX_ONLY" -a -z "$PM_BUIL
 			    rm -f ${TMPDIR}/f-${PM_PARENT_PID}-*-${portdir#*/}.* )&
 		fi
 		unset master_sites distfiles file DONT_FETCH fetchlog allfiles
+	elif [ -n "$FETCH_ONLY" ]; then
+		echo "===>>> No distfiles to fetch"
 	fi
 
 	if [ -z "$FETCH_ONLY" -a ! "$PM_PACKAGES" = only ]; then
@@ -3319,22 +3332,7 @@ if [ -n "$PM_FIRST_PASS" ]; then
 	[ -n "$PM_URB" -o -n "$PM_URB_UP" ] &&
 		PM_URB_DONE="${PM_URB_DONE}${upg_port}:"
 
-	if [ ! "$$" -eq "$PM_PARENT_PID" ]; then
-		# Save state for the parent process to read back in
-		> $IPC_SAVE
-		if [ "$PM_BUILD_ONLY_LIST" = pmp_doing_build_deps ]; then
-			echo "build_only_dl_g='$build_only_dl_g'" >> $IPC_SAVE
-			echo "run_dl_g='$run_dl_g'" >> $IPC_SAVE
-			rundep_list=`uniquify_list $rundep_list`
-			echo "rundep_list='$rundep_list'" >> $IPC_SAVE
-			for f in $rundep_list; do
-				eval echo "export $f=\'\$$f\'" >> $IPC_SAVE
-				eval echo "export ${f}_p=\'\$${f}_p\'" >> $IPC_SAVE
-			done
-		fi
-
-		safe_exit
-	fi
+	[ "$$" -eq "$PM_PARENT_PID" ] || safe_exit
 
 	check_fetch_only
 	post_first_pass $portdir


More information about the svn-src-user mailing list