On Sat, 10 Sep 2005 20:04:32 +0000 (UTC)
Thorsten Glaser <[EMAIL PROTECTED]> wrote:

> >+_PORTSDIR_PATH!=for i in ${PORTSDIR_PATH:S,:, ,}; do cd $$i; pwd -P; done
>                                                        ^^^^^^^^^^^^^^
> use readlink -nf

I looked into this, and although there are examples of prior use
in bsd.port.mk, "readlink -f" will return a path whether it exits
or not.  In this case, I don't think we want that.  My diff was
misleading because the "cd $$i; pwd -P" should have been "cd $$i
&& pwd -P", which is reflected in the following updated diff.

Brad Ely

Index: pkgpath.mk
===================================================================
RCS file: /CVSROOT/ports/infrastructure/mk/pkgpath.mk,v
retrieving revision 1.4
diff -u -r1.4 pkgpath.mk
--- pkgpath.mk  28 Aug 2003 21:50:12 -0000      1.4
+++ pkgpath.mk  12 Sep 2005 03:33:58 -0000
@@ -4,18 +4,24 @@
 
 # definitions common to bsd.port.mk and bsd.port.subdir.mk
 
+PORTSDIR_PATH?=${PORTSDIR}:${PORTSDIR}/mystuff
+
 .if !defined(PKGPATH)
-_PORTSDIR!=    cd ${PORTSDIR} && pwd -P
-_CURDIR!=      cd ${.CURDIR} && pwd -P
+_CURDIR!=cd ${.CURDIR} && pwd -P
+_PORTSDIR_PATH!=for i in ${PORTSDIR_PATH:S,:, ,}; do cd $$i && pwd -P; done
+.  for _i in ${_PORTSDIR_PATH}
+.    if ${_CURDIR:M${_i}/*}
+_PORTSDIR=${_i}
+.    endif
+.  endfor
 PKGPATH=${_CURDIR:S,${_PORTSDIR}/,,}
 .endif
+
 .if empty(PKGPATH)
 PKGDEPTH=
 .else
 PKGDEPTH=${PKGPATH:C|[^./][^/]*|..|g}/
 .endif
-
-PORTSDIR_PATH?=${PORTSDIR}:${PORTSDIR}/mystuff
 
 # Code to invoke to split dir,-multi,flavor
 

Reply via email to