pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/mk Create DELAYED_{ERROR,WARNING}_MSG macros that can ...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/91d7a55c4114
branches:  trunk
changeset: 514583:91d7a55c4114
user:      jlam <jlam%pkgsrc.org@localhost>
date:      Wed Jun 14 15:09:34 2006 +0000

description:
Create DELAYED_{ERROR,WARNING}_MSG macros that can be used to output
error and warning messages that are picked up by the error-check
target.  Use them instead of using a bare ${ECHO} for more code clarity.
Implemented as suggested by Roland Illig.

diffstat:

 mk/bsd.pkg.error.mk           |   9 ++++++++-
 mk/check/check-interpreter.mk |  12 ++++--------
 2 files changed, 12 insertions(+), 9 deletions(-)

diffs (59 lines):

diff -r b6ff31f390af -r 91d7a55c4114 mk/bsd.pkg.error.mk
--- a/mk/bsd.pkg.error.mk       Wed Jun 14 14:34:10 2006 +0000
+++ b/mk/bsd.pkg.error.mk       Wed Jun 14 15:09:34 2006 +0000
@@ -1,8 +1,15 @@
-# $NetBSD: bsd.pkg.error.mk,v 1.1 2006/06/09 13:59:06 jlam Exp $
+# $NetBSD: bsd.pkg.error.mk,v 1.2 2006/06/14 15:09:34 jlam Exp $
 
 ERROR_DIR=     ${WRKDIR}/.error
 WARNING_DIR=   ${WRKDIR}/.warning
 
+# Macros for outputting delayed error and warning messages that are
+# picked up by the error-check target and can be used in place of
+# ${ECHO}.  We output to files that are named without leading dots.
+#
+DELAYED_ERROR_MSG?=    ${ECHO} >> ${ERROR_DIR}/${.TARGET:T:C/^[.]*//:Q}
+DELAYED_WARNING_MSG?=  ${ECHO} >> ${WARNING_DIR}/${.TARGET:T:C/^[.]*//:Q}
+
 makedirs: ${ERROR_DIR} ${WARNING_DIR}
 ${ERROR_DIR} ${WARNING_DIR}:
        ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET}
diff -r b6ff31f390af -r 91d7a55c4114 mk/check/check-interpreter.mk
--- a/mk/check/check-interpreter.mk     Wed Jun 14 14:34:10 2006 +0000
+++ b/mk/check/check-interpreter.mk     Wed Jun 14 15:09:34 2006 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: check-interpreter.mk,v 1.5 2006/06/12 03:42:02 jlam Exp $
+# $NetBSD: check-interpreter.mk,v 1.6 2006/06/14 15:09:34 jlam Exp $
 
 CHECK_INTERPRETER?=    no
 
@@ -27,16 +27,12 @@
                     "in ${PKGNAME}"
 .if !defined(NO_PKG_REGISTER)
        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
-       ${RM} -f ${ERROR_DIR}/${.TARGET} ${WARNING_DIR}/${.TARGET}
-       ${_PKG_SILENT}${_PKG_DEBUG}                                     \
-       ${TOUCH} ${TOUCH_ARGS} ${ERROR_DIR}/${.TARGET} ${WARNING_DIR}/${.TARGET}
-       ${_PKG_SILENT}${_PKG_DEBUG}                                     \
        ${PKG_FILELIST_CMD} | ${SORT} | ${SED} 's,\\,\\\\,g' |          \
        while read file; do                                             \
                ${_CHECK_INTERP_SKIP_FILTER};                           \
                ${SHCOMMENT} "[$$file]";                                \
                interp=`${SED} -n -e '1s/^#![[:space:]]*\([^[:space:]]*\).*/\1/p' -e '1q' < "$$file"` \
-               || {    ${ECHO} "[check-interpreter.mk] sed(1) failed for \"$$file\"." >> ${WARNING_DIR}/${.TARGET}; \
+               || {    ${DELAYED_WARNING_MSG} "[check-interpreter.mk] sed(1) failed for \"$$file\"."; \
                        continue;                                       \
                };                                                      \
                case $$interp in                                        \
@@ -44,9 +40,9 @@
                esac;                                                   \
                if ${TEST} ! -f "$$interp"; then                        \
                        if ${TEST} -x "$$file"; then                    \
-                               ${ECHO} "[check-interpreter.mk] The interpreter \"$$interp\" of \"$$file\" does not exist." >> ${ERROR_DIR}/${.TARGET}; \
+                               ${DELAYED_ERROR_MSG} "[check-interpreter.mk] The interpreter \"$$interp\" of \"$$file\" does not exist."; \
                        else                                            \
-                               ${ECHO} "[check-interpreter.mk] The interpreter \"$$interp\" of \"$$file\" does not exist." >> ${WARNING_DIR}/${.TARGET}; \
+                               ${DELAYED_WARNING_MSG} "[check-interpreter.mk] The interpreter \"$$interp\" of \"$$file\" does not exist."; \
                        fi;                                             \
                fi;                                                     \
        done



Home | Main Index | Thread Index | Old Index