From owner-freebsd-ports@FreeBSD.ORG Fri Feb 11 14:02:34 2011 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 A84CA106566B for ; Fri, 11 Feb 2011 14:02:34 +0000 (UTC) (envelope-from demelier.david@gmail.com) Received: from mail-ew0-f54.google.com (mail-ew0-f54.google.com [209.85.215.54]) by mx1.freebsd.org (Postfix) with ESMTP id 36AF38FC18 for ; Fri, 11 Feb 2011 14:02:33 +0000 (UTC) Received: by ewy24 with SMTP id 24so1341283ewy.13 for ; Fri, 11 Feb 2011 06:02:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:message-id:date:from:user-agent:mime-version:to :subject:references:in-reply-to:content-type :content-transfer-encoding; bh=1ZmAUxDHylQHt1SiotcM+ncBxRxHzuPJAqdYZMA4/qU=; b=tZMuTn8VSdnltQqZdG/G4xwoQZoNK5MzsvMaEHRwIQlsss5rmLUdsqG8cj7nptLehD GMEs08fvmaZmMqSeWR63XSFPVWt+qW73+4DcaMZkSFy8ok6EP6bOPBINRSKQm3NpPIwP i4EPe0ZFNTIc+palHuOe5O2BxIwkbSmK/vesc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; b=S6PPPq8STaDh7/foF50tl3RXkxK8hkzEYi0sV1LKWhVquGOUqepViKInIB2kMhxwEV d3VhMLY2UrL+le0ZKko1YpeXuZnSiiRRkfCqXPkOFkQlIQnCtYEHSlpgQRToaYlLvyjX 5IcmJeVxR3BXhDemIMQf4AlZzVfjMvA+wAdZA= Received: by 10.223.125.196 with SMTP id z4mr253104far.124.1297414411197; Fri, 11 Feb 2011 00:53:31 -0800 (PST) Received: from Melon.malikania.fr (wifi-osiris-sec-182-223.u-strasbg.fr [130.79.182.223]) by mx.google.com with ESMTPS id y1sm211999fak.39.2011.02.11.00.53.28 (version=SSLv3 cipher=OTHER); Fri, 11 Feb 2011 00:53:29 -0800 (PST) Message-ID: <4D54F8F3.9080104@gmail.com> Date: Fri, 11 Feb 2011 09:53:07 +0100 From: David Demelier User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.2.13) Gecko/20110125 Thunderbird/3.1.7 MIME-Version: 1.0 To: freebsd-ports@freebsd.org References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [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: Fri, 11 Feb 2011 14:02:34 -0000 On 17/11/2010 15:58, Baptiste Daroussin wrote: > 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 > This is the best thing that could happens to the FreeBSD ports. Now the ports OPTIONS framework lacks a lot of feature. We can't select "only one" option in a list of (like pkgsrc does) and this new framework may provides this feature ! The group feature may helps in a backend dependency too! I really like this new framework and hope will be bring to ports before 2026 :-). Thanks bapt. -- David Demelier