Baptiste Daroussin <b...@freebsd.org> wrote
  in <20130523054541.gh96...@ithaqua.etoilebsd.net>:

ba> hi,
ba>
ba> A lot of people seems to be complaining about the configuration dialog 
popping
ba> up all the time.
ba>
ba> What if we change the default behaviour to not pop up the dialog each time 
there
ba> is a changed option but only when the user explicitly type make config?
ba>
ba> Just a proposal, please give your opinion.
ba>
ba> Of course make config-recursive behaviour won't change.

 I am using the attached patch locally to make the four global knobs
 silent.  This is a kind of overkill, but "adding OPTIONS_NOMENU and
 making the do-config target skip the dialog invocation when all of
 values in OPTIONS_DEFINE are defined in OPTIONS_NOMENU" would be a
 compromise.  If one wants dialog for the global knobs, OPTIONS_NOMENU
 can always be redefined in make.conf.

 I think each port should define their knobs in OPTIONS_DEFINE even
 for global ones like DOCS because it is more consistent.

-- Hiroki
Index: Mk/bsd.port.mk
===================================================================
--- Mk/bsd.port.mk	(revision 317459)
+++ Mk/bsd.port.mk	(working copy)
@@ -6128,6 +6128,9 @@
 .undef opt
 .endif # pre-config

+OPTIONS_MENUTIMEOUT?=	5
+OPTIONS_NOMENU?=	DOCS NLS EXAMPLES IPV6
+TPUT_CMD?=	/usr/bin/tput
 .if !target(do-config)
 do-config:
 .if empty(ALL_OPTIONS) && empty(OPTIONS_SINGLE) && empty(OPTIONS_MULTI) && empty(OPTIONS_RADIO) && empty(OPTIONS_GROUP)
@@ -6144,13 +6147,41 @@
 	${MKDIR} $${optionsdir} 2> /dev/null) || \
 	(${ECHO_MSG} "===> Cannot create $${optionsdir}, check permissions"; exit 1)
 .endif
-	@TMPOPTIONSFILE=$$(mktemp -t portoptions); \
+	@if [ "${_RECURSIVE}" != 1 ]; then \
+		for opt in ${PORT_OPTIONS}; do \
+			oskip=0; \
+			for nom in ${OPTIONS_NOMENU}; do \
+				case $$opt in \
+				$$nom)	oskip=1 ;; \
+				esac; \
+			done; \
+			case $$oskip in \
+			0)	break ;; \
+			esac; \
+		done; \
+	else \
+		oskip=0; \
+	fi; \
+	if [ "$$oskip" = 1 ]; then \
+		trap "${TPUT_CMD} me" 1 2 3 5 10 13 15; \
+		${TPUT_CMD} md; \
+		${ECHO_MSG} "===> This port has user configuration options."; \
+		if read -t ${OPTIONS_MENUTIMEOUT} \
+		-p "===> To open the configuration menu, hit enter key in ${OPTIONS_MENUTIMEOUT} seconds." \
+		DUMMYARG; then \
+			oskip=0; \
+		fi; \
+		${TPUT_CMD} me; \
+	fi; \
+	TMPOPTIONSFILE=$$(mktemp -t portoptions); \
 	trap "${RM} -f $${TMPOPTIONSFILE}; exit 1" 1 2 3 5 10 13 15; \
+	if [ "$$oskip" = 0 ]; then \
 	${SETENV} ${D4P_ENV} ${SH} ${PORTSDIR}/Tools/scripts/dialog4ports.sh $${TMPOPTIONSFILE} || { \
 		${RM} -f $${TMPOPTIONSFILE}; \
 		${ECHO_MSG} "===> Options unchanged"; \
 		exit 0; \
 	}; \
+	fi; \
 	${ECHO_CMD}; \
 	if [ ! -e $${TMPOPTIONSFILE} ]; then \
 		${ECHO_MSG} "===> No user-specified options to save for ${PKGNAME}"; \
@@ -6196,7 +6227,7 @@
 config-recursive:
 	@${ECHO_MSG} "===> Setting user-specified options for ${PKGNAME} and dependencies";
 	@for dir in ${.CURDIR} $$(${ALL-DEPENDS-LIST}); do \
-		(cd $$dir; ${MAKE} config-conditional); \
+		(cd $$dir; ${MAKE} _RECURSIVE=1 config-conditional); \
 	done
 .endif # config-recursive

@@ -6204,7 +6235,7 @@
 config-conditional: pre-config
 .if defined(COMPLETE_OPTIONS_LIST) && !defined(NO_DIALOG)
 .  if !defined(_FILE_COMPLETE_OPTIONS_LIST) || ${COMPLETE_OPTIONS_LIST:O} != ${_FILE_COMPLETE_OPTIONS_LIST:O}
-	@cd ${.CURDIR} && ${MAKE} do-config;
+	@cd ${.CURDIR} && ${MAKE} _RECURSIVE=${_RECURSIVE} do-config;
 .  endif
 .endif
 .endif # config-conditional

Attachment: pgpQFe1esZUAw.pgp
Description: PGP signature

Reply via email to