svn commit: r287334 - stable/10/share/mk

Bryan Drewery bdrewery at FreeBSD.org
Mon Aug 31 20:44:53 UTC 2015


Author: bdrewery
Date: Mon Aug 31 20:44:52 2015
New Revision: 287334
URL: https://svnweb.freebsd.org/changeset/base/287334

Log:
  MFC r272282,r272363,r272383:
  
    r272282:
      Search for the nearest PORTSDIR where Mk/bsd.ports.mk exists, from .CURDIR.
      This will only take effect if PORTSDIR is not set, as previously supported.
  
    r272363:
      Always resolve PORTSDIR to absolute paths using realpath(1).
  
    r272383:
      Revise r272363 by collapsing the tests into a for loop.
  
  Relnotes:	yes

Modified:
  stable/10/share/mk/bsd.port.mk
  stable/10/share/mk/bsd.port.subdir.mk
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/share/mk/bsd.port.mk
==============================================================================
--- stable/10/share/mk/bsd.port.mk	Mon Aug 31 20:30:06 2015	(r287333)
+++ stable/10/share/mk/bsd.port.mk	Mon Aug 31 20:44:52 2015	(r287334)
@@ -1,6 +1,18 @@
 # $FreeBSD$
 
-PORTSDIR?=	/usr/ports
+.if !defined(PORTSDIR)
+# Autodetect if the command is being run in a ports tree that's not rooted
+# in the default /usr/ports.  The ../../.. case is in case ports ever grows
+# a third level.
+.for RELPATH in . .. ../.. ../../..
+.if !defined(_PORTSDIR) && exists(${.CURDIR}/${RELPATH}/Mk/bsd.port.mk)
+_PORTSDIR=	${.CURDIR}/${RELPATH}
+.endif
+.endfor
+_PORTSDIR?=	/usr/ports
+PORTSDIR!=	realpath ${_PORTSDIR}
+.endif
+
 BSDPORTMK?=	${PORTSDIR}/Mk/bsd.port.mk
 
 # Needed to keep bsd.own.mk from reading in /etc/src.conf

Modified: stable/10/share/mk/bsd.port.subdir.mk
==============================================================================
--- stable/10/share/mk/bsd.port.subdir.mk	Mon Aug 31 20:30:06 2015	(r287333)
+++ stable/10/share/mk/bsd.port.subdir.mk	Mon Aug 31 20:44:52 2015	(r287334)
@@ -1,6 +1,18 @@
 # $FreeBSD$
 
-PORTSDIR?=	/usr/ports
+.if !defined(PORTSDIR)
+# Autodetect if the command is being run in a ports tree that's not rooted
+# in the default /usr/ports.  The ../../.. case is in case ports ever grows
+# a third level.
+.for RELPATH in . .. ../.. ../../..
+.if !defined(_PORTSDIR) && exists(${.CURDIR}/${RELPATH}/Mk/bsd.port.mk)
+_PORTSDIR=	${.CURDIR}/${RELPATH}
+.endif
+.endfor
+_PORTSDIR?=	/usr/ports
+PORTSDIR!=	realpath ${_PORTSDIR}
+.endif
+
 BSDPORTSUBDIRMK?=	${PORTSDIR}/Mk/bsd.port.subdir.mk
 
 .include "${BSDPORTSUBDIRMK}"


More information about the svn-src-stable-10 mailing list