Index: bsd.options.mk =================================================================== diff --git a/head/Mk/bsd.options.mk b/head/Mk/bsd.options.mk --- a/head/Mk/bsd.options.mk (revision 321710) +++ b/head/Mk/bsd.options.mk (working copy) @@ -75,7 +75,9 @@ .if !defined(OPTIONSMKINCLUDED) OPTIONSMKINCLUDED= bsd.options.mk +OPTIONS_NAME?= ${PKGORIGIN:S/\//_/} OPTIONSFILE?= ${PORT_DBDIR}/${UNIQUENAME}/options +OPTIONS_FILE?= ${PORT_DBDIR}/${OPTIONS_NAME}/options # Set the default values for the global options, as defined by portmgr .if !defined(NOPORTDOCS) @@ -162,6 +164,7 @@ NEW_OPTIONS:= ${NEW_OPTIONS:N${opt}} . endfor +# XXX To remove once UNIQUENAME will be removed ## Set the options specified per-port (set by user in make.conf) . for opt in ${${UNIQUENAME}_SET} . if !empty(COMPLETE_OPTIONS_LIST:M${opt}) @@ -175,7 +178,22 @@ PORT_OPTIONS:= ${PORT_OPTIONS:N${opt}} NEW_OPTIONS:= ${NEW_OPTIONS:N${opt}} . endfor +# XXX To remove once UNIQUENAME will be removed +## Set the options specified per-port (set by user in make.conf) +. for opt in ${${OPTIONS_NAME}_SET} +. if !empty(COMPLETE_OPTIONS_LIST:M${opt}) +PORT_OPTIONS+= ${opt} +. endif +. endfor +PORT_OPTIONS:= ${PORT_OPTIONS:O:u} + +## Unset the options excluded per-port (set by user in make.conf) +. for opt in ${${OPTIONS_NAME}_UNSET} +PORT_OPTIONS:= ${PORT_OPTIONS:N${opt}} +. endfor + +# XXX to remove once UNIQUENAME is removed ## options files (from dialog) . if exists(${OPTIONSFILE}) && !make(rmconfig) . include "${OPTIONSFILE}" @@ -183,7 +201,16 @@ . if exists(${OPTIONSFILE}.local) . include "${OPTIONSFILE}.local" . endif +# XXX to remove once UNIQUENAME is removed +## options files (from dialog) +. if exists(${OPTIONS_FILE}) && !make(rmconfig) +. include "${OPTIONS_FILE}" +. endif +. if exists(${OPTIONS_FILE}.local) +. include "${OPTIONS_FILE}.local" +. endif + ### convert WITH and WITHOUT found in make.conf or reloaded from old optionsfile .for opt in ${ALL_OPTIONS} .if defined(WITH_${opt}) Index: bsd.port.mk =================================================================== diff --git a/head/Mk/bsd.port.mk b/head/Mk/bsd.port.mk --- a/head/Mk/bsd.port.mk (revision 321737) +++ b/head/Mk/bsd.port.mk (working copy) @@ -1217,6 +1217,13 @@ # 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_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) @@ -6109,13 +6108,20 @@ @${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 @@ -6147,11 +6153,11 @@ 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 @@ -6245,6 +6251,19 @@ ${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