diff options
author | jlam <jlam@pkgsrc.org> | 2005-06-23 09:02:46 +0000 |
---|---|---|
committer | jlam <jlam@pkgsrc.org> | 2005-06-23 09:02:46 +0000 |
commit | 5d1e8de6bcefc57f7337bf07a7fd75244fa2c03d (patch) | |
tree | a6474cda1e892ade4da528d63d9af26f73ea3906 /mk | |
parent | 6ae4606464252d194b374c41998d4c3df7664ac0 (diff) | |
download | pkgsrc-5d1e8de6bcefc57f7337bf07a7fd75244fa2c03d.tar.gz |
Split out the check-wrkref implementation and related variables from
bsd.pkg.mk into bsd.pkg.check.mk file.
Diffstat (limited to 'mk')
-rw-r--r-- | mk/bsd.pkg.check.mk | 78 | ||||
-rw-r--r-- | mk/bsd.pkg.mk | 68 |
2 files changed, 78 insertions, 68 deletions
diff --git a/mk/bsd.pkg.check.mk b/mk/bsd.pkg.check.mk index 72976a4369d..66233aec5c2 100644 --- a/mk/bsd.pkg.check.mk +++ b/mk/bsd.pkg.check.mk @@ -1,4 +1,4 @@ -# $NetBSD: bsd.pkg.check.mk,v 1.1 2005/06/23 08:31:20 jlam Exp $ +# $NetBSD: bsd.pkg.check.mk,v 1.2 2005/06/23 09:02:46 jlam Exp $ # # This Makefile fragment is included by bsd.pkg.mk and defines the # relevant variables and targets the for various install-time "check" @@ -13,6 +13,14 @@ # CHECK_FILES_STRICT makes the file checks very strict on errors if # it is any value other than "no". Defaults to "no". # +# CHECK_WRKREF causes the check for ${WRKDIR} or ${TOOLS_DIR} in +# the package's installed files. Defaults to "no". +# +# CHECK_WRKREF_IS_TEXT_FILE is a shell command list that determines +# whether we check for ${WRKDIR} or ${TOOLS_DIR} in "$$file". +# If this command returns 0, then we check for ${WRKDIR}. It +# defaults to returning 0 if "$$file" is a text file. +# # The following targets are defined by bsd.pkg.check.mk: # # check-files-pre & check-files-post generate the list of files on the @@ -23,14 +31,23 @@ # if there are any extra or missing files installed by the # package. # +# check-wrkref checks whether a package's installed files contain +# references to ${WRKDIR}. +# # For PKG_DEVELOPERs, cause some checks to be run automatically by default. .if defined(PKG_DEVELOPER) CHECK_FILES?= yes +CHECK_WRKREF?= yes .endif CHECK_FILES?= no CHECK_FILES_STRICT?= no +CHECK_WRKREF?= no + +########################################################################### +### check-files ########################################################### +########################################################################### ########################################################################### # CHECK_FILES_SKIP is a list of file names that will be skipped when @@ -251,3 +268,62 @@ ${_CHECK_FILES_COOKIE.varbase}: } > ${.TARGET}; \ fi ${_PKG_SILENT}${_PKG_DEBUG}${TOUCH} ${TOUCH_FLAGS} ${.TARGET} + +########################################################################### +### check-wrkref ########################################################## +########################################################################### + +########################################################################### +# CHECK_WRKREF_SKIP is a list of shell globs. Installed files that +# match these globs are skipped when running the check-wrkref target. +# +.if make(check-wrkref) +. if !defined(_CHECK_WRKREF_SKIP_FILTER) +_CHECK_WRKREF_SKIP_FILTER= ${TRUE} +. if defined(CHECK_WRKREF_SKIP) && !empty(CHECK_WRKREF_SKIP) +_CHECK_WRKREF_SKIP_FILTER= case "$$file" in +. for _pattern_ in ${CHECK_WRKREF_SKIP} +_CHECK_WRKREF_SKIP_FILTER+= ${_pattern_}) continue ;; +. endfor +_CHECK_WRKREF_SKIP_FILTER+= *) ;; +_CHECK_WRKREF_SKIP_FILTER+= esac +. endif +. endif +MAKEVARS+= _CHECK_WRKREF_SKIP_FILTER +.else +_CHECK_WRKREF_SKIP_FILTER= ${TRUE} +.endif +CHECK_WRKREF_IS_TEXT_FILE?= ${_SUBST_IS_TEXT_FILE} + +########################################################################### +# check-wrkref target +# +.PHONY: check-wrkref +check-wrkref: +.if !defined(NO_PKG_REGISTER) + ${_PKG_SILENT}${_PKG_DEBUG}${ECHO_MSG} \ + "${_PKGSRC_IN}> Checking for work-directory references in ${PKGNAME}" + ${_PKG_SILENT}${_PKG_DEBUG} \ + ${PKG_INFO} -qL ${PKGNAME:Q} | ${SORT} | \ + { while read file; do \ + ${_CHECK_WRKREF_SKIP_FILTER}; \ + ${SHCOMMENT} [$$file]; \ + if ${CHECK_WRKREF_IS_TEXT_FILE}; then \ + if ${GREP} -H ${WRKDIR:Q} "$$file" 2>/dev/null; then \ + found_wrkdir=1; \ + fi; \ + else \ + if ${GREP} -H ${TOOLS_DIR:Q} "$$file" 2>/dev/null; then \ + found_wrkdir=1; \ + fi; \ + fi; \ + done; \ + if ${TEST} "$$found_wrkdir" = 1; then \ + ${ECHO} "***"; \ + ${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!"; \ + ${ECHO} "***"; \ + exit 1; \ + fi; } +.endif diff --git a/mk/bsd.pkg.mk b/mk/bsd.pkg.mk index 15513f77058..d40f6084111 100644 --- a/mk/bsd.pkg.mk +++ b/mk/bsd.pkg.mk @@ -1,4 +1,4 @@ -# $NetBSD: bsd.pkg.mk,v 1.1698 2005/06/23 08:31:20 jlam Exp $ +# $NetBSD: bsd.pkg.mk,v 1.1699 2005/06/23 09:02:46 jlam Exp $ # # This file is in the public domain. # @@ -59,7 +59,6 @@ build-defs-message: ${WRKDIR} ############################################################################ CHECK_SHLIBS?= YES # run check-shlibs after install -CHECK_WRKREF?= no # run check-wrkref after install CLEANDEPENDS?= NO DEINSTALLDEPENDS?= NO # add -R to pkg_delete MKCRYPTO?= YES # build crypto packages by default @@ -2514,71 +2513,6 @@ show-shlib-type: . endif # USE_LANGUAGES .endif -# check-wrkref is a make target that greps through the installed files -# for a package and looks for references to the build directory. If -# the file is a text file, then it is checked for "${WRKDIR}", and if -# it isn't, then it is checked for "${TOOLS_DIR}". If any such -# references are found and PKG_DEVELOPER is defined, then exit with an -# error. This target is automatically run after a package is installed -# if CHECK_WRKREF is anything other than "no". -# -# CHECK_WRKREF_SKIP is a list of shell globs. Installed files that -# match these globs are skipped when running the check-wrkref target. -# -# CHECK_WRKREF_PKG is the name of the package to check. It defaults to -# ${PKGNAME}. -# -.if make(check-wrkref) -. if !defined(_CHECK_WRKREF_SKIP_FILTER) -_CHECK_WRKREF_SKIP_FILTER= ${TRUE} -. if defined(CHECK_WRKREF_SKIP) && !empty(CHECK_WRKREF_SKIP) -_CHECK_WRKREF_SKIP_FILTER= case "$$file" in -. for _pattern_ in ${CHECK_WRKREF_SKIP} -_CHECK_WRKREF_SKIP_FILTER+= ${_pattern_}) continue ;; -. endfor -_CHECK_WRKREF_SKIP_FILTER+= *) ;; -_CHECK_WRKREF_SKIP_FILTER+= esac -. endif -. endif -MAKEVARS+= _CHECK_WRKREF_SKIP_FILTER -.else -_CHECK_WRKREF_SKIP_FILTER= ${TRUE} -.endif -CHECK_WRKREF_PKG?= ${PKGNAME} -CHECK_WRKREF_IS_TEXT_FILE?= ${_SUBST_IS_TEXT_FILE} - -.PHONY: check-wrkref -check-wrkref: -.if !defined(NO_PKG_REGISTER) - ${_PKG_SILENT}${_PKG_DEBUG}${ECHO_MSG} \ - "${_PKGSRC_IN}> Checking for work-directory references in ${PKGNAME}" - ${_PKG_SILENT}${_PKG_DEBUG} \ - ${PKG_INFO} -qL ${CHECK_WRKREF_PKG:Q} | ${SORT} | \ - { while read file; do \ - ${_CHECK_WRKREF_SKIP_FILTER}; \ - ${SHCOMMENT} [$$file]; \ - if ${CHECK_WRKREF_IS_TEXT_FILE}; then \ - if ${GREP} -H ${WRKDIR:Q} "$$file" 2>/dev/null; then \ - found_wrkdir=1; \ - fi; \ - else \ - if ${GREP} -H ${TOOLS_DIR:Q} "$$file" 2>/dev/null; then \ - found_wrkdir=1; \ - fi; \ - fi; \ - done; \ - if ${TEST} "$$found_wrkdir" = 1; then \ - ${ECHO} "***"; \ - ${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!"; \ - ${ECHO} "***"; \ - if ${TEST} "${PKG_DEVELOPER:Uno}" != "no"; then \ - exit 1; \ - fi; \ - fi; } -.endif - .PHONY: acquire-extract-lock acquire-patch-lock acquire-tools-lock .PHONY: acquire-wrapper-lock acquire-configure-lock acquire-build-lock |