ports/97125: automatically invalidate saved OPTIONS on change

Pav Lucistnik pav at FreeBSD.org
Thu May 11 09:20:16 UTC 2006


>Number:         97125
>Category:       ports
>Synopsis:       automatically invalidate saved OPTIONS on change
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Thu May 11 09:20:14 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     Pav Lucistnik
>Release:        FreeBSD 6.1-STABLE i386
>Organization:
>Environment:
System: FreeBSD pav.hide.vol.cz 6.1-STABLE FreeBSD 6.1-STABLE #0: Thu May 11 02:57:52 CEST 2006 root at pav.hide.vol.cz:/usr/obj/usr/src/sys/GENERIC i386

>Description:
Imagine this scenario:

1) User installs an OPTIONS using port, saving his settings
2) Maintainer updates the port, adding some new OPTIONS
3) User updates the port, the OPTIONS dialog is not presented, user misses
   newly added options.

Attached fix compares saved options with a present set of options in the port,
and displays the configuration dialog again when it detects an option which is
not present in the saved set.  The old saved options are retained.

>How-To-Repeat:
>Fix:

--- options-autoinvalidate.diff begins here ---
--- bsd.port.mk.orig	Wed May 10 23:31:23 2006
+++ bsd.port.mk	Thu May 11 10:15:20 2006
@@ -2940,8 +2940,7 @@
 #
 ################################################################
 .if (!defined(OPTIONS) || defined(CONFIG_DONE) || \
-	defined(PACKAGE_BUILDING) || defined(BATCH) || \
-	exists(${_OPTIONSFILE}) || exists(${_OPTIONSFILE}.local))
+	defined(PACKAGE_BUILDING) || defined(BATCH))
 _OPTIONS_OK=yes
 .endif
 
@@ -3800,7 +3799,7 @@
 .if !target(${target}) && defined(_OPTIONS_OK)
 ${target}: ${${target:U}_COOKIE}
 .elif !target(${target})
-${target}: config
+${target}: config-conditional
 	@cd ${.CURDIR} && ${MAKE} CONFIG_DONE=1 ${__softMAKEFLAGS} ${${target:U}_COOKIE}
 .elif target(${target}) && defined(IGNORE)
 .endif
@@ -5299,8 +5298,34 @@
 
 .if !target(config-conditional)
 config-conditional:
-.if defined(OPTIONS) && !exists(${_OPTIONSFILE})
+.if defined(OPTIONS)
+.if exists(${_OPTIONSFILE})
+# scan saved options and invalidate them, if the set of options does not match
+	@. ${_OPTIONSFILE}; \
+	set ${OPTIONS} XXX; \
+	while [ $$# -gt 3 ]; do \
+		withvar=WITH_$$1; \
+		withoutvar=WITHOUT_$$1; \
+		withval=$$(eval ${ECHO_CMD} $$\{$${withvar}\}); \
+		withoutval=$$(eval ${ECHO_CMD} $$\{$${withoutvar}\}); \
+		if [ ! -z "$${withval}" ]; then \
+			val=on; \
+		elif [ ! -z "$${withoutval}" ]; then \
+			val=off; \
+		else \
+			val=missing; \
+		fi; \
+		if [ "$${val}" = "missing" ]; then \
+			OPTIONS_INVALID=yes; \
+		fi; \
+		shift 3; \
+	done; \
+	if [ "$${OPTIONS_INVALID}" = "yes" ]; then \
+		cd ${.CURDIR} && ${MAKE} config; \
+	fi;
+.else
 	cd ${.CURDIR} && ${MAKE} config;
+.endif
 .endif
 .endif
 
--- options-autoinvalidate.diff ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list