From owner-svn-src-head@FreeBSD.ORG Wed Oct 1 20:52:09 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 35BDE976; Wed, 1 Oct 2014 20:52:09 +0000 (UTC) Received: from svn.freebsd.org (svn.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 08A937D9; Wed, 1 Oct 2014 20:52:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s91Kq8bn005973; Wed, 1 Oct 2014 20:52:08 GMT (envelope-from will@FreeBSD.org) Received: (from will@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s91Kq8Md005971; Wed, 1 Oct 2014 20:52:08 GMT (envelope-from will@FreeBSD.org) Message-Id: <201410012052.s91Kq8Md005971@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: will set sender to will@FreeBSD.org using -f From: Will Andrews Date: Wed, 1 Oct 2014 20:52:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272383 - head/share/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Oct 2014 20:52:09 -0000 Author: will Date: Wed Oct 1 20:52:08 2014 New Revision: 272383 URL: https://svnweb.freebsd.org/changeset/base/272383 Log: Revise r272363 by collapsing the tests into a for loop. This has the side effect of ensuring that realpath is also run for the nominal case of PORTSDIR=/usr/ports (assuming .CURDIR is a ports directory that relies on /usr/ports but is not rooted in it). This ensures that any generated PORTSDIR used is always the actual location. Submitted by: jkim (different implementation) Modified: head/share/mk/bsd.port.mk head/share/mk/bsd.port.subdir.mk Modified: head/share/mk/bsd.port.mk ============================================================================== --- head/share/mk/bsd.port.mk Wed Oct 1 20:37:15 2014 (r272382) +++ head/share/mk/bsd.port.mk Wed Oct 1 20:52:08 2014 (r272383) @@ -4,17 +4,13 @@ # 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. -.if exists(${.CURDIR}/Mk/bsd.port.mk) -PORTSDIR!= realpath ${.CURDIR} -.elif exists(${.CURDIR}/../Mk/bsd.port.mk) -PORTSDIR!= realpath ${.CURDIR}/.. -.elif exists(${.CURDIR}/../../Mk/bsd.port.mk) -PORTSDIR!= realpath ${.CURDIR}/../.. -.elif exists(${.CURDIR}/../../../Mk/bsd.port.mk) -PORTSDIR!= realpath ${.CURDIR}/../../.. -.else -PORTSDIR= /usr/ports +.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 Modified: head/share/mk/bsd.port.subdir.mk ============================================================================== --- head/share/mk/bsd.port.subdir.mk Wed Oct 1 20:37:15 2014 (r272382) +++ head/share/mk/bsd.port.subdir.mk Wed Oct 1 20:52:08 2014 (r272383) @@ -4,17 +4,13 @@ # 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. -.if exists(${.CURDIR}/Mk/bsd.port.mk) -PORTSDIR!= realpath ${.CURDIR} -.elif exists(${.CURDIR}/../Mk/bsd.port.mk) -PORTSDIR!= realpath ${.CURDIR}/.. -.elif exists(${.CURDIR}/../../Mk/bsd.port.mk) -PORTSDIR!= realpath ${.CURDIR}/../.. -.elif exists(${.CURDIR}/../../../Mk/bsd.port.mk) -PORTSDIR!= realpath ${.CURDIR}/../../.. -.else -PORTSDIR= /usr/ports +.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