[pacman-dev] [PATCH] makepkg - add check for valid options in PKGBUILD

Allan McRae mcrae_allan at hotmail.com
Mon May 12 11:03:46 EDT 2008


Xavier wrote:
> On Mon, May 12, 2008 at 4:35 PM, Allan McRae <mcrae_allan at hotmail.com> wrote:
>   
>>  Unknown and depreciated options are upgraded to error conditions.
>>
>>  +known_options=('strip' 'docs' 'libtool' 'emptydirs' 'ccache' 'distcc' 'makeflags' 'force')
>>  +valid_options=0
>>  +for opt in ${options[@]}; do
>>  +       known=1
>>  +       for kopt in ${known_options[@]}; do
>>  +               if [ "${opt}" = "${kopt}" -o "${opt}" = "!${kopt}" ]; then
>>  +                       known=0
>>  +               fi
>>  +       done
>>  +       if [ $known -eq 1 ]; then
>>  +               error "$(gettext "Unknown option '%s'")" "$opt"
>>  +               valid_options=1
>>  +       fi
>>  +done
>>  +if [ $valid_options -eq 1 ]; then
>>  +       exit 1
>>  +fi
>>  +
>>     
>
> I see how this can be useful. I still find it a bit disappointing to
> have to maintain a list of valid options but I don't know..
>   

 From experience, if we are going to remove the depreciated options we 
need to enforce it.  There are still 77 packages in extra using 
'nolibtool', some of which I am sure were updated recently.  1 still 
uses keepdocs.  Without this, the packages will get updated and these 
will get overlooked.  It is also good for catching spelling mistakes.

> Btw, if this is for master, you forgot that one:
> http://projects.archlinux.org/?p=pacman.git;a=commitdiff;h=dae3f9deefdb86f726a68dc89a7391e9df7517df
>
>   

So I did...  I can see how having to maintain the list of options could 
cause trouble!  But I can't think of another way to do this.

Updated version of the patch will arrive tomorrow.

Allan







More information about the pacman-dev mailing list