From owner-freebsd-ports-bugs@FreeBSD.ORG Thu Nov 25 09:40:10 2010 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 38B9B1065754 for ; Thu, 25 Nov 2010 09:40:10 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 0A3988FC0A for ; Thu, 25 Nov 2010 09:40:10 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id oAP9e94V052305 for ; Thu, 25 Nov 2010 09:40:09 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id oAP9e9sK052304; Thu, 25 Nov 2010 09:40:09 GMT (envelope-from gnats) Resent-Date: Thu, 25 Nov 2010 09:40:09 GMT Resent-Message-Id: <201011250940.oAP9e9sK052304@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, bapt Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8F5C9106564A for ; Thu, 25 Nov 2010 09:38:02 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from red.freebsd.org (unknown [IPv6:2001:4f8:fff6::22]) by mx1.freebsd.org (Postfix) with ESMTP id 7ED028FC13 for ; Thu, 25 Nov 2010 09:38:02 +0000 (UTC) Received: from red.freebsd.org (localhost [127.0.0.1]) by red.freebsd.org (8.14.4/8.14.4) with ESMTP id oAP9c2q7061054 for ; Thu, 25 Nov 2010 09:38:02 GMT (envelope-from nobody@red.freebsd.org) Received: (from nobody@localhost) by red.freebsd.org (8.14.4/8.14.4/Submit) id oAP9c2kp061053; Thu, 25 Nov 2010 09:38:02 GMT (envelope-from nobody) Message-Id: <201011250938.oAP9c2kp061053@red.freebsd.org> Date: Thu, 25 Nov 2010 09:38:02 GMT From: bapt To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: ports/152568: New option framework proposal X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Nov 2010 09:40:10 -0000 >Number: 152568 >Category: ports >Synopsis: New option framework proposal >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 Nov 25 09:40:09 UTC 2010 >Closed-Date: >Last-Modified: >Originator: bapt >Release: 8.1-STABLE >Organization: >Environment: FreeBSD azathoth.lan 8.1-STABLE FreeBSD 8.1-STABLE #1 r214596M: Sun Oct 31 14:25:29 CET 2010 root@azathoth.lan:/usr/obj/usr/src/sys/AZATHOTH amd64 >Description: Here is a new option framework proposal. First the problem with the actual situation. the option framework has some problems : - for a given option we have two variable : WITH_OPT WITHOUT_OPT only having to check one will be great. - the option framework isn't consistent : if you set a WITH_BLA in /etc/make.conf, make config doesn't mind about it for example. So here is my proposal and a patch that implements it : for porters : 3 types of options : simple, group and list - simple options are the same as the current options (ie user can activate what ever they wants) - group options are options where at least one has to be set (1-N) - list options are options where only one has to be set and only one can be set (exclusive options) group and list can be conditionnal a maintainer can defined them it the ports and some can be defined system wide. every options can have a description but this is not mandatory. maintainer can set default options (DEFAULT_OPTS) and remove global options that the ports doesn't support yet OPTS_RM. in a ports how to define them like this OPTS= OPT1 OPT2 OPT3 OPTS_GROUP= GRP1 GRP2 OPTS_GROUP_GRP1= OPT4 OPT5 OPTS_GROUP_GRP2= OPT6 OPT7 OPTS_LIST= LIST1 OPTS_LIST_LIST1= OPT8 OTP9 OPT10 DEFAULT_OPTS= OPT2 OPT3 OPT9 OPT7 OPT8 OPT4 OPTS_RM= NLS NOPORTDOCS to define a desciption for a given option : OPT1_DESC= "Description of my option" To use conditionnal group or list just append to OPTS the name of the goup in that case the list ou group is checked only if the group name is activated by the user. make showoptions will present all the options and their descriptions : ===> The following configuration options are available: OPT1=off: Description of my option OPT2=on OPT3=on ====> Options available for the group GRP1: you have to choose at least one of them OPT4=on OPT5=off ====> Options available for the group GRP2: you have to choose at least one of them OPT6=off OPT7=on ====> Options available for the group LIST1: you have to select only one of them OPT8=on OPT9=off OPT10=off a user can set in make.conf global options for the whole ports : OPTS_SET= OPT1 OPT3 of unset them system wide OPTS_UNSET= OPT10 OPT15 per port options can be specified in two ways for a given ports : through /etc/make.conf: ${UNIQUENAME}_OPTS_SET= OPT1 ${UNIQUENAME}_OPTS_UNSET= OPT2 for zsh it would be: zsh_OPTS_SET= OPT1 zsh_OPTS_UNSET= OPT2 through /var/db/ports/${UNIQUENAME}/opts (in case we add a dialog like feature) OPTS_SET= OPT1 OPTS_UNSET= OPT2 The framework check how the options are set in the following way : 1/ set the default options has wanted by the maintainer 2/ override them using the system wide options (OPTS_(UN)SET) 3/ the per ports defined options in /var/db/ports/${UNIQUENAME}/opts 4/ the per ports defined options in make.conf ${UNIQUENAME}_OPTS_(UN)SET We can maintain some generic options descriptions like it is done in the KNOBS for the maintainer to check if an option is set or not, we do not need to choose between WITHOUT ou WITH option the options as to be checked that way: if !empty(PORTS_OPTS:MOPT1) @${ECHO_CMD} " the option OPT1 is set" .else @${ECHO_CMD} "the option OPT2 is not set" .endif the framework check (check-options) for the consitency for the options set (exclusive options and 1-n option) In the patch nothing is activated by default (user has make check-options himself currently) there is nothing to create /var/db/ports/${UNIQUENAME}/opts it don't really like having a gui for that but I understand some prefers so the framework option is already ready to have one. The new framework can live with the old one The implementation is really really simple. In the implementation I added 3 global options: NOPORTDOCS NOPORTDATA NOPORTEXAMPLES for description we could imagine something like Mk/bsd.options.desc.mk full of GTK2_DESC= add support for gtk ui MYSQL_DEC= add support for mysql sgdb and so on. A variable exists to override every options sets : OPTS_OVERRIDE if set for example in make -DOPTS_OVERRIDE="OPTS1" then the ports will only see OPTS1 as set and ignore all the other user settings. Variable names are temporary if you have better ideas :) I think it is quite easy to extend to add features later. http://people.freebsd.org/~bapt/ports-newopts.patch I also wrote a quick and dirty example based on the vim ports: http://people.freebsd.org/~bapt/vim-newopts.patch >How-To-Repeat: >Fix: >Release-Note: >Audit-Trail: >Unformatted: