head 1.29; access; symbols pkgsrc-2023Q4:1.28.0.4 pkgsrc-2023Q4-base:1.28 pkgsrc-2023Q3:1.28.0.2 pkgsrc-2023Q3-base:1.28 pkgsrc-2023Q2:1.27.0.4 pkgsrc-2023Q2-base:1.27 pkgsrc-2023Q1:1.27.0.2 pkgsrc-2023Q1-base:1.27 pkgsrc-2022Q4:1.26.0.2 pkgsrc-2022Q4-base:1.26 pkgsrc-2022Q3:1.25.0.20 pkgsrc-2022Q3-base:1.25 pkgsrc-2022Q2:1.25.0.18 pkgsrc-2022Q2-base:1.25 pkgsrc-2022Q1:1.25.0.16 pkgsrc-2022Q1-base:1.25 pkgsrc-2021Q4:1.25.0.14 pkgsrc-2021Q4-base:1.25 pkgsrc-2021Q3:1.25.0.12 pkgsrc-2021Q3-base:1.25 pkgsrc-2021Q2:1.25.0.10 pkgsrc-2021Q2-base:1.25 pkgsrc-2021Q1:1.25.0.8 pkgsrc-2021Q1-base:1.25 pkgsrc-2020Q4:1.25.0.6 pkgsrc-2020Q4-base:1.25 pkgsrc-2020Q3:1.25.0.4 pkgsrc-2020Q3-base:1.25 pkgsrc-2020Q2:1.25.0.2 pkgsrc-2020Q2-base:1.25 pkgsrc-2020Q1:1.24.0.20 pkgsrc-2020Q1-base:1.24 pkgsrc-2019Q4:1.24.0.42 pkgsrc-2019Q4-base:1.24 pkgsrc-2019Q3:1.24.0.38 pkgsrc-2019Q3-base:1.24 pkgsrc-2019Q2:1.24.0.36 pkgsrc-2019Q2-base:1.24 pkgsrc-2019Q1:1.24.0.34 pkgsrc-2019Q1-base:1.24 pkgsrc-2018Q4:1.24.0.32 pkgsrc-2018Q4-base:1.24 pkgsrc-2018Q3:1.24.0.30 pkgsrc-2018Q3-base:1.24 pkgsrc-2018Q2:1.24.0.28 pkgsrc-2018Q2-base:1.24 pkgsrc-2018Q1:1.24.0.26 pkgsrc-2018Q1-base:1.24 pkgsrc-2017Q4:1.24.0.24 pkgsrc-2017Q4-base:1.24 pkgsrc-2017Q3:1.24.0.22 pkgsrc-2017Q3-base:1.24 pkgsrc-2017Q2:1.24.0.18 pkgsrc-2017Q2-base:1.24 pkgsrc-2017Q1:1.24.0.16 pkgsrc-2017Q1-base:1.24 pkgsrc-2016Q4:1.24.0.14 pkgsrc-2016Q4-base:1.24 pkgsrc-2016Q3:1.24.0.12 pkgsrc-2016Q3-base:1.24 pkgsrc-2016Q2:1.24.0.10 pkgsrc-2016Q2-base:1.24 pkgsrc-2016Q1:1.24.0.8 pkgsrc-2016Q1-base:1.24 pkgsrc-2015Q4:1.24.0.6 pkgsrc-2015Q4-base:1.24 pkgsrc-2015Q3:1.24.0.4 pkgsrc-2015Q3-base:1.24 pkgsrc-2015Q2:1.24.0.2 pkgsrc-2015Q2-base:1.24 pkgsrc-2015Q1:1.23.0.4 pkgsrc-2015Q1-base:1.23 pkgsrc-2014Q4:1.23.0.2 pkgsrc-2014Q4-base:1.23 pkgsrc-2014Q3:1.22.0.2 pkgsrc-2014Q3-base:1.22 pkgsrc-2014Q2:1.21.0.32 pkgsrc-2014Q2-base:1.21 pkgsrc-2014Q1:1.21.0.30 pkgsrc-2014Q1-base:1.21 pkgsrc-2013Q4:1.21.0.28 pkgsrc-2013Q4-base:1.21 pkgsrc-2013Q3:1.21.0.26 pkgsrc-2013Q3-base:1.21 pkgsrc-2013Q2:1.21.0.24 pkgsrc-2013Q2-base:1.21 pkgsrc-2013Q1:1.21.0.22 pkgsrc-2013Q1-base:1.21 pkgsrc-2012Q4:1.21.0.20 pkgsrc-2012Q4-base:1.21 pkgsrc-2012Q3:1.21.0.18 pkgsrc-2012Q3-base:1.21 pkgsrc-2012Q2:1.21.0.16 pkgsrc-2012Q2-base:1.21 pkgsrc-2012Q1:1.21.0.14 pkgsrc-2012Q1-base:1.21 pkgsrc-2011Q4:1.21.0.12 pkgsrc-2011Q4-base:1.21 pkgsrc-2011Q3:1.21.0.10 pkgsrc-2011Q3-base:1.21 pkgsrc-2011Q2:1.21.0.8 pkgsrc-2011Q2-base:1.21 pkgsrc-2011Q1:1.21.0.6 pkgsrc-2011Q1-base:1.21 pkgsrc-2010Q4:1.21.0.4 pkgsrc-2010Q4-base:1.21 pkgsrc-2010Q3:1.21.0.2 pkgsrc-2010Q3-base:1.21 pkgsrc-2010Q2:1.20.0.8 pkgsrc-2010Q2-base:1.20 pkgsrc-2010Q1:1.20.0.6 pkgsrc-2010Q1-base:1.20 pkgsrc-2009Q4:1.20.0.4 pkgsrc-2009Q4-base:1.20 pkgsrc-2009Q3:1.20.0.2 pkgsrc-2009Q3-base:1.20 pkgsrc-2009Q2:1.19.0.4 pkgsrc-2009Q2-base:1.19 pkgsrc-2009Q1:1.19.0.2 pkgsrc-2009Q1-base:1.19 pkgsrc-2008Q4:1.18.0.12 pkgsrc-2008Q4-base:1.18 pkgsrc-2008Q3:1.18.0.10 pkgsrc-2008Q3-base:1.18 cube-native-xorg:1.18.0.8 cube-native-xorg-base:1.18 pkgsrc-2008Q2:1.18.0.6 pkgsrc-2008Q2-base:1.18 cwrapper:1.18.0.4 pkgsrc-2008Q1:1.18.0.2 pkgsrc-2008Q1-base:1.18 pkgsrc-2007Q4:1.15.0.4 pkgsrc-2007Q4-base:1.15 pkgsrc-2007Q3:1.15.0.2 pkgsrc-2007Q3-base:1.15 pkgsrc-2007Q2:1.13.0.6 pkgsrc-2007Q2-base:1.13 pkgsrc-2007Q1:1.13.0.4 pkgsrc-2007Q1-base:1.13 jlam-pkgviews:1.13.0.2 jlam-pkgviews-base:1.13 pkgsrc-2006Q4:1.10.0.2 pkgsrc-2006Q4-base:1.10 pkgsrc-2006Q3:1.4.0.4 pkgsrc-2006Q3-base:1.4 pkgsrc-2006Q2:1.4.0.2 pkgsrc-2006Q2-base:1.4; locks; strict; comment @# @; 1.29 date 2023.12.28.22.27.27; author rillig; state Exp; branches; next 1.28; commitid XuP170Z1q1czAhSE; 1.28 date 2023.06.27.10.27.54; author riastradh; state Exp; branches; next 1.27; commitid pgkCl2xMGPR6yzuE; 1.27 date 2023.03.04.23.03.34; author rillig; state Exp; branches; next 1.26; commitid FpbQuTDZlsfnqRfE; 1.26 date 2022.11.23.11.55.43; author jperkin; state Exp; branches; next 1.25; commitid aE9VE6icmXVhXO2E; 1.25 date 2020.04.26.14.23.25; author rillig; state Exp; branches; next 1.24; commitid dnuZSjQjvGYT1U5C; 1.24 date 2015.04.29.13.39.43; author jperkin; state Exp; branches; next 1.23; commitid 4xnOFBA80vM5nujy; 1.23 date 2014.10.12.23.39.17; author joerg; state Exp; branches; next 1.22; commitid ATqNbEa0yhPY8YTx; 1.22 date 2014.09.04.16.09.33; author jperkin; state Exp; branches; next 1.21; commitid bCvXgc5VQ3X5R2Px; 1.21 date 2010.08.24.19.08.29; author bad; state Exp; branches; next 1.20; 1.20 date 2009.09.02.14.43.06; author joerg; state Exp; branches; next 1.19; 1.19 date 2009.01.12.13.11.22; author uebayasi; state Exp; branches; next 1.18; 1.18 date 2008.02.20.10.23.26; author rillig; state Exp; branches; next 1.17; 1.17 date 2008.02.10.11.43.20; author tnn; state Exp; branches; next 1.16; 1.16 date 2008.02.07.21.36.13; author rillig; state Exp; branches; next 1.15; 1.15 date 2007.09.13.09.52.46; author rillig; state Exp; branches; next 1.14; 1.14 date 2007.09.05.13.34.32; author rillig; state Exp; branches; next 1.13; 1.13 date 2007.03.16.10.29.22; author rillig; state Exp; branches; next 1.12; 1.12 date 2007.03.15.01.06.02; author rillig; state Exp; branches; next 1.11; 1.11 date 2007.01.07.11.21.24; author rillig; state Exp; branches; next 1.10; 1.10 date 2006.11.12.00.13.26; author rillig; state Exp; branches; next 1.9; 1.9 date 2006.11.12.00.09.50; author rillig; state Exp; branches; next 1.8; 1.8 date 2006.11.09.15.10.16; author rillig; state Exp; branches; next 1.7; 1.7 date 2006.11.05.14.46.50; author joerg; state Exp; branches; next 1.6; 1.6 date 2006.10.16.19.02.53; author seb; state Exp; branches; next 1.5; 1.5 date 2006.10.09.12.25.44; author joerg; state Exp; branches; next 1.4; 1.4 date 2006.06.09.13.59.08; author jlam; state Exp; branches; next 1.3; 1.3 date 2006.06.07.17.05.25; author jlam; state Exp; branches; next 1.2; 1.2 date 2006.06.06.18.07.50; author jlam; state Exp; branches; next 1.1; 1.1 date 2006.06.03.23.11.42; author jlam; state Exp; branches; next ; desc @@ 1.29 log @mk/check-wrkref: allow to disallow DESTDIR in the binary package When a package is built, it first gets installed into DESTDIR, which is somewhere below WRKDIR. From there, a binary package is created, which is then installed via pkg_add. After this step, the value of DESTDIR is no longer relevant, thus there is no reason to refer to that directory from the final binary package. This new check is not enabled by default, to allow for an opt-in testing phase first. @ text @# $NetBSD: check-wrkref.mk,v 1.28 2023/06/27 10:27:54 riastradh Exp $ # # This file checks that the installed files don't contain any strings # that point to the directory where the package had been built, to make # sure that the package still works after the working directory has been # cleaned up. # # User-settable variables: # # CHECK_WRKREF # The list of directory names that must not appear in installed files. # # tools the tool wrappers # wrappers the compiler wrappers # home FAKEHOMEDIR # wrksrc WRKSRC # work WRKDIR # wrkobjdir WRKOBJDIR # pkgsrc PKGSRCDIR # buildlink BUILDLINK_DIR and BUILDLINK_X11_DIR # destdir DESTDIR # extra see CHECK_WRKREF_EXTRA_DIRS # cross TOOLBASE (only if distinct from LOCALBASE) # # Default value: "tools home cross" for PKG_DEVELOPERs, "no" otherwise. # # The "buildlink" option works best in combination with # STRIP_DEBUG=yes. # # CHECK_WRKREF_EXTRA_DIRS # A list of additional directories (or other strings) that must # not appear in the installed files. For pbulk builds, the # location where the pbulk tools are installed should be added # here. # # Package-settable variables: # # CHECK_WRKREF_SKIP # The list of filename patterns that should be excluded from this # test, either absolute or relative to PREFIX. # _VARGROUPS+= check-wrkref _USER_VARS.check-wrkref= CHECK_WRKREF CHECK_WRKREF_EXTRA_DIRS _PKG_VARS.check-wrkref= CHECK_WRKREF_SKIP .if ${PKG_DEVELOPER:Uno} != "no" CHECK_WRKREF?= tools home cross .else CHECK_WRKREF?= no .endif CHECK_WRKREF_SKIP?= # none _CHECK_WRKREF_FILELIST_CMD?= ${PKG_FILELIST_CMD} _CHECK_WRKREF_DIR.no= # none _CHECK_WRKREF_DIR.work= ${WRKDIR} _CHECK_WRKREF_DIR.tools= ${TOOLS_DIR} _CHECK_WRKREF_DIR.wrappers= ${WRAPPER_DIR} _CHECK_WRKREF_DIR.home= ${FAKEHOMEDIR} _CHECK_WRKREF_DIR.wrkobjdir= ${WRKOBJDIR} _CHECK_WRKREF_DIR.wrksrc= ${WRKSRC} _CHECK_WRKREF_DIR.pkgsrc= ${PKGSRCDIR} _CHECK_WRKREF_DIR.buildlink= ${BUILDLINK_DIR} .if defined(USE_X11) && ${X11_TYPE} != "modular" _CHECK_WRKREF_DIR.buildlink+= ${BUILDLINK_X11_DIR} .endif _CHECK_WRKREF_DIR.destdir= ${DESTDIR} _CHECK_WRKREF_DIR.extra= ${CHECK_WRKREF_EXTRA_DIRS} _CHECK_WRKREF_DIR.cross= \ ${${TOOLBASE} != ${LOCALBASE}:?${TOOLBASE}:} _CHECK_WRKREF_DIRS= # none .for d in ${CHECK_WRKREF} . if !defined(_CHECK_WRKREF_DIR.${d}) PKG_FAIL_REASON+= "[check-wrkref.mk] Invalid value \"${d:Q}\" for CHECK_WRKREF." PKG_FAIL_REASON+= "[check-wrkref.mk] Valid options are:" . for refvar in work tools wrappers home wrkobjdir wrksrc pkgsrc buildlink destdir extra cross PKG_FAIL_REASON+= "[check-wrkref.mk] ${refvar}" . endfor . else _CHECK_WRKREF_DIRS+= ${_CHECK_WRKREF_DIR.${d}} . endif .endfor .if empty(CHECK_WRKREF:M[nN][oO]) && !empty(_CHECK_WRKREF_DIRS:M*) privileged-install-hook: _check-wrkref .endif _check-wrkref: error-check .PHONY ${RUN} \ ${STEP_MSG} "Checking for work-directory references in ${PKGNAME}"; \ ${_CHECK_WRKREF_FILELIST_CMD} | ${SORT} | \ while read file; do \ case "$$file" in \ ${CHECK_WRKREF_SKIP:@@p@@${p} | ${PREFIX}/${p}) continue;; @@} \ *) ;; \ esac; \ ${SHCOMMENT} "[$$file]"; \ ${ECHO} "${DESTDIR}$$file" >>${ERROR_DIR}/${.TARGET}.tmp; \ done; \ if [ -s ${ERROR_DIR}/${.TARGET}.tmp ]; then \ ${XARGS} -n 256 ${EGREP} ${_CHECK_WRKREF_DIRS:ts|:Q} \ < ${ERROR_DIR}/${.TARGET}.tmp 2>/dev/null \ >${ERROR_DIR}/${.TARGET} || ${TRUE}; \ ${RM} -f ${ERROR_DIR}/${.TARGET}.tmp; \ fi; \ exec 1>>${ERROR_DIR}/${.TARGET}; \ if [ -s ${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 @ 1.28 log @check-wrkref: Check for TOOLBASE references when it's not LOCALBASE. No change for native compilation, where TOOLBASE = LOCALBASE. @ text @d1 1 a1 1 # $NetBSD: check-wrkref.mk,v 1.27 2023/03/04 23:03:34 rillig Exp $ d21 1 d68 1 d78 1 a78 1 . for refvar in work tools wrappers home wrkobjdir wrksrc pkgsrc buildlink extra cross @ 1.27 log @mk/check-wrkref: unclutter the documentation @ text @d1 1 a1 1 # $NetBSD: check-wrkref.mk,v 1.26 2022/11/23 11:55:43 jperkin Exp $ d22 1 d24 1 a24 1 # Default value: "tools home" for PKG_DEVELOPERs, "no" otherwise. d47 1 a47 1 CHECK_WRKREF?= tools home d68 2 d76 1 a76 1 . for refvar in work tools wrappers home wrkobjdir wrksrc pkgsrc buildlink extra @ 1.26 log @mk: check performance improvements. Inline ${RUN} calls where appropriate. Avoid useless use of cat(1). Avoid unnecessary calls to rm. Use xargs(1) to reduce number of calls to egrep, previously it was called once per file. The last change in particular can have huge performance improvements, for example saving around 5,000 execs during the build of ansible-core, and significantly reducing the build and system times. @ text @d1 1 a1 1 # $NetBSD: check-wrkref.mk,v 1.25 2020/04/26 14:23:25 rillig Exp $ d5 1 a5 1 # sure that the package still works after the source code has been d13 9 a21 9 # * "tools" for the tool wrapper directory # * "wrappers" for the wrappers directory # * "home" for FAKEHOMEDIR # * "wrksrc" for WRKSRC # * "work" for WRKDIR # * "wrkobjdir" for WRKOBJDIR # * "pkgsrc" for PKGSRCDIR # * "buildlink" for BUILDLINK_DIR and BUILDLINK_X11_DIR # * "extra" for CHECK_WRKREF_EXTRA_DIRS d24 1 @ 1.25 log @mk/check/check-wrkref.mk: fix shell quoting Before, adding "Binary file matches" (including the quotes) to CHECK_WRKREF_EXTRA_DIRS led to a syntax error. Adding this string is so obvious that it should have been added a long time ago already. @ text @d1 1 a1 1 # $NetBSD: check-wrkref.mk,v 1.24 2015/04/29 13:39:43 jperkin Exp $ d85 2 a86 4 @@${STEP_MSG} "Checking for work-directory references in ${PKGNAME}" ${RUN} rm -f ${ERROR_DIR}/${.TARGET} ${RUN} \ exec 1>${ERROR_DIR}/${.TARGET}; \ d94 8 a101 4 ${EGREP} ${_CHECK_WRKREF_DIRS:ts|:Q} "${DESTDIR}$$file" \ 2>/dev/null | ${SED} -e "s|^|$$file: |"; \ done ${RUN} \ d103 1 a103 1 if ${_NONZERO_FILESIZE_P} ${ERROR_DIR}/${.TARGET}; then \ @ 1.24 log @Use a single egrep and regexp instead of iterating over the list of files to check and calling grep on each of them. Idea for using ":ts|" from Joerg. Reduces the test runtime by around 50%, depending on platform and package. @ text @d1 1 a1 1 # $NetBSD: check-wrkref.mk,v 1.23 2014/10/12 23:39:17 joerg Exp $ d41 1 a41 1 _USER_VARS.check-wrkref= CHECK_WRKREF d96 1 a96 1 ${EGREP} "${_CHECK_WRKREF_DIRS:ts|}" "${DESTDIR}$$file" \ @ 1.23 log @Simplify PKG_DEVELOPER checks. @ text @d1 1 a1 1 # $NetBSD: check-wrkref.mk,v 1.22 2014/09/04 16:09:33 jperkin Exp $ d96 2 a97 4 for d in ${_CHECK_WRKREF_DIRS}; do \ grep "$$d" "${DESTDIR}$$file" 2>/dev/null | \ sed -e "s|^|$$file: |"; \ done; \ @ 1.22 log @Add a 'wrappers' option for CHECK_WRKREF which, if enabled, will check for references to ${WRAPPER_DIR}. Update the error message when an invalid CHECK_WRKREF option is used. @ text @d1 1 a1 1 # $NetBSD: check-wrkref.mk,v 1.21 2010/08/24 19:08:29 bad Exp $ d44 1 a44 1 .if defined(PKG_DEVELOPER) && ${PKG_DEVELOPER} != "no" d46 2 a48 1 CHECK_WRKREF?= no @ 1.21 log @I'm fed up with having to waste time because PKG_DEVELOPER is "special" and can't be disabled by setting it to "no" like the other variables. Besides, flavor/pkg/metadata.mk has been expecting for a long time that "no" is a valid value. Make PKG_DEVELOPER DWIM. @ text @d1 1 a1 1 # $NetBSD: check-wrkref.mk,v 1.20 2009/09/02 14:43:06 joerg Exp $ d14 1 d55 1 d69 5 a73 2 PKG_FAIL_REASON+= "[check-wrkref.mk] Invalid value "${d:Q}" for CHECK_WRKREF." PKG_FAIL_REASON+= "[check-wrkref.mk] Try one of { tools home wrksrc work objwrkdir } instead." @ 1.20 log @Add wrkref check for using the .buildlink or .x11-buildlink subdirectories. Update comment on the default checks. @ text @d1 1 a1 1 # $NetBSD: check-wrkref.mk,v 1.19 2009/01/12 13:11:22 uebayasi Exp $ d43 1 a43 1 .if defined(PKG_DEVELOPER) @ 1.19 log @Fix check-wrkref path. _CHECK_WRKREF_FILELIST_CMD is a command which prints PLIST paths converted to absolute path. _CHECK_WRKREF_FILELIST_CMD can run anywhere, so cd ${DESTDIR} before that is pointless. To access files, _CHECK_WRKREF_FILELIST_CMD's output needs to be s/^/${DESTDIR}/ when destdir is used. Reviewed By: joerg @ text @d1 1 a1 1 # $NetBSD$ d19 1 d22 3 a24 1 # Default value: "tools" for PKG_DEVELOPERs, "no" otherwise. d58 4 @ 1.18 log @Removed colons for the sake of "bmake help". @ text @d1 1 a1 1 # $NetBSD: check-wrkref.mk,v 1.17 2008/02/10 11:43:20 tnn Exp $ a75 1 cd ${DESTDIR}${PREFIX}; \ d84 1 a84 1 grep "$$d" "$$file" 2>/dev/null | \ @ 1.17 log @Enable fake home directory support. Also add a wrkref check because an embedded path to the HOME directory can be a security problem if, say, the package looks in the HOME directory of an unprivileged user for configuration files. Note that this has the potential to cause some short-term fallout. @ text @d1 1 a1 1 # $NetBSD: check-wrkref.mk,v 1.16 2008/02/07 21:36:13 rillig Exp $ d10 1 a10 1 # CHECK_WRKREF: d31 1 a31 1 # CHECK_WRKREF_SKIP: @ 1.16 log @Replaced _PKG_SILENT and _PKG_DEBUG with RUN. @ text @d1 1 a1 1 # $NetBSD: check-wrkref.mk,v 1.15 2007/09/13 09:52:46 rillig Exp $ d14 1 d41 1 a41 1 CHECK_WRKREF?= tools d51 1 d61 1 a61 1 PKG_FAIL_REASON+= "[check-wrkref.mk] Try one of { tools wrksrc work objwrkdir } instead." @ 1.15 log @In bulk builds with a custom PKGSRCDIR, that directory should not appear in binary packages. This check can be enabled by adding "pkgsrc" to CHECK_WRKREF. @ text @d1 1 a1 1 # $NetBSD: check-wrkref.mk,v 1.14 2007/09/05 13:34:32 rillig Exp $ d72 1 a72 1 ${_PKG_SILENT}${_PKG_DEBUG} \ @ 1.14 log @Now it's possible to add custom directories to the check for directory references. @ text @d1 1 a1 1 # $NetBSD: check-wrkref.mk,v 1.13 2007/03/16 10:29:22 rillig Exp $ d17 1 d52 1 @ 1.13 log @Added the variable declarations for the "show-all" target. @ text @d1 1 a1 1 # $NetBSD: check-wrkref.mk,v 1.12 2007/03/15 01:06:02 rillig Exp $ d17 1 d21 6 d51 1 @ 1.12 log @The CHECK_WRKREF variable has changed type: It is now a list of directory aliases. That makes it possible to check for references into TOOLS_DIR and WRKSRC, but to leave out the other infrastructure directories. On IRIX, x11/gtk2 failed to build because of an unknown library -lharfbuzz. That library turned out to be an internal dependency of graphics/cairo, which had made it into the installed libpangocairo.la file. With this change, that bug would have been caught earlier. @ text @d1 1 a1 1 # $NetBSD: check-wrkref.mk,v 1.11 2007/01/07 11:21:24 rillig Exp $ d27 4 @ 1.11 log @Fixed the mismatch between absolute and relative paths. @ text @d1 1 a1 1 # $NetBSD: check-wrkref.mk,v 1.10 2006/11/12 00:13:26 rillig Exp $ d11 1 a11 1 # The kind of directory that must not appear in installed files. a12 1 # * "no" to disable this check at all d14 1 d39 1 d41 9 a49 4 .if !defined(_CHECK_WRKREF_DIR.${CHECK_WRKREF}) PKG_FAIL_REASON+= "[check-wrkref.mk] CHECK_WRKREF must be one of { no tools work objwrkdir }." .endif _CHECK_WRKREF_DIR= ${_CHECK_WRKREF_DIR.${CHECK_WRKREF}} d51 1 a51 1 .if empty(CHECK_WRKREF:M[nN][oO]) d68 2 a69 5 case ${_CHECK_WRKREF_DIR:Q}"" in \ "") ${ERROR_MSG} "[check-wrkref.mk] The directory to check is empty."; \ exit 1; \ ;; \ *) grep ${_CHECK_WRKREF_DIR:Q}"" "$$file" 2>/dev/null | \ d71 1 a71 2 ;; \ esac; \ d73 1 a73 1 ${_PKG_SILENT}${_PKG_DEBUG} \ @ 1.10 log @Moved the check for whether check-wrkref should be run from install/install.mk to check/check-wrkref.mk. Renamed the check-wrkref target to _check-wrkref. @ text @d1 1 a1 1 # $NetBSD: check-wrkref.mk,v 1.9 2006/11/12 00:09:50 rillig Exp $ d24 1 a24 1 # test. d33 1 a33 1 _CHECK_WRKREF_FILELIST_CMD?= ${SED} -e '/^@@/d' ${PLIST} d58 1 a58 1 ${CHECK_WRKREF_SKIP:@@p@@${p}) continue;; @@} \ @ 1.9 log @Improved the readability of the header comment. CHECK_WRKREF may be set to "wrkobjdir" to check for references to WRKOBJDIR. Added some error checking. Removed the dependency on NO_PKG_REGISTER. @ text @d1 1 a1 1 # $NetBSD: check-wrkref.mk,v 1.8 2006/11/09 15:10:16 rillig Exp $ d45 5 a49 1 check-wrkref: error-check .PHONY @ 1.8 log @Greatly simplified the code and added documentation. @ text @d1 1 a1 1 # $NetBSD: check-wrkref.mk,v 1.7 2006/11/05 14:46:50 joerg Exp $ d11 6 a16 4 # The kind of check that should be done. Say "no" for no check # at all, "tools" for checking references to the directory where # the tool wrappers had been, and "work" to check references to # anything from the working directory. d35 11 a45 8 ###################################################################### ### 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: error-check d47 1 a47 2 .if !defined(NO_PKG_REGISTER) ${_PKG_SILENT}${_PKG_DEBUG}${RM} -f ${ERROR_DIR}/${.TARGET} d57 4 a60 5 ${SHCOMMENT} [$$file]; \ case ${CHECK_WRKREF:Q}"" in \ *work*) \ ${GREP} ${WRKDIR} "$$file" 2>/dev/null | \ ${SED} -e "s|^|$$file: |"; \ d62 2 a63 3 *tools*) \ ${GREP} ${TOOLS_DIR} "$$file" 2>/dev/null | \ ${SED} -e "s|^|$$file: |"; \ a73 1 .endif @ 1.7 log @Look into DESTDIR when checking for WRKDIR references. @ text @d1 23 a23 1 # $NetBSD: check-wrkref.mk,v 1.6 2006/10/16 19:02:53 seb Exp $ d29 1 a29 25 ########################################################################### # CHECK_WRKREF_SKIP is a list of shell globs. Installed files that # match these globs are skipped when running the check-wrkref target. # .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 _CHECK_WRKREF_SKIP_FILTER+= ${_CHECK_WRKREF_SKIP_FILTER_BODY} _CHECK_WRKREF_SKIP_FILTER+= *) ;; _CHECK_WRKREF_SKIP_FILTER+= esac . endif .endif .if !defined(_CHECK_WRKREF_SKIP_FILTER_BODY) . for _pattern_ in ${CHECK_WRKREF_SKIP} _CHECK_WRKREF_SKIP_FILTER_BODY+= ${_pattern_}) continue ;; . endfor .endif MAKEVARS+= _CHECK_WRKREF_SKIP_FILTER_BODY _CHECK_WRKREF:= ${CHECK_WRKREF} .if !empty(_CHECK_WRKREF:Mwork) _CHECK_WRKREF:= work # "work" is the "max" option .endif d49 4 a52 1 ${_CHECK_WRKREF_SKIP_FILTER}; \ d54 2 a55 2 case ${_CHECK_WRKREF:Mwork:Q}"" in \ work) \ d59 1 a59 3 esac; \ case ${_CHECK_WRKREF:Mtools:Q}"" in \ tools) \ @ 1.6 log @Since 2006/10/09 the ${PLIST} file does not contain the full pathnames anymore. Therefore cd to ${PREFIX} to correctly resolve the relative pathnames. While here unbreak CHECK_WRKREF for another reason: Append to ${ERROR_DIR}/${.TARGET} otherwise the "_NONZERO_FILESIZE_P" check is always false... @ text @d1 1 a1 1 # $NetBSD: check-wrkref.mk,v 1.5 2006/10/09 12:25:44 joerg Exp $ d48 1 a48 1 cd ${PREFIX}; \ @ 1.5 log @Main infrastructure for DESTDIR support. Packages may set PKG_DESTDIR_SUPPORT to either "destdir" or "user-destdir" to flag support for this, following the same rules as PKG_INSTALLATION_TYPES (e.g. define before first include of bsd.prefs.mk). The user activates it via USE_DESTDIR. When set to "yes", packages with "user-destdir" are handled as "destdir". The installation of the package will not go to ${LOCALBASE}, but a subdirectory of ${WRKDIR} instead. pre/post install scripts are not run and the package is not registered either. A binary package can be created instead to be installed normally with pkg_add. For "user-destdir" packages, everything is run as normal user and ownership is supposed to be correctled by pkg_create later. Since the current pkg_install code uses pax and it doesn't allow overwriting owners, this does not work yet. For "destdir" packages, installation, packaging and cleaning is run as root. This commit does not change the handling of DEPENDS_TARGET or bin-install to allow recursive usage. @ text @d1 1 a1 1 # $NetBSD: check-wrkref.mk,v 1.4 2006/06/09 13:59:08 jlam Exp $ d48 1 d67 1 a67 1 exec 1>${ERROR_DIR}/${.TARGET}; \ @ 1.4 log @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. @ text @d1 1 a1 1 # $NetBSD: check-wrkref.mk,v 1.3 2006/06/07 17:05:25 jlam Exp $ d33 2 d48 1 a48 1 ${PKG_FILELIST_CMD} | ${SORT} | \ @ 1.3 log @Rewrite to avoid using "grep -H", which Solaris' grep does not support. @ text @d1 1 a1 1 # $NetBSD: check-wrkref.mk,v 1.2 2006/06/06 18:07:50 jlam Exp $ d33 6 a38 5 ########################################################################### # check-wrkref target # _CHECK_WRKREF_FOUND= ${WRKDIR}/.check_wrkref_found d40 1 a40 15 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: d42 2 a43 7 check-clean: check-wrkref-clean .PHONY: check-wrkref-clean check-wrkref-clean: ${_PKG_SILENT}${_PKG_DEBUG}${RM} -f ${_CHECK_WRKREF_FOUND} ${_CHECK_WRKREF_FOUND}: d45 1 d62 9 a70 2 done > ${.TARGET}.tmp ${_PKG_SILENT}${_PKG_DEBUG}${MV} -f ${.TARGET}.tmp ${.TARGET} @ 1.2 log @Fix problem with saving variables whose value contains "$$" by avoiding it altogether. In this case, saving _CHECK_WRKREF_SKIP_FILTER was problematic because the value was cached and in the process, one $ was stripped. This makes the check-wrkref target work again after the big refactoring commit from a couple of days ago. @ text @d1 1 a1 1 # $NetBSD: check-wrkref.mk,v 1.1 2006/06/03 23:11:42 jlam Exp $ d36 2 d39 23 a61 4 check-wrkref: .if !defined(NO_PKG_REGISTER) ${_PKG_SILENT}${_PKG_DEBUG}${STEP_MSG} \ "Checking for work-directory references in ${PKGNAME}" d64 1 a64 1 { while read file; do \ d69 2 a70 3 if ${GREP} -H ${WRKDIR} "$$file" 2>/dev/null; then \ found=1; \ fi; \ d75 2 a76 3 if ${GREP} -H ${TOOLS_DIR} "$$file" 2>/dev/null; then \ found=1; \ fi; \ d79 2 a80 10 done; \ if ${TEST} "$$found" = 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 @ 1.1 log @First pass at implementing support for package system flavors other than pkgsrc's current one. This is an important lead-up to any project that redesigns the pkg_* tools in that it doesn't tie us to past design (mis)choices. This commit mostly deals with rearranging code, although there was a considerable amount of rewriting done in cases where I thought the code was somewhat messy and was difficult to understand. The design I chose for supporting multiple package system flavors is that the various depends, install, package, etc. modules would define default targets and variables that may be overridden in files from pkgsrc/mk/flavor/${PKG_FLAVOR}. The default targets would do the sensible thing of doing nothing, and pkgsrc infrastructure would rely on the appropriate things to be defined in pkgsrc/mk/flavor to do the real work. The pkgsrc/mk/flavor directory contains subdirectories corresponding to each package system flavor that we support. Currently, I only have "pkg" which represents the current pkgsrc-native package flavor. I've separated out most of the code where we make assumptions about the package system flavor, mostly either because we directly use the pkg_* tools, or we make assumptions about the package meta-data directory, or we directly manipulate the package meta-data files, and placed it into pkgsrc/mk/flavor/pkg. There are several new modules that have been refactored out of bsd.pkg.mk as part of these changes: check, depends, install, package, and update. Each of these modules has been slimmed down by rewriting them to avoid some recursive make calls. I've also religiously documented which targets are "public" and which are "private" so that users won't rely on reaching into pkgsrc innards to call a private target. The "depends" module is a complete overhaul of the way that we handle dependencies. There is now a separate "depends" phase that occurs before the "extract" phase where dependencies are installed. This differs from the old way where dependencies were installed just before extraction occurred. The reduce-depends.mk file is now replaced by a script that is invoked only once during the depends phase and is used to generate a cookie file that holds the full set of reduced dependencies. It is now possible to type "make depends" in a package directory and all missing dependencies will be installed. Future work on this project include: * Resolve the workflow design in anticipation of future work on staged installations where "package" conceptually happens before "install". * Rewrite the buildlink3 framework to not assume the use of the pkgsrc pkg_* tools. * Rewrite the pkginstall framework to provide a standard pkg_* tool to perform the actions, and allowing a purely declarative file per package to describe what actions need to be taken at install or deinstall time. * Implement support for the SVR4 package flavor. This will be proof that the appropriate abstractions are in place to allow using a completely different set of package management tools. @ text @d1 1 a1 1 # $NetBSD$ d12 1 a12 2 .if make(check-wrkref) . if !defined(_CHECK_WRKREF_SKIP_FILTER) d14 1 a14 1 . if defined(CHECK_WRKREF_SKIP) && !empty(CHECK_WRKREF_SKIP) d16 1 a16 3 . for _pattern_ in ${CHECK_WRKREF_SKIP} _CHECK_WRKREF_SKIP_FILTER+= ${_pattern_}) continue ;; . endfor a18 1 . endif a19 3 MAKEVARS+= _CHECK_WRKREF_SKIP_FILTER .else _CHECK_WRKREF_SKIP_FILTER= ${TRUE} d21 6 @