bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Friendlier gnulib-tool error messages with multiple incompatible mod


From: Bruno Haible
Subject: Re: Friendlier gnulib-tool error messages with multiple incompatible modules
Date: Thu, 25 Sep 2008 20:48:28 +0200
User-agent: KMail/1.5.4

Hi Derek,

> Anyone mind if I commit the attached patch?  It makes `gnulib-tool
> --update --lgpl' list all incompatible modules instead of breaking after
> the first one

This use-case is not very convincing, because
  1) gnulib-tool is not documented to accept the option --lgpl together with
     --update at all. (See "gnulib-tool --help".) Only
     "gnulib-tool --import --lgpl" makes sense.
  2) It is possible to get all the conflicts by using the --create-testdir
     option.

But I understand that some people may not think of the --create-testdir. So
ok, we can enhance --import to show all license incompatibilities.

> like so:
> 
> $ ../gnulib/gnulib-tool --update --lgpl
> gnulib-tool: *** incompatible license on modules:
> gnulib-tool: *** areadlink-with-size/GPL, canonicalize/GPL, chdir-long/GPL,

I have two objections against this output:
  1) The use of a slash is confusing. It makes people think that modules are
     directories with a file 'GPL' in it.
  2) The formatting is confusing and hard to process. In Unix, best output one
     item per line, so it can be filtered with 'grep', sorted with 'sort', etc.

> +func_wrap ()
> +{
> +  prefix=$2
> +  plen=`echo "$prefix" |wc -c`
> +  if test -z "$3"; then
> +    len=80
> +  fi
> +  len=`expr $len - $plen`
> +  echo "$1" |sed -e "s#.\\{1,$len\\} #&\\n$prefix#g" -e "s#^#$prefix&#"
> +}

This is an interesting use of 'sed'. Btw, I think it would be useful to have
a library of shell script functions, not limited to those needed by autoconf.
Is it possible to implement the entire 'fmt' in 'sed'?

I've applied this. It yields tabular formatting:

gnulib-tool: *** incompatible license on modules:
                 areadlink-with-size                               GPL
                 canonicalize                                      GPL
                 chdir-long                                        GPL
                 chown                                             GPL
                 ...
                 xstrndup                                          GPL
gnulib-tool: *** Stop.


2008-09-25  Derek Price  <address@hidden>
            Bruno Haible  <address@hidden>

        * gnulib-tool (func_import): Report all license incompatibilities, not
        just the first one.

*** gnulib-tool.orig    2008-09-25 20:30:06.000000000 +0200
--- gnulib-tool 2008-09-25 20:28:26.000000000 +0200
***************
*** 2516,2521 ****
--- 2516,2522 ----
  
    # If --lgpl, verify that the licenses of modules are compatible.
    if test -n "$lgpl"; then
+     license_incompatibilities=
      for module in $main_modules; do
        license=`func_get_license $module`
        case $license in
***************
*** 2526,2538 ****
              yes | 3)
                case $license in
                  LGPL | LGPLv2+) ;;
!                 *) func_fatal_error "incompatible license on module $module: 
$license" ;;
                esac
                ;;
              2)
                case $license in
                  LGPLv2+) ;;
!                 *) func_fatal_error "incompatible license on module $module: 
$license" ;;
                esac
                ;;
              *) func_fatal_error "invalid value lgpl=$lgpl" ;;
--- 2527,2539 ----
              yes | 3)
                case $license in
                  LGPL | LGPLv2+) ;;
!                 *) func_append license_incompatibilities "$module 
$license$nl" ;;
                esac
                ;;
              2)
                case $license in
                  LGPLv2+) ;;
!                 *) func_append license_incompatibilities "$module 
$license$nl" ;;
                esac
                ;;
              *) func_fatal_error "invalid value lgpl=$lgpl" ;;
***************
*** 2540,2545 ****
--- 2541,2553 ----
            ;;
        esac
      done
+     if test -n "$license_incompatibilities"; then
+       # Format the license incompatibilities as a table.
+       sed_expand_column1_width50_indent17='s,^\([^ ]*\) ,\1                   
                                ,
+ s,^\(.................................................[^ ]*\) *,              
   \1 ,'
+       license_incompatibilities=`echo "$license_incompatibilities" | sed -e 
"$sed_expand_column1_width50_indent17"`
+       func_fatal_error "incompatible license on 
modules:$nl$license_incompatibilities"
+     fi
    fi
  
    # Show banner notice of every module.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]