Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 30 May 2012 19:04:58 +0000
From:      scher@FreeBSD.org
To:        svn-soc-all@FreeBSD.org
Subject:   socsvn commit: r236758 - soc2012/scher/par_ports/head/Mk
Message-ID:  <20120530190458.9DC3C1065672@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: scher
Date: Wed May 30 19:04:58 2012
New Revision: 236758
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236758

Log:
  [bugfix] ":=" Type of MAkefile variable expansion leads to wrong
  	results of "$$(...)" command.
  [new_feature] seal breakpoint targets for debbuging purpose
  
  Submitted by: Alexander Pronin

Modified:
  soc2012/scher/par_ports/head/Mk/bsd.parallel.mk

Modified: soc2012/scher/par_ports/head/Mk/bsd.parallel.mk
==============================================================================
--- soc2012/scher/par_ports/head/Mk/bsd.parallel.mk	Wed May 30 18:05:48 2012	(r236757)
+++ soc2012/scher/par_ports/head/Mk/bsd.parallel.mk	Wed May 30 19:04:58 2012	(r236758)
@@ -27,6 +27,11 @@
 	${ECHO_CMD} Press any key when you are ready to continue; \
 	read non_existed_var
 
+seal:
+	@echo "       <<<<<< =====       WE ARE HERE       ===== >>>>>>"
+breakpoint:
+	@${_dparv_DEBUGGING_BREAKPOINT}
+
 # Delay for feedback message if the directory is locked.
 # Just not to annoy a user with feedback message on each attempt to lock a directory.
 _parv_ON_LOCK_FEEDBACK_TIMEOUT?= 2
@@ -81,10 +86,10 @@
 
 _parv_MAKE_LOCK_EXIT_STATUS= 158
 
-# Senquence of commands to lock a directory using ${_parv_LOCK_FILE}.
-# During evaluation of the following commands lockf(1) is holding lock on ${_parv_LOCK_FILE} file.
+# Senquence of commands to lock a directory using ${_parv_${_lock_dir}_LOCK_FILE}.
+# During evaluation of the following commands lockf(1) is holding lock on ${_parv_${_lock_dir}_LOCK_FILE} file.
 # Hence NO other process is able to evaluate any commands using lockf(1)
-# locking on the same ${_parv_LOCK_FILE} file.
+# locking on the same ${_parv_${_lock_dir}_LOCK_FILE} file.
 # 
 # Stalled locks cheking enabled.
 #
@@ -96,11 +101,11 @@
 # _parv_PKG_DBDIR_LOCK_SEQ
 # _parv_LOCK_DIR_LOCK_SEQ
 #
-_parv_LOCK_FILE:= ${_parv_${_lock_dir}_LOCK_FILE}
+#_parv_${_lock_dir}_LOCK_FILE:= ${_parv_${_lock_dir}_LOCK_FILE}
 
-_parv_${_lock_dir}_LOCK_SEQ:= \
-	${CHMOD} 777 ${${_lock_dir}}/${_parv_LOCK_FILE}; \
-	pid=$$(${CAT} ${${_lock_dir}}/${_parv_LOCK_FILE}); \
+_parv_${_lock_dir}_LOCK_SEQ= \
+	${CHMOD} 777 ${${_lock_dir}}/${_parv_${_lock_dir}_LOCK_FILE}; \
+	pid=$$(${CAT} ${${_lock_dir}}/${_parv_${_lock_dir}_LOCK_FILE}); \
 	if [ $${pid} ]; then \
 		ps -p $${pid} > /dev/null && status=$$? || status=$$?; \
 		if [ $${status} -eq 0 ]; then \
@@ -109,15 +114,15 @@
 			${_dparv_START_OUTPUT}; \
 			${ECHO_CMD} "Dir: ${${_lock_dir}}   Stalled lock Detected!"; \
 			${ECHO_CMD} "Deleting stalled lock. PID=$${pid}"; \
-			${ECHO_CMD} "Locking: ${${_lock_dir}}/${_parv_LOCK_FILE}"; \
+			${ECHO_CMD} "Locking: ${${_lock_dir}}/${_parv_${_lock_dir}_LOCK_FILE}"; \
 			${_dparv_END_OUTPUT}; \
-			${ECHO_CMD} ${.MAKE.PID} >  ${${_lock_dir}}/${_parv_LOCK_FILE}; \
+			${ECHO_CMD} ${.MAKE.PID} >  ${${_lock_dir}}/${_parv_${_lock_dir}_LOCK_FILE}; \
 		fi; \
 	else \
 		${_dparv_START_OUTPUT}; \
-		${ECHO_CMD} "Locking: ${${_lock_dir}}/${_parv_LOCK_FILE}"; \
+		${ECHO_CMD} "Locking: ${${_lock_dir}}/${_parv_${_lock_dir}_LOCK_FILE}"; \
 		${_dparv_END_OUTPUT}; \
-		${ECHO_CMD} ${.MAKE.PID} > ${${_lock_dir}}/${_parv_LOCK_FILE}; \
+		${ECHO_CMD} ${.MAKE.PID} > ${${_lock_dir}}/${_parv_${_lock_dir}_LOCK_FILE}; \
 	fi
 
 #####################################################
@@ -127,8 +132,8 @@
 # This scripts handles exit status of lockf(1) call.
 # It substitutes exit status 75 of lockf(1) for ${_parv_ON_LOCK_EXIT_STATUS} and pushes it.
 #
-_parv_${_lock_dir}_DO_LOCK:= \
-	lockf -k -t ${_parv_WAIT_FOR_LOCK_TIME} ${${_lock_dir}}/${_parv_LOCK_FILE} ${SH} -c '${_parv_${_lock_dir}_LOCK_SEQ}' || { \
+_parv_${_lock_dir}_DO_LOCK= \
+	lockf -k -t ${_parv_WAIT_FOR_LOCK_TIME} ${${_lock_dir}}/${_parv_${_lock_dir}_LOCK_FILE} ${SH} -c '${_parv_${_lock_dir}_LOCK_SEQ}' || { \
 		status=$$?; \
 			if [ $${status} -eq ${_parv_LOCKF_EX_TEMPFAIL} ] || \
 					[ $${status} -eq ${_parv_ON_LOCK_EXIT_STATUS} ]; then \
@@ -137,7 +142,7 @@
 				${_dparv_START_OUTPUT}; \
 				${ECHO_CMD} "Unhandled EXIT STATUS = $${status}. Terminating"; \
 				${_dparv_END_OUTPUT}; \
-				exit $${status}; \
+				exit 1; \
 			fi; \
 	}
 
@@ -162,7 +167,7 @@
 			elif [ $${status} -eq ${_parv_ON_LOCK_EXIT_STATUS} ]; then \
 				if [ $$(( $${enable_feedback} % ${_parv_ON_LOCK_FEEDBACK_TIMEOUT} )) -eq 0 ]; then \
 					${_dparv_START_OUTPUT}; \
-					${ECHO_CMD} "Unable to lock ${${_lock_dir}}/${_parv_LOCK_FILE}"; \
+					${ECHO_CMD} "Unable to lock ${${_lock_dir}}/${_parv_${_lock_dir}_LOCK_FILE}"; \
 					${ECHO_CMD} "Dir: ${${_lock_dir}}   is already locked by another working process ..."; \
 					${ECHO_CMD} "Waiting for unlock  ........................................................."; \
 					${_dparv_END_OUTPUT}; \
@@ -182,22 +187,22 @@
 # _parv_PKG_DBDIR_DO_UNLOCK
 # _parv_LOCK_DIR_DO_UNLOCK
 #
-_parv_${_lock_dir}_DO_UNLOCK:= \
-	lockf -k -t ${_parv_WAIT_FOR_UNLOCK_TIME} ${${_lock_dir}}/${_parv_LOCK_FILE} \
-		${RM} ${${_lock_dir}}/${_parv_LOCK_FILE} && { \
+_parv_${_lock_dir}_DO_UNLOCK= \
+	lockf -k -t ${_parv_WAIT_FOR_UNLOCK_TIME} ${${_lock_dir}}/${_parv_${_lock_dir}_LOCK_FILE} \
+		${RM} ${${_lock_dir}}/${_parv_${_lock_dir}_LOCK_FILE} && { \
 			${_dparv_START_OUTPUT}; \
-			${ECHO_CMD} "Dir: ${${_lock_dir}}/${_parv_LOCK_FILE}   is unlocked"; \
+			${ECHO_CMD} "Dir: ${${_lock_dir}}/${_parv_${_lock_dir}_LOCK_FILE}   is unlocked"; \
 			${_dparv_END_OUTPUT}; \
 		} || { \
 			${_dparv_START_OUTPUT}; \
 			${ECHO_CMD} "Hard unlock!"; \
-			${RM} -rf ${${_lock_dir}}/${_parv_LOCK_FILE}; \
+			${RM} -rf ${${_lock_dir}}/${_parv_${_lock_dir}_LOCK_FILE}; \
 			${_dparv_END_OUTPUT}; \
 		}
 		
 
 .endfor # _lock_dir in PKG_DBDIR .CURDIR
-.undef _parv_LOCK_FILE
+.undef _parv_${_lock_dir}_LOCK_FILE
 #####################################################
 
 # _parv_CHECK_SEQ
@@ -237,7 +242,7 @@
 				${_dparv_START_OUTPUT}; \
 				${ECHO_CMD} "Unhandled EXIT STATUS = $${status}. Terminating"; \
 				${_dparv_END_OUTPUT}; \
-				exit $${status}; \
+				exit 1; \
 			fi; \
 	}
 
@@ -255,7 +260,13 @@
 
 check-lock:
 	@( pkg_name=${PKGNAME}; ${_parv_CHECK_LOCK} ) || { ${_parv_ON_LOCK_EXIT_SEQ}; }
-	
+
+lock-pkg-dbdir:
+	@attempts=-1; ${_parv_PKG_DBDIR_LOCK_LOOP}
+
+unlock-pkg-dbdir:
+	@${_parv_PKG_DBDIR_DO_UNLOCK}
+
 do-lock:
 	@${DO_NADA}
 



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