pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/mk Introduce the capability to gather all the warnings...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/d4ded70bd8ad
branches:  trunk
changeset: 514248:d4ded70bd8ad
user:      jlam <jlam%pkgsrc.org@localhost>
date:      Fri Jun 09 13:59:06 2006 +0000

description:
Introduce the capability to gather all the warnings and errors that
are generated for a target and output them all at once at the conclusion
of the target's invocation.  The implementation is in bsd.pkg.error.mk,
which defines a macro target "error-check" that will print out any
non-empty warning and error files in ${WARNING_DIR} and ${ERROR_DIR}
and exit appropriately if there were errors.

Convert some targets that were just long sequences of ${ERROR_MSG} or
${WARNING_MSG} within a single shell statement to use the new delayed
error output via error-check.

Modify the compiler "fail" wrappers for C++ and Fortran to be less
verbose during invocation.  Instead collect the warnings and only
print them at the end of the completed phase, e.g. after "configure"
and/or "build" completes.

diffstat:

 mk/bsd.pkg.error.mk           |  53 +++++++++++++++++++++++++++++++++++++++++++
 mk/bsd.pkg.mk                 |  13 +++++----
 mk/check/check-files.mk       |  49 +++++++++++++++++++--------------------
 mk/check/check-interpreter.mk |  30 +++++++++++++----------
 mk/check/check-shlibs.mk      |  44 ++++++++++++++++++++---------------
 mk/check/check-wrkref.mk      |  52 +++++++++++++++++-------------------------
 mk/compiler.mk                |  10 ++++++-
 mk/depends/depends.mk         |   3 +-
 mk/extract/extract.mk         |   3 +-
 mk/flavor/pkg/install.mk      |  41 +++++++++++++++-----------------
 mk/install/install.mk         |   3 +-
 mk/package/package.mk         |   3 +-
 mk/patch/patch.mk             |   3 +-
 mk/tools/bsd.tools.mk         |   3 +-
 14 files changed, 186 insertions(+), 124 deletions(-)

diffs (truncated from 619 to 300 lines):

diff -r d51a06912c98 -r d4ded70bd8ad mk/bsd.pkg.error.mk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/mk/bsd.pkg.error.mk       Fri Jun 09 13:59:06 2006 +0000
@@ -0,0 +1,53 @@
+# $NetBSD: bsd.pkg.error.mk,v 1.1 2006/06/09 13:59:06 jlam Exp $
+
+ERROR_DIR=     ${WRKDIR}/.error
+WARNING_DIR=   ${WRKDIR}/.warning
+
+makedirs: ${ERROR_DIR} ${WARNING_DIR}
+${ERROR_DIR} ${WARNING_DIR}:
+       ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET}
+
+.PHONY: error-check
+
+######################################################################
+### error-check (PRIVATE)
+######################################################################
+### error-check is a macro target that will peek in the warning and
+### error directories to check for the presence of any files.  If they
+### exist and are non-empty, then they are assumed to be message files
+### and will be outputted then removed.  If they are from the error
+### directory, then the target will fail.
+###
+error-check: .USE
+       ${_PKG_SILENT}${_PKG_DEBUG}                                     \
+       ${RM} -f ${WARNING_DIR}/*.tmp;                                  \
+       ${TEST} -d ${WARNING_DIR} || exit 0;                            \
+       cd ${WARNING_DIR};                                              \
+       for file in ./*; do                                             \
+               ${TEST} "$$file" != "./*" || exit 0;                    \
+               break;                                                  \
+       done;                                                           \
+       ${CAT} ./* | ${WARNING_CAT};                                    \
+       ${RM} -f ./*
+
+       ${_PKG_SILENT}${_PKG_DEBUG}                                     \
+       ${RM} -f ${ERROR_DIR}/*.tmp;                                    \
+       ${TEST} -d ${ERROR_DIR} || exit 0;                              \
+       cd ${ERROR_DIR};                                                \
+       for file in ./*; do                                             \
+               ${TEST} "$$file" != "./*" || exit 0;                    \
+               break;                                                  \
+       done;                                                           \
+       ${CAT} * | ${ERROR_CAT};                                        \
+       if ${_NONZERO_FILESIZE_P} ./*; then                             \
+               ${RM} -f ./*;                                           \
+               exit 1;                                                 \
+       fi
+
+######################################################################
+### error-clean (PRIVATE)
+######################################################################
+### error-clean removes the error and warning directory and files.
+###
+error-clean:
+       ${_PKG_SILENT}${_PKG_DEBUG}${RM} -fr ${ERROR_DIR} ${WARNING_DIR}
diff -r d51a06912c98 -r d4ded70bd8ad mk/bsd.pkg.mk
--- a/mk/bsd.pkg.mk     Fri Jun 09 13:25:22 2006 +0000
+++ b/mk/bsd.pkg.mk     Fri Jun 09 13:59:06 2006 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: bsd.pkg.mk,v 1.1848 2006/06/08 16:21:51 jlam Exp $
+#      $NetBSD: bsd.pkg.mk,v 1.1849 2006/06/09 13:59:06 jlam Exp $
 #
 # This file is in the public domain.
 #
@@ -27,6 +27,7 @@
 .include "${PKGSRCDIR}/mk/extract/bsd.extract-vars.mk"
 .include "${PKGSRCDIR}/mk/patch/bsd.patch-vars.mk"
 .include "${PKGSRCDIR}/mk/install/bsd.install-vars.mk"
+.include "${PKGSRCDIR}/mk/bsd.pkg.error.mk"
 
 .include "../../mk/bsd.hacks.mk"
 
@@ -311,7 +312,7 @@
 _CONFIGURE_COOKIE=     ${WRKDIR}/.configure_done
 _BUILD_COOKIE=         ${WRKDIR}/.build_done
 _TEST_COOKIE=          ${WRKDIR}/.test_done
-_INTERACTIVE_COOKIE=   .interactive_stage
+_INTERACTIVE_COOKIE=   ${.CURDIR}/.interactive_stage
 _NULL_COOKIE=          ${WRKDIR}/.null
 
 # Miscellaneous overridable commands:
@@ -1319,10 +1320,10 @@
 # make i.e. without -j n)
 .PHONY: real-wrapper
 .PHONY: real-configure real-build real-test
-real-wrapper: wrapper-message wrapper-vars pre-wrapper do-wrapper post-wrapper wrapper-cookie
-real-configure: configure-message configure-vars pre-configure pre-configure-override do-configure post-configure configure-cookie
-real-build: build-message build-vars pre-build do-build post-build build-cookie
-real-test: test-message pre-test do-test post-test test-cookie
+real-wrapper: wrapper-message wrapper-vars pre-wrapper do-wrapper post-wrapper wrapper-cookie error-check
+real-configure: configure-message configure-vars pre-configure pre-configure-override do-configure post-configure configure-cookie error-check
+real-build: build-message build-vars pre-build do-build post-build build-cookie error-check
+real-test: test-message pre-test do-test post-test test-cookie error-check
 
 # su-target is a macro target that does just-in-time su-to-root before
 # reinvoking the make process as root.  It acquires root privileges and
diff -r d51a06912c98 -r d4ded70bd8ad mk/check/check-files.mk
--- a/mk/check/check-files.mk   Fri Jun 09 13:25:22 2006 +0000
+++ b/mk/check/check-files.mk   Fri Jun 09 13:59:06 2006 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: check-files.mk,v 1.2 2006/06/07 20:28:59 jlam Exp $
+# $NetBSD: check-files.mk,v 1.3 2006/06/09 13:59:08 jlam Exp $
 
 .if defined(PKG_DEVELOPER)
 CHECK_FILES?=          yes
@@ -65,7 +65,7 @@
 # These are the files generated and used by the check-files implementation
 # used across several check-files targets.
 #
-#    _CHECK_FILES_COOKIE.* are the cookie files that contain the error
+#    _CHECK_FILES_ERRMSG.* are the files that contain the error
 #      messages discovered during each stage of file-checking.
 #
 #    _CHECK_FILES_PRE.* are the file lists generated before any files
@@ -77,23 +77,23 @@
 # The "pre" and "post" file lists are compared against each other to
 # determine if the package is installing files where it shouldn't be.
 #
-_CHECK_FILES_COOKIE.prefix=    ${WRKDIR}/.check_files_prefix_cookie
+_CHECK_FILES_ERRMSG.prefix=    ${ERROR_DIR}/check-files-prefix
 _CHECK_FILES_PRE.prefix=       ${WRKDIR}/.prefix.pre
 _CHECK_FILES_POST.prefix=      ${WRKDIR}/.prefix.post
 
-_CHECK_FILES_COOKIE.sysconfdir=        ${WRKDIR}/.check_files_sysconfdir_cookie
+_CHECK_FILES_ERRMSG.sysconfdir=        ${ERROR_DIR}/.check-files-sysconfdir
 _CHECK_FILES_PRE.sysconfdir=   ${WRKDIR}/.sysconfdir.pre
 _CHECK_FILES_POST.sysconfdir=  ${WRKDIR}/.sysconfdir.post
 
-_CHECK_FILES_COOKIE.varbase=   ${WRKDIR}/.check_files_varbase_cookie
+_CHECK_FILES_ERRMSG.varbase=   ${ERROR_DIR}/.check-files-varbase
 _CHECK_FILES_PRE.varbase=      ${WRKDIR}/.varbase.pre
 _CHECK_FILES_POST.varbase=     ${WRKDIR}/.varbase.post
 
-_CHECK_FILES_COOKIES=          # empty
-_CHECK_FILES_COOKIES+=         ${_CHECK_FILES_COOKIE.prefix}
+_CHECK_FILES_ERRMSGS=          # empty
+_CHECK_FILES_ERRMSGS+=         ${_CHECK_FILES_ERRMSG.prefix}
 .if empty(CHECK_FILES_STRICT:M[nN][oO])
-_CHECK_FILES_COOKIES+=         ${_CHECK_FILES_COOKIE.sysconfdir}
-_CHECK_FILES_COOKIES+=         ${_CHECK_FILES_COOKIE.varbase}
+_CHECK_FILES_ERRMSGS+=         ${_CHECK_FILES_ERRMSG.sysconfdir}
+_CHECK_FILES_ERRMSGS+=         ${_CHECK_FILES_ERRMSG.varbase}
 .endif
 
 ###########################################################################
@@ -164,9 +164,9 @@
 # check-files targets and subtargets
 #
 .PHONY: check-files-prefix check-files-sysconfdir check-files-varbase
-check-files-prefix: ${_CHECK_FILES_COOKIE.prefix}
-check-files-sysconfdir: ${_CHECK_FILES_COOKIE.sysconfdir}
-check-files-varbase: ${_CHECK_FILES_COOKIE.varbase}
+check-files-prefix: ${_CHECK_FILES_ERRMSG.prefix}
+check-files-sysconfdir: ${_CHECK_FILES_ERRMSG.sysconfdir}
+check-files-varbase: ${_CHECK_FILES_ERRMSG.varbase}
 
 # The check-files target looks at the cookie files generated by the
 # check-files-* subtargets, and if they are non-empty, then they
@@ -174,12 +174,11 @@
 # subtarget.
 #
 .PHONY: check-files
-check-files: ${_CHECK_FILES_COOKIES}
-       ${_PKG_SILENT}${_PKG_DEBUG}${STEP_MSG}                          \
-               "Checking file-check results for ${PKGNAME}"
-       @${CAT} ${_CHECK_FILES_COOKIES} | ${ERROR_CAT}
-       ${_PKG_SILENT}${_PKG_DEBUG}                                     \
-       ${_ZERO_FILESIZE_P} ${_CHECK_FILES_COOKIES} || exit 1
+check-files: check-files-message ${_CHECK_FILES_ERRMSGS} error-check
+
+.PHONY: check-files-message
+check-files-message:
+       @${STEP_MSG} "Checking file-check results for ${PKGNAME}"
 
 # Check ${PREFIX} for files which are not listed in the generated ${PLIST}
 # and vice-versa.
@@ -253,10 +252,10 @@
        ${_PKG_SILENT}${_PKG_DEBUG}${MV} -f ${.TARGET}.tmp ${.TARGET}
 
 .if defined(NO_PKG_REGISTER)
-${_CHECK_FILES_COOKIE.prefix}:
+${_CHECK_FILES_ERRMSG.prefix}:
        ${_PKG_SILENT}${_PKG_DEBUG}${TOUCH} ${TOUCH_FLAGS} ${.TARGET}
 .else
-${_CHECK_FILES_COOKIE.prefix}:                                         \
+${_CHECK_FILES_ERRMSG.prefix}:                                         \
                ${_CHECK_FILES_DELETED}                                 \
                ${_CHECK_FILES_MISSING}                                 \
                ${_CHECK_FILES_MISSING_REAL}                            \
@@ -297,10 +296,10 @@
 # not copied into place by the INSTALL scripts.
 #
 .if defined(NO_PKG_REGISTER)
-${_CHECK_FILES_COOKIE.sysconfdir}:
+${_CHECK_FILES_ERRMSG.sysconfdir}:
        ${_PKG_SILENT}${_PKG_DEBUG}${TOUCH} ${TOUCH_FLAGS} ${.TARGET}
 .else
-${_CHECK_FILES_COOKIE.sysconfdir}:                                     \
+${_CHECK_FILES_ERRMSG.sysconfdir}:                                     \
                ${_CHECK_FILES_PRE.sysconfdir}                          \
                ${_CHECK_FILES_POST.sysconfdir}
        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
@@ -323,10 +322,10 @@
 # not created by the INSTALL scripts.
 #
 .if defined(NO_PKG_REGISTER)
-${_CHECK_FILES_COOKIE.varbase}:
+${_CHECK_FILES_ERRMSG.varbase}:
        ${_PKG_SILENT}${_PKG_DEBUG}${TOUCH} ${TOUCH_FLAGS} ${.TARGET}
 .else
-${_CHECK_FILES_COOKIE.varbase}:                                                \
+${_CHECK_FILES_ERRMSG.varbase}:                                                \
                ${_CHECK_FILES_PRE.varbase}                             \
                ${_CHECK_FILES_POST.varbase}
        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
@@ -353,7 +352,7 @@
 check-clean: check-files-clean
 check-files-clean:
        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
-       ${RM} -f ${_CHECK_FILES_COOKIES}                                \
+       ${RM} -f ${_CHECK_FILES_ERRMSGS}                                \
                ${_CHECK_FILES_PRE} ${_CHECK_FILES_POST}                \
                ${_CHECK_FILES_DIFF} ${_CHECK_FILES_ADDED}              \
                ${_CHECK_FILES_DELETED} ${_CHECK_FILES_EXPECTED}        \
diff -r d51a06912c98 -r d4ded70bd8ad mk/check/check-interpreter.mk
--- a/mk/check/check-interpreter.mk     Fri Jun 09 13:25:22 2006 +0000
+++ b/mk/check/check-interpreter.mk     Fri Jun 09 13:59:06 2006 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: check-interpreter.mk,v 1.3 2006/06/07 17:41:14 jlam Exp $
+# $NetBSD: check-interpreter.mk,v 1.4 2006/06/09 13:59:08 jlam Exp $
 
 CHECK_INTERPRETER?=    no
 
@@ -15,17 +15,22 @@
 _CHECK_INTERP_SKIP_FILTER+=    *) ;;
 _CHECK_INTERP_SKIP_FILTER+=    esac
 
-###########################################################################
-# check-interpreter target
-#
+######################################################################
+### check-interpreter (PRIVATE)
+######################################################################
+### check-interpreter verifies that the interpreters for all installed
+### scripts exist.
+###
 .PHONY: check-interpreter
-check-interpreter:
-       ${_PKG_SILENT}${_PKG_DEBUG}${STEP_MSG}                          \
-               "Checking for non-existent script interpreters in ${PKGNAME}"
+check-interpreter: error-check
+       @${STEP_MSG} "Checking for non-existent script interpreters"    \
+                    "in ${PKGNAME}"
+.if !defined(NO_PKG_REGISTER)
+       ${_PKG_SILENT}${_PKG_DEBUG}${RM} -f ${ERROR_DIR}/${.TARGET}
        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
+       exec 1>${ERROR_DIR}/${.TARGET};                                 \
        ${PKG_FILELIST_CMD} | ${SORT} | ${SED} 's,\\,\\\\,g' |          \
-       { exitcode=0;                                                   \
-         while read file; do                                           \
+       while read file; do                                             \
                ${_CHECK_INTERP_SKIP_FILTER};                           \
                ${SHCOMMENT} "[$$file]";                                \
                interp=`${SED} -n -e '1s/^#![[:space:]]*\([^[:space:]]*\).*/\1/p' -e '1q' < "$$file"` \
@@ -37,11 +42,10 @@
                esac;                                                   \
                if ${TEST} ! -f "$$interp"; then                        \
                        if ${TEST} -x "$$file"; then                    \
-                               ${ERROR_MSG} "[check-interpreter.mk] The interpreter \"$$interp\" of \"$$file\" does not exist."; \
-                               exitcode=1;                             \
+                               ${ECHO} "[check-interpreter.mk] The interpreter \"$$interp\" of \"$$file\" does not exist."; \
                        else                                            \
                                ${WARNING_MSG} "[check-interpreter.mk] The interpreter \"$$interp\" of \"$$file\" does not exist."; \
                        fi;                                             \
                fi;                                                     \
-         done;                                                         \
-         exit $$exitcode; }
+       done
+.endif
diff -r d51a06912c98 -r d4ded70bd8ad mk/check/check-shlibs.mk
--- a/mk/check/check-shlibs.mk  Fri Jun 09 13:25:22 2006 +0000
+++ b/mk/check/check-shlibs.mk  Fri Jun 09 13:59:06 2006 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: check-shlibs.mk,v 1.1 2006/06/03 23:11:42 jlam Exp $
+# $NetBSD: check-shlibs.mk,v 1.2 2006/06/09 13:59:08 jlam Exp $
 
 # For PKG_DEVELOPERs, cause some checks to be run automatically by default.
 .if defined(PKG_DEVELOPER)
@@ -9,35 +9,41 @@
 # All binaries and shared libraries.
 _CHECK_SHLIBS_ERE=     /(bin/|sbin/|libexec/|lib/lib.*\.so|lib/lib.*\.dylib)
 
-###########################################################################
-# check-shlibs target
-#
+######################################################################
+### check-shlibs (PRIVATE)
+######################################################################



Home | Main Index | Thread Index | Old Index