pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/mk Rewrote the _PATH_CMD command, which could not hand...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/8ac52af9c374
branches:  trunk
changeset: 503198:8ac52af9c374
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Tue Nov 15 21:21:01 2005 +0000

description:
Rewrote the _PATH_CMD command, which could not handle a PATH environment
variable before if it had multiple adjacent white-space characters in
it. Removed the dependency on awk(1), as a simple shell script can do
this job, too. Another change is that all kinds of weird pathnames can
be used for PREPEND_PATH, like /bin, "/bin/Program Files", "/     ",
/foo\ bar, and so on. This had not been possible before, too.

Related to PR 32079.

Ok'ed by jlam.

diffstat:

 mk/bsd.pkg.mk |  13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diffs (29 lines):

diff -r 8b314f6eb7ba -r 8ac52af9c374 mk/bsd.pkg.mk
--- a/mk/bsd.pkg.mk     Tue Nov 15 20:59:51 2005 +0000
+++ b/mk/bsd.pkg.mk     Tue Nov 15 21:21:01 2005 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: bsd.pkg.mk,v 1.1750 2005/11/15 18:03:40 gavan Exp $
+#      $NetBSD: bsd.pkg.mk,v 1.1751 2005/11/15 21:21:01 rillig Exp $
 #
 # This file is in the public domain.
 #
@@ -918,12 +918,15 @@
 MAKEFLAGS+=            _PATH_ORIG=${_PATH_ORIG:Q}
 .endif
 
-.if !empty(PREPEND_PATH)
+.if !empty(PREPEND_PATH:M*)
 # This is very Special.  Because PREPEND_PATH is set with += in reverse order,
-# the awk expression reverses the order again (since bootstrap bmake doesn't
+# this command reverses the order again (since bootstrap bmake doesn't
 # yet support the :[-1..1] construct).
-_PATH_CMD=             ${ECHO} `${ECHO} ${PREPEND_PATH:Q} | ${AWK} '{ORS=":";for (i=NF;i>0;i--) print $$i}'`${_PATH_ORIG}
-PATH=                  ${_PATH_CMD:sh} # DOES NOT use :=, to defer evaluation
+_PATH_CMD= \
+       path=${_PATH_ORIG:Q};                                           \
+       for i in ${PREPEND_PATH}; do path="$$i:$$path"; done;           \
+       ${ECHO} "$$path"
+PATH=  ${_PATH_CMD:sh} # DOES NOT use :=, to defer evaluation
 .endif
 
 # Add these bits to the environment use when invoking the sub-make



Home | Main Index | Thread Index | Old Index