pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/mk Before running _SUBST_IS_TEXT_FILE on a file, make ...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/208482c3a637
branches:  trunk
changeset: 534823:208482c3a637
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Thu Nov 01 13:12:48 2007 +0000

description:
Before running _SUBST_IS_TEXT_FILE on a file, make sure that the file
exists.

diffstat:

 mk/subst.mk |  10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diffs (32 lines):

diff -r 7cb645385b18 -r 208482c3a637 mk/subst.mk
--- a/mk/subst.mk       Thu Nov 01 13:08:05 2007 +0000
+++ b/mk/subst.mk       Thu Nov 01 13:12:48 2007 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: subst.mk,v 1.46 2007/04/05 18:33:09 wiz Exp $
+# $NetBSD: subst.mk,v 1.47 2007/11/01 13:12:48 rillig Exp $
 #
 # This Makefile fragment implements a general text replacement facility.
 # Package makefiles define a ``class'', for each of which a particular
@@ -109,7 +109,9 @@
        for file in $$files; do                                         \
                case $$file in /*) ;; *) file="./$$file";; esac;        \
                tmpfile="$$file"${_SUBST_BACKUP_SUFFIX:Q};              \
-               if ${_SUBST_IS_TEXT_FILE.${_class_}}; then              \
+               if [ ! -f "$$file" ]; then                              \
+                       ${WARNING_MSG} "[subst.mk:${_class_}] Ignoring non-existent file \"$$file\"."; \
+               elif ${_SUBST_IS_TEXT_FILE.${_class_}}; then            \
                        ${MV} -f "$$file" "$$tmpfile" || exit 1;        \
                        ${SUBST_FILTER_CMD.${_class_}}                  \
                        < "$$tmpfile"                                   \
@@ -124,10 +126,8 @@
                                ${SUBST_POSTCMD.${_class_}};            \
                                ${ECHO} "$$file" >> ${.TARGET};         \
                        fi;                                             \
-               elif ${TEST} -f "$$file"; then                          \
+               else                                                    \
                        ${WARNING_MSG} "[subst.mk:${_class_}] Ignoring non-text file \"$$file\"."; \
-               else                                                    \
-                       ${WARNING_MSG} "[subst.mk:${_class_}] Ignoring non-existent file \"$$file\"."; \
                fi;                                                     \
        done
        ${_PKG_SILENT}${_PKG_DEBUG} set -e;                             \



Home | Main Index | Thread Index | Old Index