From owner-freebsd-ports@FreeBSD.ORG Wed Nov 17 15:22:14 2010 Return-Path: Delivered-To: freebsd-ports@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4880E106564A; Wed, 17 Nov 2010 15:22:14 +0000 (UTC) (envelope-from baptiste.daroussin@gmail.com) Received: from mail-gx0-f182.google.com (mail-gx0-f182.google.com [209.85.161.182]) by mx1.freebsd.org (Postfix) with ESMTP id E918C8FC1C; Wed, 17 Nov 2010 15:22:13 +0000 (UTC) Received: by gxk9 with SMTP id 9so1173195gxk.13 for ; Wed, 17 Nov 2010 07:22:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:date:message-id :subject:from:to:content-type; bh=GNGiK9kwJ3GFeBrZZzwd/a29L5KG9yCuj58XO+rBkzY=; b=ubLO8G9agiIMdqb7NIs1XR/0LpYkiEzPq+1NUpnFh39uh6oZ2WNzCgCWgvqp+ajY+/ 3H0a2XBQCddrdlcHoCGgiOrV4L8glXvISU/DhZj8AkAjWKf7f1MEx9U+OitgQ8k64PP7 ZD68aXqQE3IlPFsGeTpbFY5kUCSRGwFXKVjHs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=SbFMFwKaEbQyJSNN/hF/6dP9XQdYK7lD09BCWoWMn3whZF28KT/5bl3fcwSd4Rm4bl o7r7aMmn3rt9mG/aXiYXCqlLWblPu+ROeSDdqUGNaD9o3IdhK9MHsUHiWtu2cFC8gaR3 n5gEcmyttzdOcDp+TFisd37UzHnIyH3W9/5Mc= MIME-Version: 1.0 Received: by 10.231.17.1 with SMTP id q1mr7134040iba.153.1290005893644; Wed, 17 Nov 2010 06:58:13 -0800 (PST) Received: by 10.231.180.164 with HTTP; Wed, 17 Nov 2010 06:58:13 -0800 (PST) Date: Wed, 17 Nov 2010 15:58:13 +0100 Message-ID: From: Baptiste Daroussin To: freebsd-ports@freebsd.org, portmgr@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Cc: Subject: [PATCH] Proposal for a new option framework X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Nov 2010 15:22:14 -0000 Hi all, I'd like to expose you a new proposal for the framework option. 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) 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" 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 options OPT1 is set" .else @${ECHO_CMD} "the options 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 and I am checking how to make dialog4ports able to do the job. 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 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 regards, Bapt