pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/mk/install Simplified the strip_prefix function. Teste...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/518e333a4bd3
branches:  trunk
changeset: 498412:518e333a4bd3
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Sun Aug 21 22:27:09 2005 +0000

description:
Simplified the strip_prefix function. Tested with /usr/bin/awk on Solaris,
nawk and gawk.

diffstat:

 mk/install/bsd.pkginstall.mk |  9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diffs (27 lines):

diff -r 9c2c7d79e7ea -r 518e333a4bd3 mk/install/bsd.pkginstall.mk
--- a/mk/install/bsd.pkginstall.mk      Sun Aug 21 22:00:07 2005 +0000
+++ b/mk/install/bsd.pkginstall.mk      Sun Aug 21 22:27:09 2005 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.pkginstall.mk,v 1.13 2005/08/20 02:22:02 jlam Exp $
+# $NetBSD: bsd.pkginstall.mk,v 1.14 2005/08/21 22:27:09 rillig Exp $
 #
 # This Makefile fragment is included by bsd.pkg.mk to use the common
 # INSTALL/DEINSTALL scripts.  To use this Makefile fragment, simply:
@@ -18,14 +18,13 @@
 # stripping ${PREFIX}/ from a pathname. 
 _FUNC_STRIP_PREFIX= \
        strip_prefix() {                                                \
-         { echo "$$1"; echo ${PREFIX:Q}/; }                            \
-         | ${AWK} 'NR==1 { s=$$0 } NR==2 { prefix=$$0 }                \
-           END { plen = length(prefix);                                \
+         ${AWK} 'END {                                                 \
+           plen = length(prefix);                                      \
              if (substr(s, 1, plen) == prefix) {                       \
                s = substr(s, 1 + plen, length(s) - plen);              \
              }                                                         \
              print s;                                                  \
-           }';                                                         \
+           }' s="$$1" prefix="$$2" /dev/null;                          \
        }
 
 DEINSTALL_FILE=                ${PKG_DB_TMPDIR}/+DEINSTALL



Home | Main Index | Thread Index | Old Index