pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/mk Change instances where we stored `shell command` in...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/7443d85647b2
branches:  trunk
changeset: 494203:7443d85647b2
user:      jlam <jlam%pkgsrc.org@localhost>
date:      Fri May 20 21:36:05 2005 +0000

description:
Change instances where we stored `shell command` in a make variable into
variables that use the :sh modifier.  This still causes expansion to only
happen when referenced, and has the advantage of being :Q-safe.

Bring back the changes from revision 1.19 of mk/subst.mk now that the
problem noted above has been fixed.  This passes the buildlink-unwrap
regression test.

diffstat:

 mk/bsd.pkg.mk             |  11 +++++------
 mk/subst.mk               |  45 ++++++++++++++++++++++-----------------------
 mk/wrapper/bsd.wrapper.mk |  11 +++++------
 3 files changed, 32 insertions(+), 35 deletions(-)

diffs (117 lines):

diff -r 253b10e62308 -r 7443d85647b2 mk/bsd.pkg.mk
--- a/mk/bsd.pkg.mk     Fri May 20 21:34:30 2005 +0000
+++ b/mk/bsd.pkg.mk     Fri May 20 21:36:05 2005 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: bsd.pkg.mk,v 1.1672 2005/05/18 23:59:44 rillig Exp $
+#      $NetBSD: bsd.pkg.mk,v 1.1673 2005/05/20 21:36:05 jlam Exp $
 #
 # This file is in the public domain.
 #
@@ -1727,12 +1727,11 @@
 .  else
 _REPLACE_LOCALEDIR_PATTERNS+=  [Mm]akefile*
 .  endif
-_REPLACE_LOCALEDIR_PATTERNS_FIND= \
-       \( ${_REPLACE_LOCALEDIR_PATTERNS:S/$/!/:S/^/-o -name !/:S/!/"/g:S/-o//1} \)
+_REPLACE_LOCALEDIR_PATTERNS_FIND_cmd= \
+       cd ${WRKSRC} && ${FIND} . \( ${_REPLACE_LOCALEDIR_PATTERNS:S/$/!/:S/^/-o -name !/:S/!/"/g:S/-o//1} \) -print | ${SED} -e 's|^\./||' | ${GREP} -v '\.orig' | ${SORT} -u
 REPLACE_LOCALEDIR?=            # empty
-_REPLACE_LOCALEDIR=            \
-       ${REPLACE_LOCALEDIR}    \
-       `${FIND} . ${_REPLACE_LOCALEDIR_PATTERNS_FIND} -print | ${SED} -e 's|^\./||' | ${GREP} -v '\.orig' | ${SORT} -u`
+_REPLACE_LOCALEDIR=            ${REPLACE_LOCALEDIR}                    \
+                               ${_REPLACE_LOCALEDIR_PATTERNS_FIND_cmd:sh}
 
 _CONFIGURE_PREREQ+=            subst-pkglocaledir
 .  if empty(USE_PKGLOCALEDIR:M[nN][oO])
diff -r 253b10e62308 -r 7443d85647b2 mk/subst.mk
--- a/mk/subst.mk       Fri May 20 21:34:30 2005 +0000
+++ b/mk/subst.mk       Fri May 20 21:36:05 2005 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: subst.mk,v 1.20 2005/05/20 18:40:42 jlam Exp $
+# $NetBSD: subst.mk,v 1.21 2005/05/20 21:36:05 jlam Exp $
 #
 # This Makefile fragment implements a general text replacement facility.
 # Package makefiles define a ``class'', for each of which a paricular
@@ -47,7 +47,7 @@
 _SUBST_COOKIE.${_class_}=      ${WRKDIR}/.subst_${_class_}_done
 
 SUBST_FILTER_CMD.${_class_}?=  ${SED} ${SUBST_SED.${_class_}}
-SUBST_POSTCMD.${_class_}?=     ${RM} -f $$file${_SUBST_BACKUP_SUFFIX}
+SUBST_POSTCMD.${_class_}?=     ${RM} -f "$$tmpfile"
 
 SUBST_TARGETS+=                        subst-${_class_}
 _SUBST_TARGETS.${_class_}=     subst-${_class_}-message
@@ -77,26 +77,25 @@
 
 ${_SUBST_COOKIE.${_class_}}:
        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
-       cd ${WRKSRC};                                                   \
-       files="${SUBST_FILES.${_class_}}";                              \
-       case "$$files" in                                               \
-       "")     ;;                                                      \
-       *)      for file in $${files}; do                               \
-                       if ${_SUBST_IS_TEXT_FILE}; then                 \
-                               ${MV} -f $$file $$file${_SUBST_BACKUP_SUFFIX} || exit 1; \
-                               ${CAT} $$file${_SUBST_BACKUP_SUFFIX}    \
-                                       | ${SUBST_FILTER_CMD.${_class_}} \
-                                       > $$file;                       \
-                               if [ -x $$file${_SUBST_BACKUP_SUFFIX} ]; then \
-                                       ${CHMOD} +x $$file;             \
-                               fi;                                     \
-                               if ${CMP} -s $$file${_SUBST_BACKUP_SUFFIX} $$file; then \
-                                       ${MV} -f $$file${_SUBST_BACKUP_SUFFIX} $$file; \
-                               else                                    \
-                                       ${SUBST_POSTCMD.${_class_}};    \
-                                       ${ECHO} $$file >> ${.TARGET};   \
-                               fi;                                     \
+       cd ${WRKSRC:Q};                                                 \
+       files=${SUBST_FILES.${_class_}:Q};                              \
+       for file in $$files; do                                         \
+               file="./$$file";                                        \
+               tmpfile="$$file"${_SUBST_BACKUP_SUFFIX:Q};              \
+               if ${_SUBST_IS_TEXT_FILE}; then                         \
+                       ${MV} -f "$$file" "$$tmpfile" || exit 1;        \
+                       ${CAT} "$$tmpfile"                              \
+                       | ${SUBST_FILTER_CMD.${_class_}}                \
+                       > "$$file";                                     \
+                       if ${TEST} -x "$$tmpfile"; then                 \
+                               ${CHMOD} +x "$$file";                   \
                        fi;                                             \
-               done ;;                                                 \
-       esac
+                       if ${CMP} -s "$$tmpfile" "$$file"; then         \
+                               ${MV} -f "$$tmpfile" "$$file";          \
+                       else                                            \
+                               ${SUBST_POSTCMD.${_class_}};            \
+                               ${ECHO} "$$file" >> ${.TARGET};         \
+                       fi;                                             \
+               fi;                                                     \
+       done
 .endfor
diff -r 253b10e62308 -r 7443d85647b2 mk/wrapper/bsd.wrapper.mk
--- a/mk/wrapper/bsd.wrapper.mk Fri May 20 21:34:30 2005 +0000
+++ b/mk/wrapper/bsd.wrapper.mk Fri May 20 21:36:05 2005 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.wrapper.mk,v 1.30 2005/05/11 22:08:19 jlam Exp $
+# $NetBSD: bsd.wrapper.mk,v 1.31 2005/05/20 21:36:05 jlam Exp $
 #
 # Copyright (c) 2004 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -695,12 +695,11 @@
 _UNWRAP_PATTERNS+=     *-config
 _UNWRAP_PATTERNS+=     *Conf.sh
 _UNWRAP_PATTERNS+=     *.pc
-_UNWRAP_PATTERNS_FIND= \
-       \( ${_UNWRAP_PATTERNS:S/$/!/:S/^/-o -name !/:S/!/"/g:S/-o//1} \)
+_UNWRAP_PATTERNS_FIND_cmd=     \
+       cd ${WRKSRC} && ${FIND} . \( ${_UNWRAP_PATTERNS:S/$/!/:S/^/-o -name !/:S/!/"/g:S/-o//1} \) -print | ${SED} -e 's|^\./||' | ${SORT} -u
 UNWRAP_FILES?=         # empty
-_UNWRAP_FILES=         \
-       ${UNWRAP_FILES} \
-       `${FIND} . ${_UNWRAP_PATTERNS_FIND} -print | ${SED} -e 's|^\./||' | ${SORT} -u`
+_UNWRAP_FILES=         ${UNWRAP_FILES}                                 \
+                       ${_UNWRAP_PATTERNS_FIND_cmd:sh}
 _UNWRAP_SED?=          # empty
 
 SUBST_CLASSES+=                unwrap



Home | Main Index | Thread Index | Old Index