socsvn commit: r237230 - soc2012/scher/par_ports/head/Mk
scher at FreeBSD.org
scher at FreeBSD.org
Wed Jun 6 18:44:33 UTC 2012
Author: scher
Date: Wed Jun 6 18:44:30 2012
New Revision: 237230
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237230
Log:
[bugfix] make process (submake) is allowed to work in locked port's
if and only if this port's dir was locked by parent make process
Hence all submakes can work in port's dir, locked by parent make
Modified:
soc2012/scher/par_ports/head/Mk/bsd.parallel.mk
soc2012/scher/par_ports/head/Mk/bsd.port.mk
Modified: soc2012/scher/par_ports/head/Mk/bsd.parallel.mk
==============================================================================
--- soc2012/scher/par_ports/head/Mk/bsd.parallel.mk Wed Jun 6 17:28:46 2012 (r237229)
+++ soc2012/scher/par_ports/head/Mk/bsd.parallel.mk Wed Jun 6 18:44:30 2012 (r237230)
@@ -121,7 +121,25 @@
if [ $${pid} ]; then \
ps -p $${pid} > /dev/null && status=$$? || status=$$?; \
if [ $${status} -eq 0 ]; then \
- exit ${_parv_ON_LOCK_EXIT_STATUS}; \
+ if [ ${_lock_dir} = "LOCK_DIR" ]; then \
+ cur_pid=${.MAKE.PID}; \
+ while true; do \
+ ppid=$$( ps -o ppid -p $${cur_pid} | ${AWK} "NR==2" ); \
+ if [ $${ppid} -eq $${pid} ]; then \
+ ${_dparv_START_OUTPUT}; \
+ ${ECHO_CMD} "${${_lock_dir}}/${_parv_${_lock_dir}_LOCK_FILE} is locked by parent make process!"; \
+ ${ECHO_CMD} "We are allowed to work here"; \
+ ${_dparv_END_OUTPUT}; \
+ break; \
+ elif [ $${ppid} -eq 0 ]; then \
+ exit ${_parv_ON_LOCK_EXIT_STATUS}; \
+ else \
+ cur_pid=$${ppid}; \
+ fi; \
+ done; \
+ else \
+ exit ${_parv_ON_LOCK_EXIT_STATUS}; \
+ fi; \
else \
${_dparv_START_OUTPUT}; \
${ECHO_CMD} "Dir: ${${_lock_dir}} Stalled lock Detected!"; \
@@ -200,18 +218,20 @@
# _parv_LOCK_DIR_DO_UNLOCK
#
_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} && { \
+ lockf -k -t ${_parv_WAIT_FOR_UNLOCK_TIME} ${${_lock_dir}}/${_parv_${_lock_dir}_LOCK_FILE} ${SH} -c '{ \
+ pid=$$(${CAT} ${${_lock_dir}}/${_parv_${_lock_dir}_LOCK_FILE}); \
+ if [ ${.MAKE.PID} -eq $${pid} ]; then \
+ ${RM} -rf ${${_lock_dir}}/${_parv_${_lock_dir}_LOCK_FILE}; \
${_dparv_START_OUTPUT}; \
- ${ECHO_CMD} "Dir: ${${_lock_dir}}/${_parv_${_lock_dir}_LOCK_FILE} is unlocked"; \
+ ${ECHO_CMD} Dir: ${${_lock_dir}}/${_parv_${_lock_dir}_LOCK_FILE} is unlocked; \
${_dparv_END_OUTPUT}; \
- } || { \
+ else \
${_dparv_START_OUTPUT}; \
- ${ECHO_CMD} "Hard unlock!"; \
- ${RM} -rf ${${_lock_dir}}/${_parv_${_lock_dir}_LOCK_FILE}; \
+ ${ECHO_CMD} Dir: ${${_lock_dir}}/${_parv_${_lock_dir}_LOCK_FILE} was locked by another process; \
+ ${ECHO_CMD} Leave lock file; \
${_dparv_END_OUTPUT}; \
- }
-
+ fi; \
+ }'
.endfor # _lock_dir in PKG_DBDIR .CURDIR
.undef _parv_${_lock_dir}_LOCK_FILE
Modified: soc2012/scher/par_ports/head/Mk/bsd.port.mk
==============================================================================
--- soc2012/scher/par_ports/head/Mk/bsd.port.mk Wed Jun 6 17:28:46 2012 (r237229)
+++ soc2012/scher/par_ports/head/Mk/bsd.port.mk Wed Jun 6 18:44:30 2012 (r237230)
@@ -5123,6 +5123,7 @@
.if defined(${deptype}_DEPENDS)
.if !defined(NO_DEPENDS)
@depends=`${ECHO_CMD} "${${deptype}_DEPENDS}"`; \
+ depends=$$( echo "$${depends}" | sed 's/^[[:space:]]*//' | sed 's/[[:space:]]*$$//' ); \
active_builds=""; \
echo "debugging_out_here: ------------------------- " > ${PORTSDIR}/tmp/log; \
echo "debugging_out_here: ALL DEPS - $${depends}" > ${PORTSDIR}/tmp/log; \
More information about the svn-soc-all
mailing list