From owner-svn-ports-head@FreeBSD.ORG Wed Jun 26 07:22:07 2013 Return-Path: Delivered-To: svn-ports-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 9DEC9A8E; Wed, 26 Jun 2013 07:22:07 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 90F2C12A6; Wed, 26 Jun 2013 07:22:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5Q7M767031994; Wed, 26 Jun 2013 07:22:07 GMT (envelope-from bapt@svn.freebsd.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5Q7M7pV031992; Wed, 26 Jun 2013 07:22:07 GMT (envelope-from bapt@svn.freebsd.org) Message-Id: <201306260722.r5Q7M7pV031992@svn.freebsd.org> From: Baptiste Daroussin Date: Wed, 26 Jun 2013 07:22:07 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r321785 - head/Mk X-SVN-Group: ports-head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the ports tree for head List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jun 2013 07:22:07 -0000 Author: bapt Date: Wed Jun 26 07:22:06 2013 New Revision: 321785 URL: http://svnweb.freebsd.org/changeset/ports/321785 Log: 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 Modified: head/Mk/bsd.options.mk head/Mk/bsd.port.mk Modified: head/Mk/bsd.options.mk ============================================================================== --- head/Mk/bsd.options.mk Wed Jun 26 07:10:28 2013 (r321784) +++ head/Mk/bsd.options.mk Wed Jun 26 07:22:06 2013 (r321785) @@ -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 @@ 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 ${${UNIQUENAME}_SET} . if !empty(COMPLETE_OPTIONS_LIST:M${opt}) @@ -175,7 +178,22 @@ NEW_OPTIONS:= ${NEW_OPTIONS:N${opt}} 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,6 +201,15 @@ NEW_OPTIONS:= ${NEW_OPTIONS:N${opt}} . 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} Modified: head/Mk/bsd.port.mk ============================================================================== --- head/Mk/bsd.port.mk Wed Jun 26 07:10:28 2013 (r321784) +++ head/Mk/bsd.port.mk Wed Jun 26 07:22:06 2013 (r321785) @@ -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