Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 11 Feb 2011 13:11:42 +0100
From:      David Demelier <demelier.david@gmail.com>
To:        Baptiste Daroussin <baptiste.daroussin@gmail.com>
Cc:        freebsd-ports@freebsd.org, portmgr@freebsd.org
Subject:   Re: [PATCH] Proposal for a new option framework
Message-ID:  <4D55277E.7020701@gmail.com>
In-Reply-To: <AANLkTik0%2BnQ3xLJhofbxQsJjXPoSGRM-3fhCXv5SCORW@mail.gmail.com>
References:  <AANLkTik0%2BnQ3xLJhofbxQsJjXPoSGRM-3fhCXv5SCORW@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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
>
> regards,
> Bapt
> _______________________________________________
> freebsd-ports@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-ports
> To unsubscribe, send any mail to "freebsd-ports-unsubscribe@freebsd.org"

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4D55277E.7020701>