Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 21 Jun 2012 08:36:50 +0000
From:      scher@FreeBSD.org
To:        svn-soc-all@FreeBSD.org
Subject:   socsvn commit: r238050 - soc2012/scher/par_ports/head/Mk
Message-ID:  <20120621083650.56B28106566B@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: scher
Date: Thu Jun 21 08:36:49 2012
New Revision: 238050
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238050

Log:
  [new_feature] ${PORT_DBDIR} locking
  [new_feature] redesign of OPTIONS checking
  
  OPTIONS are configured recursively for port and it's dependencies on
  non-parallel stages, before each of the default targets
  (pkg, fetch, extract, patch, configure, build, install, package and check-sanity).
  While configuring OPTIONS ${PORT_DBDIR} is locked, thus only one
  configuration per time may be implemented.
  

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	Thu Jun 21 07:48:14 2012	(r238049)
+++ soc2012/scher/par_ports/head/Mk/bsd.parallel.mk	Thu Jun 21 08:36:49 2012	(r238050)
@@ -143,6 +143,7 @@
 
 LOCK_DIR= /var/db/portlocks
 _parv_PKG_DBDIR_LOCK_FILE= .lock
+_parv_PORT_DBDIR_LOCK_FILE= .lock
 _parv_LOCK_DIR_LOCK_FILE= ${PKGNAME}
 
 _parv_WAIT_FOR_LOCK_TIME?= 5
@@ -156,11 +157,12 @@
 
 _parv_MAKE_LOCK_EXIT_STATUS= 158
 
-.for _lock_dir in PKG_DBDIR LOCK_DIR
+.for _lock_dir in PKG_DBDIR PORT_DBDIR LOCK_DIR
 # ${${_lock_dir}} == ${PKG_DBDIR} OR ${LOCK_DIR}
 
 # _parv_PKG_DBDIR_LOCK_SEQ
 # _parv_LOCK_DIR_LOCK_SEQ
+# _parv_PORT_DBDIR_LOCK_SEQ
 #
 # 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
@@ -177,6 +179,7 @@
 	${CHMOD} ${_parv_UMASK} ${${_lock_dir}}/${_parv_${_lock_dir}_LOCK_FILE}; \
 	pid=$$(${CAT} ${${_lock_dir}}/${_parv_${_lock_dir}_LOCK_FILE}); \
 	if [ $${pid} ]; then \
+		[ $${pid} -eq ${.MAKE.PID} ] && exit 0; \
 		ps -p $${pid} > /dev/null && status=$$? || status=$$?; \
 		if [ $${status} -eq 0 ]; then \
 			if [ ${_lock_dir} = "LOCK_DIR" ]; then \
@@ -217,6 +220,7 @@
 
 # _parv_PKG_DBDIR_DO_LOCK
 # _parv_LOCK_DIR_DO_LOCK
+# _parv_PORT_DBDIR_DO_LOCK
 # 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.
@@ -239,6 +243,7 @@
 
 # _parv_PKG_DBDIR_LOCK_LOOP
 # _parv_LOCK_DIR_LOCK_LOOP
+# _parv_PORT_DBDIR_LOCK_LOOP
 # Loops to lock a directory
 # $${attempts} - Number of attempts to lock a directory. Exetranal variable.
 # 				 Default: 1, if this var is not set.
@@ -279,6 +284,7 @@
 
 # _parv_PKG_DBDIR_DO_UNLOCK
 # _parv_LOCK_DIR_DO_UNLOCK
+# _parv_PORT_DBDIR_DO_UNLOCK
 #
 _parv_${_lock_dir}_DO_UNLOCK= \
 	lockf -k -t ${_parv_WAIT_FOR_UNLOCK_TIME} ${${_lock_dir}}/${_parv_${_lock_dir}_LOCK_FILE} ${SH} -c '{ \
@@ -356,6 +362,26 @@
 
 # End of Locking variables and tools section
 #####################################################
+locking-config-recursive: locking-config-message lock-port-dbdir config-conditional config-recursive unlock-port-dbdir
+
+locking-config-message:
+	@${ECHO_MSG} "===> Setting user-specified options for ${PKGNAME} and dependencies";
+
+config-recursive:
+	@for dir in $$(${ALL-DEPENDS-LIST}); do \
+		while true; do \
+			( cd $$dir; ${MAKE} config-conditional ) || { \
+				status=$$?; \
+				if [ $${status} -eq ${_parv_MAKE_LOCK_EXIT_STATUS} ]; then \
+					sleep ${_parv_LOCK_ATTEMPT_TIMEOUT}; \
+					continue; \
+				else \
+					exit 1; \
+				fi; \
+			}; \
+			break; \
+		done; \
+	done
 
 check-lock:
 	@( pkg_name=${PKGNAME}; ${_parv_CHECK_LOCK} ) || { ${_parv_ON_LOCK_EXIT_SEQ}; }
@@ -388,9 +414,15 @@
 	fi
 .endif
 
+lock-port-dbdir:
+	@attempts=-1; ${_parv_PORT_DBDIR_LOCK_LOOP}
+
 lock-pkg-dbdir:
 	@attempts=-1; ${_parv_PKG_DBDIR_LOCK_LOOP}
 
+unlock-port-dbdir:
+	@${_parv_PORT_DBDIR_DO_UNLOCK}
+
 unlock-pkg-dbdir:
 	@${_parv_PKG_DBDIR_DO_UNLOCK}
 

Modified: soc2012/scher/par_ports/head/Mk/bsd.port.mk
==============================================================================
--- soc2012/scher/par_ports/head/Mk/bsd.port.mk	Thu Jun 21 07:48:14 2012	(r238049)
+++ soc2012/scher/par_ports/head/Mk/bsd.port.mk	Thu Jun 21 08:36:49 2012	(r238050)
@@ -1171,11 +1171,21 @@
 _parv_PARALLEL_BUILDS_NUMBER= 1
 .endif
 
+.if !target(lock-port-dbdir)
+lock-port-dbdir:
+	@${DO_NADA}
+.endif
+
 .if !target(lock-pkg-dbdir)
 lock-pkg-dbdir:
 	@${DO_NADA}
 .endif
 
+.if !target(unlock-port-dbdir)
+unlock-port-dbdir:
+	@${DO_NADA}
+.endif
+
 .if !target(unlock-pkg-dbdir)
 unlock-pkg-dbdir:
 	@${DO_NADA}
@@ -1186,6 +1196,16 @@
 	@${DO_NADA}
 .endif
 
+.if !target(locking-config-recursive)
+locking-config-recursive:
+	@${DO_NADA}
+.endif
+
+.if !target(locking-config-message)
+locking-config-message:
+	@${DO_NADA}
+.endif
+
 ############### ENDF OF PAR_PORTS SPECIFIC COMMENT LINE  ###############
 
 #
@@ -4339,11 +4359,11 @@
 				check-categories check-makevars check-desktop-entries \
 				check-depends check-active-build-conflicts identify-install-conflicts check-deprecated \
 				check-vulnerable check-license check-config buildanyway-message \
-				options-message
+				options-message locking-config-recursive
 
-_PKG_DEP=		check-sanity
+_PKG_DEP=		check-sanity locking-config-recursive
 _PKG_SEQ=		pkg-depends
-_FETCH_DEP=		pkg
+_FETCH_DEP=		pkg locking-config-recursive
 _FETCH_SEQ=		fetch-depends pre-fetch pre-fetch-script \
 				do-fetch post-fetch post-fetch-script
 _EXTRACT_DEP=	fetch
@@ -4400,7 +4420,7 @@
 .if !target(${target}) && defined(_OPTIONS_OK)
 ${target}: ${${target:U}_COOKIE}
 .elif !target(${target})
-${target}: config-conditional
+${target}: locking-config-recursive config-conditional
 	@cd ${.CURDIR} && ${MAKE} CONFIG_DONE_${UNIQUENAME:U}=1 ${${target:U}_COOKIE}
 .elif target(${target}) && defined(IGNORE)
 .endif



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