From owner-svn-src-all@freebsd.org Mon Aug 31 20:44:53 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A984A9C79EC; Mon, 31 Aug 2015 20:44:53 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 800221D29; Mon, 31 Aug 2015 20:44:53 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t7VKirwN086147; Mon, 31 Aug 2015 20:44:53 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t7VKir4Q086145; Mon, 31 Aug 2015 20:44:53 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201508312044.t7VKir4Q086145@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Mon, 31 Aug 2015 20:44:53 +0000 (UTC) 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 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Aug 2015 20:44:53 -0000 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}"