pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/mk Revert revision 1.5 as binaries and directories are...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/5b9a531fcc7d
branches:  trunk
changeset: 465367:5b9a531fcc7d
user:      kim <kim%pkgsrc.org@localhost>
date:      Sun Dec 28 17:28:26 2003 +0000

description:
Revert revision 1.5 as binaries and directories are now being substed
unintentionally.

Also revert revision 1.6 as part of the overall change, as I suspect
the change might be unnecessary.  While I'm not 100% sure, this does
just revert to the previous behaviour.

diffstat:

 mk/subst.mk |  30 ++++++++++++++++++------------
 1 files changed, 18 insertions(+), 12 deletions(-)

diffs (51 lines):

diff -r fa6ed3e90968 -r 5b9a531fcc7d mk/subst.mk
--- a/mk/subst.mk       Sun Dec 28 16:21:35 2003 +0000
+++ b/mk/subst.mk       Sun Dec 28 17:28:26 2003 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: subst.mk,v 1.7 2003/12/28 15:57:29 jmmv Exp $
+# $NetBSD: subst.mk,v 1.8 2003/12/28 17:28:26 kim Exp $
 #
 # This Makefile fragment implements a general text replacement facility
 # for different classes of files in ${WRKSRC}.  For each class of files,
@@ -26,6 +26,10 @@
 
 ECHO_SUBST_MSG?=       ${ECHO}
 
+# _SUBST_IS_TEXT_FILE returns 0 if $${file} is a text file.
+_SUBST_IS_TEXT_FILE?= \
+       ${FILE_CMD} $${file} | ${EGREP} "(shell script|text)" >/dev/null 2>&1
+
 .for _class_ in ${SUBST_CLASSES}
 _SUBST_COOKIE.${_class_}=      ${WRKDIR}/.subst_${_class_}_done
 
@@ -69,17 +73,19 @@
        case "$$files" in                                               \
        "")     ;;                                                      \
        *)      for file in $${files}; do                               \
-                       ${MV} -f $$file $$file.subst.sav || exit 1;     \
-                       ${CAT} $$file.subst.sav                         \
-                               | ${SUBST_FILTER_CMD.${_class_}}        \
-                               > $$file;                               \
-                       if [ -x $$file.subst.sav ]; then                \
-                               ${CHMOD} +x $$file;                     \
-                       fi;                                             \
-                       if ${CMP} -s $$file.subst.sav $$file; then      \
-                               ${MV} -f $$file.subst.sav $$file;       \
-                       else                                            \
-                               ${ECHO} $$file >> ${.TARGET};           \
+                       if ${_SUBST_IS_TEXT_FILE}; then                 \
+                               ${MV} -f $$file $$file.subst.sav;       \
+                               ${CAT} $$file.subst.sav                 \
+                                       | ${SUBST_FILTER_CMD.${_class_}} \
+                                       > $$file;                       \
+                               if [ -x $$file.subst.sav ]; then        \
+                                       ${CHMOD} +x $$file;             \
+                               fi;                                     \
+                               if ${CMP} -s $$file.subst.sav $$file; then \
+                                       ${MV} -f $$file.subst.sav $$file; \
+                               else                                    \
+                                       ${ECHO} $$file >> ${.TARGET};   \
+                               fi;                                     \
                        fi;                                             \
                done ;;                                                 \
        esac



Home | Main Index | Thread Index | Old Index