diff options
author | bapt <bapt@FreeBSD.org> | 2013-06-26 15:22:06 +0800 |
---|---|---|
committer | bapt <bapt@FreeBSD.org> | 2013-06-26 15:22:06 +0800 |
commit | 2ded89d4b30809ba2060cd95e381f1fe52949778 (patch) | |
tree | a586641a8f1a5511cf76f0101cb17a2bd337165d /Mk/bsd.port.mk | |
parent | 8cd5fb4322a63ec97b4857f6d6d261a497704e98 (diff) | |
download | freebsd-ports-gnome-2ded89d4b30809ba2060cd95e381f1fe52949778.tar.gz freebsd-ports-gnome-2ded89d4b30809ba2060cd95e381f1fe52949778.tar.zst freebsd-ports-gnome-2ded89d4b30809ba2060cd95e381f1fe52949778.zip |
Replace OPTIONSFILE by OPTIONS_FILE which is a more robust variable with unicity
insurance in its path to avoid collision.
A compatibility layer is available to automatically load and migration from
OPTIONSFILE to OPTIONS_FILE (this is all transparent for users.)
It is recommanded that ports that used to overwrite OPTIONSFILE to prevent the
known bugs should keep the OPTIONSFILE overwrite for a while (6 month) to allow
the migration to happen automatically and users to not lose their old save
options.
New options file is now based on the PKGORIGIN therefor the definition of the
PKGORIGIN has been moved ealier in bsd.port.mk to allow it's usage from withing
bsd.options.mk
PR: ports/148637
Reviewed by: bdrewery
Diffstat (limited to 'Mk/bsd.port.mk')
-rw-r--r-- | Mk/bsd.port.mk | 47 |
1 files changed, 33 insertions, 14 deletions
diff --git a/Mk/bsd.port.mk b/Mk/bsd.port.mk index 252c9faea92a..53145e3a7e5b 100644 --- a/Mk/bsd.port.mk +++ b/Mk/bsd.port.mk @@ -1217,6 +1217,13 @@ WITH_PKGNG?= yes # Only define tools here (for transition period with between pkg tools) .include "${PORTSDIR}/Mk/bsd.commands.mk" +.for _CATEGORY in ${CATEGORIES} +PKGCATEGORY?= ${_CATEGORY} +.endfor +_PORTDIRNAME= ${.CURDIR:T} +PORTDIRNAME?= ${_PORTDIRNAME} +PKGORIGIN?= ${PKGCATEGORY}/${PORTDIRNAME} + MASTERDIR?= ${.CURDIR} .if ${MASTERDIR} != ${.CURDIR} @@ -2385,14 +2392,6 @@ TMPPLIST?= ${WRKDIR}/.PLIST.mktmp TMPPLIST_SORT?= ${WRKDIR}/.PLIST.mktmp.sorted TMPGUCMD?= ${WRKDIR}/.PLIST.gucmd -.for _CATEGORY in ${CATEGORIES} -PKGCATEGORY?= ${_CATEGORY} -.endfor -_PORTDIRNAME= ${.CURDIR:T} -PORTDIRNAME?= ${_PORTDIRNAME} -PKGORIGIN?= ${PKGCATEGORY}/${PORTDIRNAME} - - .if !defined(PKG_ARGS) PKG_ARGS= -v -c -${COMMENT:Q} -d ${DESCR} -f ${TMPPLIST} -p ${PREFIX} -P "`cd ${.CURDIR} && ${MAKE} actual-package-depends | ${GREP} -v -E ${PKG_IGNORE_DEPENDS} | ${SORT} -u -t : -k 2`" ${EXTRA_PKG_ARGS} $${_LATE_PKG_ARGS} .if !defined(NO_MTREE) @@ -6106,13 +6105,20 @@ do-config: @${ECHO_MSG} "===> No options to configure" .else .if ${UID} != 0 && !defined(INSTALL_AS_USER) - @optionsdir=${OPTIONSFILE}; optionsdir=$${optionsdir%/*}; \ + @optionsdir=${OPTIONS_FILE}; optionsdir=$${optionsdir%/*}; \ + oldoptionsdir=${OPTIONSFILE}; oldoptionsdir=$${oldoptionsdir%/*}; \ ${ECHO_MSG} "===> Switching to root credentials to create $${optionsdir}"; \ - (${SU_CMD} "${SH} -c \"${MKDIR} $${optionsdir} 2> /dev/null\"") || \ + (${SU_CMD} "${SH} -c \"if [ -d $${oldoptionsdir} -a ! -d $${optionsdir} ]; then ${MV} $${oldoptionsdir} $${optionsdir}; elif [ -d $${oldoptionsdir} -a -d $${optionsdir} ]; then ${RM} -rf $${oldoptionsdir} ; fi ; ${MKDIR} $${optionsdir} 2> /dev/null\"") || \ (${ECHO_MSG} "===> Cannot create $${optionsdir}, check permissions"; exit 1); \ ${ECHO_MSG} "===> Returning to user credentials" .else - @(optionsdir=${OPTIONSFILE}; optionsdir=$${optionsdir%/*}; \ + @(optionsdir=${OPTIONS_FILE}; optionsdir=$${optionsdir%/*}; \ + oldoptionsdir=${OPTIONSFILE}; oldoptionsdir=$${oldoptionsdir%/*}; \ + if [ -d $${oldoptionsdir} -a ! -d $${optionsdir} ]; then \ + ${MV} $${oldoptionsdir} $${optionsdir}; \ + elif [ -d $${oldoptionsdir} -a -d $${optionsdir} ]; then \ + ${RM} -rf $${oldoptionsdir} ; \ + fi ; \ ${MKDIR} $${optionsdir} 2> /dev/null) || \ (${ECHO_MSG} "===> Cannot create $${optionsdir}, check permissions"; exit 1) .endif @@ -6144,11 +6150,11 @@ do-config: fi; \ done; \ if [ ${UID} != 0 -a "x${INSTALL_AS_USER}" = "x" ]; then \ - ${ECHO_MSG} "===> Switching to root credentials to write ${OPTIONSFILE}"; \ - ${SU_CMD} "${CAT} $${TMPOPTIONSFILE} > ${OPTIONSFILE}"; \ + ${ECHO_MSG} "===> Switching to root credentials to write ${OPTIONS_FILE}"; \ + ${SU_CMD} "${CAT} $${TMPOPTIONSFILE} > ${OPTIONS_FILE}"; \ ${ECHO_MSG} "===> Returning to user credentials"; \ else \ - ${CAT} $${TMPOPTIONSFILE} > ${OPTIONSFILE}; \ + ${CAT} $${TMPOPTIONSFILE} > ${OPTIONS_FILE}; \ fi; \ ${RM} -f $${TMPOPTIONSFILE} @cd ${.CURDIR} && ${MAKE} sanity-config @@ -6242,6 +6248,19 @@ rmconfig: ${RM} -f ${OPTIONSFILE}; \ ${RMDIR} $${optionsdir} 2>/dev/null || return 0; \ fi +.endif +.if exists(${OPTIONS_FILE}) + -@${ECHO_MSG} "===> Removing user-configured options for ${PKGNAME}"; \ + optionsdir=${OPTIONS_FILE}; optionsdir=$${optionsdir%/*}; \ + if [ ${UID} != 0 -a "x${INSTALL_AS_USER}" = "x" ]; then \ + ${ECHO_MSG} "===> Switching to root credentials to remove ${OPTIONS_FILE} and $${optionsdir}"; \ + ${SU_CMD} "${RM} -f ${OPTIONS_FILE} ; \ + ${RMDIR} $${optionsdir}"; \ + ${ECHO_MSG} "===> Returning to user credentials"; \ + else \ + ${RM} -f ${OPTIONS_FILE}; \ + ${RMDIR} $${optionsdir} 2>/dev/null || return 0; \ + fi .else @${ECHO_MSG} "===> No user-specified options configured for ${PKGNAME}" .endif |