diff options
author | jlam <jlam@pkgsrc.org> | 2006-06-09 13:59:06 +0000 |
---|---|---|
committer | jlam <jlam@pkgsrc.org> | 2006-06-09 13:59:06 +0000 |
commit | 3aab0ce66d90cd6f3a18c6f586e849e54dab913d (patch) | |
tree | bc3ee1d8414671473ac53f6468293fea0563cf1d /mk/check | |
parent | 69568842f5938a9aef8aa60992da0242451b84c0 (diff) | |
download | pkgsrc-3aab0ce66d90cd6f3a18c6f586e849e54dab913d.tar.gz |
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 (limited to 'mk/check')
-rw-r--r-- | mk/check/check-files.mk | 49 | ||||
-rw-r--r-- | mk/check/check-interpreter.mk | 30 | ||||
-rw-r--r-- | mk/check/check-shlibs.mk | 44 | ||||
-rw-r--r-- | mk/check/check-wrkref.mk | 50 |
4 files changed, 86 insertions, 87 deletions
diff --git a/mk/check/check-files.mk b/mk/check/check-files.mk index 976a76c3e92..3def14b5745 100644 --- a/mk/check/check-files.mk +++ b/mk/check/check-files.mk @@ -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 @@ _CHECK_FILES_SKIP_FILTER= ${GREP} -vx ${CHECK_FILES_SKIP:@f@-e ${f:Q}@} # 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 @@ _CHECK_FILES_SKIP_FILTER= ${GREP} -vx ${CHECK_FILES_SKIP:@f@-e ${f:Q}@} # 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_PRE.varbase} ${_CHECK_FILES_POST.varbase}: # 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 @@ check-files-varbase: ${_CHECK_FILES_COOKIE.varbase} # 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 @@ ${_CHECK_FILES_EXTRA}: ${_CHECK_FILES_EXPECTED} ${_CHECK_FILES_ADDED} ${_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 @@ ${_CHECK_FILES_COOKIE.prefix}: \ # 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 @@ ${_CHECK_FILES_COOKIE.sysconfdir}: \ # 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_FILES_COOKIE.varbase}: \ 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 --git a/mk/check/check-interpreter.mk b/mk/check/check-interpreter.mk index 8cd4242469f..060568ab5c5 100644 --- a/mk/check/check-interpreter.mk +++ b/mk/check/check-interpreter.mk @@ -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+= ${PREFIX}/${_pattern_}|${_pattern_}) continue ;; _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 @@ check-interpreter: 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 --git a/mk/check/check-shlibs.mk b/mk/check/check-shlibs.mk index bbeb6d4119f..57f98e68a17 100644 --- a/mk/check/check-shlibs.mk +++ b/mk/check/check-shlibs.mk @@ -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 @@ CHECK_SHLIBS?= no # All binaries and shared libraries. _CHECK_SHLIBS_ERE= /(bin/|sbin/|libexec/|lib/lib.*\.so|lib/lib.*\.dylib) -########################################################################### -# check-shlibs target -# +###################################################################### +### check-shlibs (PRIVATE) +###################################################################### +### check-shlibs verifies that all libraries used by the package can be +### found at run-time. +### .PHONY: check-shlibs +.if !empty(CHECK_SHLIBS_SUPPORTED:M[nN][oO]) check-shlibs: -.if !empty(CHECK_SHLIBS_SUPPORTED:M[yY][eE][sS]) && !defined(NO_PKG_REGISTER) - ${_PKG_SILENT}${_PKG_DEBUG}${STEP_MSG} \ - "Checking for missing run-time search paths in ${PKGNAME}" + @${DO_NADA} +.else +check-shlibs: error-check + @${STEP_MSG} "Checking for missing run-time search paths 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}; \ case ${LDD:Q}"" in \ "") ldd=`${TYPE} ldd 2>/dev/null | ${AWK} '{ print $$NF }'` ;; \ *) ldd=${LDD:Q} ;; \ esac; \ ${TEST} -x "$$ldd" || exit 0; \ ${PKG_FILELIST_CMD} | \ - { ${EGREP} -h ${_CHECK_SHLIBS_ERE:Q} || ${TRUE}; } | \ - { while read file; do \ - ${TEST} -z ${PKG_VERBOSE:Q}"" || ${ECHO} "$$ldd $$file"; \ - err=`{ $$ldd $$file 2>&1 || ${TRUE}; } | { ${GREP} "not found" || ${TRUE}; }`; \ - if ${TEST} -n "$$err"; then \ - ${ECHO} "$$file: $$err"; \ - error=1; \ - fi; \ - done; \ - if ${TEST} "$$error" = 1; then \ + ${EGREP} -h ${_CHECK_SHLIBS_ERE:Q} | \ + while read file; do \ + err=`$$ldd $$file 2>&1 | ${GREP} "not found || ${TRUE}"`; \ + ${TEST} -z "$$err" || ${ECHO} "$$file: $$err"; \ + done + ${_PKG_SILENT}${_PKG_DEBUG} \ + exec 1>${ERROR_DIR}/${.TARGET}; \ + if ${_NONZERO_FILESIZE_P} ${ERROR_DIR}/${.TARGET}; then \ ${ECHO} "*** The above programs/libs will not find the listed shared libraries"; \ ${ECHO} " at runtime. Please fix the package (add -Wl,-R.../lib in the right"; \ ${ECHO} " places)!"; \ ${SHCOMMENT} Might not error-out for non-pkg-developers; \ - exit 1; \ - fi; } + fi +. endif .endif diff --git a/mk/check/check-wrkref.mk b/mk/check/check-wrkref.mk index 6baa150e5b1..c109bee6c9f 100644 --- a/mk/check/check-wrkref.mk +++ b/mk/check/check-wrkref.mk @@ -1,4 +1,4 @@ -# $NetBSD: check-wrkref.mk,v 1.3 2006/06/07 17:05:25 jlam Exp $ +# $NetBSD: check-wrkref.mk,v 1.4 2006/06/09 13:59:08 jlam Exp $ .if defined(PKG_DEVELOPER) CHECK_WRKREF?= tools @@ -30,36 +30,19 @@ _CHECK_WRKREF:= ${CHECK_WRKREF} _CHECK_WRKREF:= work # "work" is the "max" option .endif -########################################################################### -# check-wrkref target -# -_CHECK_WRKREF_FOUND= ${WRKDIR}/.check_wrkref_found - +###################################################################### +### check-wrkref (PRIVATE) +###################################################################### +### check-wrkref verifies that the installed files are free of +### hard-coded references to the work directory. +### .PHONY: check-wrkref -check-wrkref: check-wrkref-message check-wrkref-clean ${_CHECK_WRKREF_FOUND} - ${_PKG_SILENT}${_PKG_DEBUG} \ - if ${_ZERO_FILESIZE_P} ${_CHECK_WRKREF_FOUND}; then \ - ${DO_NADA}; \ - else \ - ${ERROR_MSG} "The following files still have references to the build directory."; \ - ${ERROR_MSG} "This is possibly an error that should be fixed by unwrapping"; \ - ${ERROR_MSG} "the files or adding missing tools to the package makefile!"; \ - ${ERROR_MSG} ""; \ - ${CAT} ${_CHECK_WRKREF_FOUND} | ${ERROR_CAT}; \ - exit 1; \ - fi - -.PHONY: check-wrkref-message -check-wrkref-message: +check-wrkref: error-check @${STEP_MSG} "Checking for work-directory references in ${PKGNAME}" - -check-clean: check-wrkref-clean -.PHONY: check-wrkref-clean -check-wrkref-clean: - ${_PKG_SILENT}${_PKG_DEBUG}${RM} -f ${_CHECK_WRKREF_FOUND} - -${_CHECK_WRKREF_FOUND}: +.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} | \ while read file; do \ ${_CHECK_WRKREF_SKIP_FILTER}; \ @@ -76,5 +59,12 @@ ${_CHECK_WRKREF_FOUND}: ${SED} -e "s|^|$$file: |"; \ ;; \ esac; \ - done > ${.TARGET}.tmp - ${_PKG_SILENT}${_PKG_DEBUG}${MV} -f ${.TARGET}.tmp ${.TARGET} + done + ${_PKG_SILENT}${_PKG_DEBUG} \ + exec 1>${ERROR_DIR}/${.TARGET}; \ + if ${_NONZERO_FILESIZE_P} ${ERROR_DIR}/${.TARGET}; then \ + ${ECHO} "*** The above files still have references to the build directory."; \ + ${ECHO} " This is possibly an error that should be fixed by unwrapping"; \ + ${ECHO} " the files or adding missing tools to the package makefile!"; \ + fi +.endif |