PERFORCE change 124463 for review

Andrew Pantyukhin sat at FreeBSD.org
Wed Aug 1 14:04:24 UTC 2007


http://perforce.freebsd.org/chv.cgi?CH=124463

Change 124463 by sat at sat_amilo on 2007/08/01 14:03:58

	- Simplify debug messaging

Affected files ...

.. //depot/projects/soc2006/gabor_destdir/Mk/bsd.destdir.mk#31 edit

Differences ...

==== //depot/projects/soc2006/gabor_destdir/Mk/bsd.destdir.mk#31 (text+ko) ====

@@ -69,9 +69,10 @@
 
 _DESTDIRMKINCLUDED=	yes
 
-
-.if !defined(WITH_DESTDIR_DEBUG)
-_DESTDIR_DEBUG=	>/dev/null 2<&1
+.if defined(WITH_DESTDIR_DEBUG)
+DEBUG_MSG=	${ECHO_MSG} "DEBUG:"
+.else
+DEBUG_MSG=	${TRUE}
 .endif
 
 DESTDIR_ENV_LIST?=
@@ -140,9 +141,9 @@
 				exit 2; \
 			fi; \
 	done; \
-	${ECHO_MSG} "DEBUG: _DESTDIR_MOUNT_LIST=${_DESTDIR_MOUNT_LIST}" ${_DESTDIR_DEBUG}; \
+	${DEBUG_MSG} "_DESTDIR_MOUNT_LIST=${_DESTDIR_MOUNT_LIST}"; \
 	for _entry in ${_DESTDIR_MOUNT_LIST}; do \
-		${ECHO_MSG} "DEBUG: Processing $${_entry}" ${_DESTDIR_DEBUG}; \
+		${DEBUG_MSG} "Processing $${_entry}"; \
 		_mount_var=$${_entry%%:*}; \
 		_tp=$${_entry#*:}; \
 		_host_path=`${REALPATH} $${_tp%:*}`; \
@@ -150,11 +151,11 @@
 		_full_dest_path=`${REALPATH} $${_destdir}/$${_dest_path}`; \
 		_entry_was_created=0; \
 		_entry_should_mount=0; \
-		${ECHO_CMD} "DEBUG: $${_mount_var}:$${_host_path}:$${_full_dest_path}" ${_DESTDIR_DEBUG}; \
+		${DEBUG_MSG} "$${_mount_var}:$${_host_path}:$${_full_dest_path}"; \
 		if [ "$${_dest_path}" = "___temp___" ]; then \
-			${ECHO_CMD} "DEBUG: Creating temporary mount point" ${_DESTDIR_DEBUG}; \
+			${DEBUG_MSG} "Creating temporary mount point"; \
 			if _full_dest_path=`${MKTEMP} -d $${_destdir}/tmp/mountpoint.XXXXXX`; then \
-				${ECHO_CMD} "DEBUG: Temporary mount point $${_full_dest_path} created successfully" ${_DESTDIR_DEBUG}; \
+				${DEBUG_MSG} "Temporary mount point $${_full_dest_path} created successfully"; \
 				_entry_was_created=1; \
 				_entry_should_mount=1; \
 				_dest_path=$${_full_dest_path#$${_destdir}}; \
@@ -164,18 +165,18 @@
 				exit 9; \
 			fi; \
 		else \
-			${ECHO_CMD} "DEBUG: Checking if already mounted" ${_DESTDIR_DEBUG}; \
+			${DEBUG_MSG} "Checking if already mounted"; \
 			if ${MOUNT}|${GREP} -qs "^$${_host_path} on $${_full_dest_path} ("; then \
-				${ECHO_CMD} "DEBUG: $${_host_path} is already mounted on $${_full_dest_path} ${_DESTDIR_DEBUG}"; \
+				${DEBUG_MSG} "$${_host_path} is already mounted on $${_full_dest_path}"; \
 				_var_path_list="$${_var_path_list} $${_mount_var}=$${_dest_path}"; \
 			else \
-				${ECHO_CMD} "DEBUG: $${_host_path} is not mounted on $${_full_dest_path}" ${_DESTDIR_DEBUG}; \
+				${DEBUG_MSG} "$${_host_path} is not mounted on $${_full_dest_path}"; \
 				_entry_should_mount=1; \
 			fi; \
 		fi; \
 		[ -d $${_full_dest_path} ] || \
 			if ${MKDIR} $${_full_dest_path}; then \
-				${ECHO_CMD} "DEBUG: Mount point $${_full_dest_path} created" ${_DESTDIR_DEBUG}; \
+				${DEBUG_MSG} "Mount point $${_full_dest_path} created"; \
 				_entry_was_created=1; \
 				_created_mountpoints_list="$${_created_mountpoints_list} ${_full_dest_path}"; \
 			else \
@@ -184,7 +185,7 @@
 			fi; \
 		[ "$${_entry_should_mount}" = "0" ] || \
 			if ${MOUNT_NULLFS} $${_host_path} $${_full_dest_path}; then \
-				${ECHO_CMD} "DEBUG: Directory $${_host_path} mounted" ${_DESTDIR_DEBUG}; \
+				${DEBUG_MSG} "Directory $${_host_path} mounted"; \
 				_mounted_entries_list="$${_full_dest_path} $${_mounted_entries_list}"; \
 				_var_path_list="$${_var_path_list} $${_mount_var}=$${_dest_path}"; \
 			else \
@@ -194,11 +195,11 @@
 				exit 8; \
 			fi; \
 	done; \
-	${ECHO_CMD} "DEBUG: Handling devfs separately" ${_DESTDIR_DEBUG}; \
+	${DEBUG_MSG} "Handling devfs separately"; \
 	_full_dest_path=$${_destdir}/dev; \
 	${MOUNT}|${GREP} -qs "^devfs on $${_full_dest_path} (" || \
 		if ${MOUNT_DEVFS} $${_full_dest_path}; then \
-			${ECHO_CMD} "DEBUG: devfs mounted" ${_DESTDIR_DEBUG}; \
+			${DEBUG_MSG} "devfs mounted"; \
 			_mounted_entries_list="$${_full_dest_path} $${_mounted_entries_list}"; \
 		else \
 			${ECHO_CMD} "===> devfs could not be mounted"; \
@@ -207,9 +208,9 @@
 			exit 9; \
 		fi; \
 	_var_path_list="$${_var_path_list} DEVFS=/dev"; \
-	${ECHO_CMD} "DEBUG: Things we mounted: $${_mounted_entries_list}" ${_DESTDIR_DEBUG}; \
-	${ECHO_CMD} "DEBUG: Things we created: $${_created_mountpoints_list}" ${_DESTDIR_DEBUG}; \
-	${ECHO_CMD} "DEBUG: _var_path_list: $${_var_path_list}" ${_DESTDIR_DEBUG}; \
+	${DEBUG_MSG} "Things we mounted: $${_mounted_entries_list}"; \
+	${DEBUG_MSG} "Things we created: $${_created_mountpoints_list}"; \
+	${DEBUG_MSG} "_var_path_list: $${_var_path_list}"; \
 	${ECHO_CMD} "===>  Starting chrooted make in ${DESTDIR}..."; \
 	export $${_var_path_list}; \
 	${CHROOT} $${_destdir} ${SH} -c "\


More information about the p4-projects mailing list