socsvn commit: r238854 - soc2012/scher/par_ports/head/Mk

scher at FreeBSD.org scher at FreeBSD.org
Mon Jul 2 21:28:44 UTC 2012


Author: scher
Date: Mon Jul  2 21:28:42 2012
New Revision: 238854
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238854

Log:
  [bugfix] fixed bug, when in some cases keyboard interrupts were not
  triggered by trap in XXX-depends targets
  

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	Mon Jul  2 21:24:05 2012	(r238853)
+++ soc2012/scher/par_ports/head/Mk/bsd.parallel.mk	Mon Jul  2 21:28:42 2012	(r238854)
@@ -14,7 +14,7 @@
 #								  matter what value is assigned.
 #								  Example: _parv_WANT_PARALLEL_BUILD=yes
 #
-# _parv_CHECK_ACTIVE_TIMEOUT			- timeout in seconds before next check of active
+# _parv_CHECK_ACTIVE_TIMEOUT	- timeout in seconds before next check of active
 #								  builds in case if port is prohibit to spawn
 #								  another background process. Consider that this
 #								  variable is also used in non-parallel build.
@@ -34,7 +34,7 @@
 #								  next attempt to lock a directory. Default: 2
 #
 # _parv_ON_LOCK_FEEDBACK_TIMEOUT -while trying to lock a directory in "while"
-#								  loop, if the directory is locked, user
+#								  loops, if the directory is locked, user
 #								  feedback is printed once in
 #                                 ${_parv_ON_LOCK_FEEDBACK_TIMEOUT} attempts.
 #								  Default: 2
@@ -46,6 +46,9 @@
 #								  ${_parv_DEFAULT_PAR_BUILDS_NUM}, then it will
 #								  be set to ${_parv_DEFAULT_PAR_BUILDS_NUM}.
 #
+# _parv_PORTS_LOGS_DIR			- directory that contains dependency ports' log files.
+#								  Default: /tmp/portslogs
+#
 # The following variables are not assumed to be changed by user
 #
 # _parv_ON_LOCK_EXIT_STATUS		- if the directory is locked script exits with
@@ -67,6 +70,16 @@
 #								  This file contains PID of the process, that
 #								  locked ${LOCK_DIR}.
 #
+# _parv_PORT_LOG_FILE			- name of dependency port's log file.
+#								  Value: $$(cd $$dir; ${MAKE} -V PKGNAME)-spawned-by-pid${.MAKE.PID}.log
+#								  where $${dir} is a dependency port's directory
+#								  in ports tree.
+#
+# _parv_CHECKED_CONFIG_F_PREFIX - file name prefix for file in which already
+#								  checked directories are stored while evaluating
+#								  "config-recursive" target. Full file name is 
+#								  ${_parv_CHECKED_CONFIG_F_PREFIX}.${.MAKE.PID}
+#
 # _parv_DEFAULT_TARGETS			- sequence of bsd.port.mk targets. If at least
 #								  one of this targets is encounted in ${.TARGETS}
 #								  then port's directory has to be locked.
@@ -74,6 +87,24 @@
 # _parv_DEFAULT_PAR_BUILDS_NUM 	- default number of parallel dependency builds.
 #								  Value: number of logical CPUs on user's machine.
 #
+# The following targets may be used by user
+#
+# check-license-depends			- license checking for port's dependencies.
+#								  Does not lock any directory.
+#								  If any dependencies need to ask for comfirmation
+#								  then port's build stops, and user is listed all
+#								  ports that will ask for licences checking.
+#								  Then a user will have to eval "make patch" for the
+#								  above mentioned ports. Only if no dependencies
+#								  require license confirmation parallel ports build
+#								  will be allowed.
+#
+# locking-config-recursive		- Configure options for current port and all dependencies
+#								  recursively, while holding lock on
+#								  ${_parv_PORT_DBDIR_LOCK_LOOP}. Considers dynamic
+#								  changes in port's dependencies. Skips already checked
+#								  ports.
+#
 
 .if !defined(_POSTMKINCLUDED) && !defined(Parallel_Pre_Include)
 Parallel_Pre_Include=	bsd.parallel.mk
@@ -84,7 +115,7 @@
 _parv_KILL_SIGNAL= USR1
 _parv_PKILL= /bin/pkill
 _parv_PKILL_FLAGS= -P
-_parv_UMASK= 777
+_parv_UMASK= 0644
 
 DO_NADA?=		${TRUE}
 # End of Commands section
@@ -140,20 +171,19 @@
 #####################################################
 # Locking variables and tools
 
-# TODO: docs is needed
 _parv_PORTS_LOGS_DIR?= /tmp/portslogs
 LOCK_DIR?= /var/db/portslocks
 _parv_PKG_DBDIR_LOCK_FILE= .lock
 _parv_PORT_DBDIR_LOCK_FILE= .lock
 _parv_LOCK_DIR_LOCK_FILE= ${PKGNAME}
-# TODO: docs is needed
 _parv_PORT_LOG_FILE= $$(cd $$dir; ${MAKE} -V PKGNAME)-spawned-by-pid${.MAKE.PID}.log
 
+_parv_CHECKED_CONFIG_F_PREFIX= already-checked-config
+
 _parv_WAIT_FOR_LOCK_TIME?= 5
 _parv_WAIT_FOR_UNLOCK_TIME?= 15
 
 _parv_LOCK_ATTEMPT_TIMEOUT?= 2
-# TODO: change docs
 _parv_ON_LOCK_FEEDBACK_TIMEOUT?= 2
 
 _parv_CHECK_ACTIVE_TIMEOUT?= 2
@@ -163,20 +193,6 @@
 
 _parv_MAKE_LOCK_EXIT_STATUS= 158
 
-_parv_CHECK_DIRS_SANITY= \
-	if [ ! -d ${LOCK_DIR} ]; then \
-		${_dparv_START_OUTPUT}; \
-		${ECHO_CMD} "Creating ports locks dir"; \
-		${_dparv_END_OUTPUT}; \
-		${MKDIR} ${LOCK_DIR}; \
-	fi; \
-	if [ ! -d ${_parv_PORTS_LOGS_DIR} ]; then \
-		${_dparv_START_OUTPUT}; \
-		${ECHO_CMD} "Creating ports logs dir"; \
-		${_dparv_END_OUTPUT}; \
-		${MKDIR} ${_parv_PORTS_LOGS_DIR}; \
-	fi
-
 .for _lock_dir in PKG_DBDIR PORT_DBDIR LOCK_DIR
 # ${${_lock_dir}} == ${PKG_DBDIR} OR ${LOCK_DIR}
 
@@ -192,6 +208,7 @@
 # Stalled locks cheking enabled.
 #
 # If the directory is locked this script returns ${_parv_ON_LOCK_EXIT_STATUS}.
+#
 # Process is allowed to work in locked port's directory if and only if it is locked
 # by it's parent process.
 #
@@ -235,6 +252,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.
@@ -258,6 +276,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.
@@ -317,6 +336,7 @@
 
 # _parv_CHECK_SEQ
 # _parv_CHECK_LOCK
+#
 # The former variables implement check for lock utility.
 # $${pkg_name}	 - port to check, since ${_parv_LOCK_DIR_LOCK_FILE} = ${PKGNAME}
 #				   External variable for script. Supports sh(1) patterns
@@ -324,7 +344,7 @@
 #				   value before executing this script.
 #				   e.g. ( pkg_name=apache-[1234]; ${_parv_CHECK_LOCK} ) || ...
 # Script exits with exit status ${_parv_ON_LOCK_EXIT_STATUS} if $${pkg_name} is locked
-# 
+#
 _parv_CHECK_SEQ= \
 	${CHMOD} ${_parv_UMASK} ${LOCK_DIR}/$${pkg_name}; \
 	pid=\$$(${CAT} ${LOCK_DIR}/$${pkg_name}); \
@@ -380,7 +400,31 @@
 # End of Locking variables and tools section
 #####################################################
 
-#
+_parv_CHECK_DIRS_SANITY= \
+	if [ ! -d ${LOCK_DIR} ]; then \
+		${_dparv_START_OUTPUT}; \
+		${ECHO_CMD} "Creating ports locks dir"; \
+		${_dparv_END_OUTPUT}; \
+		${MKDIR} ${LOCK_DIR}; \
+	fi; \
+	if [ ! -d ${_parv_PORTS_LOGS_DIR} ]; then \
+		${_dparv_START_OUTPUT}; \
+		${ECHO_CMD} "Creating ports logs dir"; \
+		${_dparv_END_OUTPUT}; \
+		${MKDIR} ${_parv_PORTS_LOGS_DIR}; \
+	fi
+
+_parv_PRINT_ACTIVE_BUILDS= \
+	${ECHO_CMD} "     Currently building dependency ports are"; \
+	for build in $$( ${ECHO_CMD} "$${active_builds}" ); do \
+		dep=$${build\#*:}; \
+		dir=$${dep\#*:}; \
+		target=$${dep\#\#*:}; \
+		[ $$dir != $$target ] && dir=$${dir%%:*}; \
+		${ECHO_CMD} "         $$(cd $${dir}; ${MAKE} -V PKGNAME)"; \
+	done
+
+
 # _PROCESS_ACTIVE_BUILDS	- this script contains all magic, related to
 #							  processing of background dependecy builds.
 #
@@ -393,16 +437,6 @@
 # 							  tuples of all currently being processed ports,
 #							  spawned by this make process.
 #
-_parv_PRINT_ACTIVE_BUILDS= \
-	${ECHO_CMD} "     Currently building dependency ports are"; \
-	for build in $$( ${ECHO_CMD} "$${active_builds}" ); do \
-		dep=$${build\#*:}; \
-		dir=$${dep\#*:}; \
-		target=$${dep\#\#*:}; \
-		[ $$dir != $$target ] && dir=$${dir%%:*}; \
-		${ECHO_CMD} "         $$(cd $${dir}; ${MAKE} -V PKGNAME)"; \
-	done
-
 _PROCESS_ACTIVE_BUILDS= \
 	enable_feedback=${_parv_ON_LOCK_FEEDBACK_TIMEOUT}; \
 	while true; do \
@@ -468,7 +502,12 @@
 		fi; \
 	done
 
-# TODO: docs needed
+# _parv_CHECK_ALL_DEPS_LOCKED
+#
+# This script prevents infinity non-sleeping loop in XXX-depends targets.
+# If all dependencies in corresponding XXX_DEPENDS variable are locked
+# then parent make process will sleep ${_parv_CHECK_ACTIVE_TIMEOUT} seconds.
+#
 _parv_CHECK_ALL_DEPS_LOCKED= \
 	if ! [ $${\#depends} -eq 0 ]; then \
 		enable_feedback=${_parv_ON_LOCK_FEEDBACK_TIMEOUT}; \
@@ -493,7 +532,7 @@
 
 #
 # _TERMINATE_PROCESS_TREE	- this script contains all magic, related to
-#							  terminating of the whole process tree, starting
+#							  termination of the whole process tree, starting
 #							  from ${.MAKE.PID}.
 #							  This script implements Breadth-first traversal of
 #							  the process tree. It prevents processes of the
@@ -536,8 +575,6 @@
 # Parallel targets section
 # TODO: outline intergation with bsd.port.mk
 #
-
-#TODO doc is needed
 .if !defined(INSTALLS_DEPENDS)
 check-license-depends: check-license-message
 	@license_to_ask=""; \
@@ -568,7 +605,6 @@
 check-license-message:
 	@${ECHO_MSG} "===> Checking out licenses for ${PKGNAME} dependencies";
 
-#TODO doc is needed
 .if !defined(CONFIG_DONE_${UNIQUENAME:U}) && !defined(INSTALLS_DEPENDS)
 locking-config-recursive: locking-config-message lock-port-dbdir config-recursive unlock-port-dbdir
 .endif
@@ -576,11 +612,6 @@
 locking-config-message:
 	@${ECHO_MSG} "===> Setting user-specified options for ${PKGNAME} and dependencies";
 
-# TODO: doc is needed
-# TODO: shift to the beginning 
-_parv_CHECKED_CONFIG_F_PREFIX= already-checked-config
-
-# TODO: doc is needed
 config-recursive: config-conditional
 	@if [ ! ${DEP_CHECK_CONFIG} ]; then \
 		already_checked_file=/tmp/${_parv_CHECKED_CONFIG_F_PREFIX}.${.MAKE.PID}; \


More information about the svn-soc-all mailing list