Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 31 Aug 2015 20:44:53 +0000 (UTC)
From:      Bryan Drewery <bdrewery@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r287334 - stable/10/share/mk
Message-ID:  <201508312044.t7VKir4Q086145@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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}"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201508312044.t7VKir4Q086145>