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)
This commit is contained in:
parent
ba7bccb366
commit
6cc777bf8b
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=272383
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user