On Tue, 2006-11-14 at 12:07 +0100, Bruno Haible wrote:
> Yoann Vandoorselaere wrote:
> > The following modules are licensed under GPL but used by LGPL modules:
> > 
> > - c-ctype: used by c-strcase, c-strcasestr, linebreak.
> 
> I'm changing the copyright of c-ctype to LGPL:

Thanks!

> > As new dependencies get introduced to existing GnuLib modules, it would
> > be nice to have a tool that automatically check that LGPL modules
> > doesn't depend on GPL modules
> 
> Yes, I agree. Do you have time to add such a test to gnulib-tool's
> func_create_testdir?

Patch attached (note: I'm not very good at shell programming).

The patch work for --create-testdir with or without argument. 

The code consider an incompatible module license as a fatal error, thus
it will stop importing at that point. 

Changing 'func_fatal_error' to 'echo' permit to retrieve a list of
incompatible license dependencies:

$ ./gnulib-tool --dir test --create-testdir 
warning: module argp depend on another module with incompatible license: dirname
warning: module argp depend on another module with incompatible license: exit
warning: module argp depend on another module with incompatible license: 
exitfail
warning: module argp depend on another module with incompatible license: inline
warning: module argp depend on another module with incompatible license: xalloc
warning: module argp depend on another module with incompatible license: 
xalloc-die
warning: module argp depend on another module with incompatible license: 
xstrndup
warning: module canon-host depend on another module with incompatible license: 
intprops
warning: module canon-host depend on another module with incompatible license: 
inttostr
warning: module euidaccess depend on another module with incompatible license: 
exit
warning: module euidaccess depend on another module with incompatible license: 
exitfail
warning: module euidaccess depend on another module with incompatible license: 
group-member
warning: module euidaccess depend on another module with incompatible license: 
inline
warning: module euidaccess depend on another module with incompatible license: 
xalloc
warning: module euidaccess depend on another module with incompatible license: 
xalloc-die
warning: module fts-lgpl depend on another module with incompatible license: 
chdir-long
warning: module fts-lgpl depend on another module with incompatible license: 
chown
warning: module fts-lgpl depend on another module with incompatible license: 
d-ino
warning: module fts-lgpl depend on another module with incompatible license: 
dirname
warning: module fts-lgpl depend on another module with incompatible license: 
exit
warning: module fts-lgpl depend on another module with incompatible license: 
exitfail
warning: module fts-lgpl depend on another module with incompatible license: 
fcntl-safer
warning: module fts-lgpl depend on another module with incompatible license: 
getcwd
warning: module fts-lgpl depend on another module with incompatible license: 
inline
warning: module fts-lgpl depend on another module with incompatible license: 
intprops
warning: module fts-lgpl depend on another module with incompatible license: 
lchown
warning: module fts-lgpl depend on another module with incompatible license: 
openat
warning: module fts-lgpl depend on another module with incompatible license: 
save-cwd
warning: module fts-lgpl depend on another module with incompatible license: 
unistd-safer
warning: module fts-lgpl depend on another module with incompatible license: 
xalloc
warning: module fts-lgpl depend on another module with incompatible license: 
xalloc-die
warning: module fts-lgpl depend on another module with incompatible license: 
xgetcwd
warning: module fts-lgpl depend on another module with incompatible license: 
xstrndup
warning: module getaddrinfo depend on another module with incompatible license: 
intprops
warning: module getaddrinfo depend on another module with incompatible license: 
inttostr
warning: module glob depend on another module with incompatible license: d-type
warning: module mkdtemp depend on another module with incompatible license: 
tempname
warning: module obstack depend on another module with incompatible license: exit
warning: module obstack depend on another module with incompatible license: 
exitfail

-- 
Yoann Vandoorselaere | Responsable R&D / CTO | PreludeIDS Technologies
Tel: +33 (0)8 70 70 21 58                  Fax: +33(0)4 78 42 21 58
http://www.prelude-ids.com
Index: gnulib-tool
===================================================================
RCS file: /cvsroot/gnulib/gnulib/gnulib-tool,v
retrieving revision 1.196
diff -u -r1.196 gnulib-tool
--- gnulib-tool	14 Nov 2006 09:37:20 -0000	1.196
+++ gnulib-tool	14 Nov 2006 12:01:11 -0000
@@ -2254,6 +2254,32 @@
   testsbase=gltests
   macro_prefix=gl
 
+  # Check module license
+  for imported_module in $modules; do 
+    license=`func_get_license $imported_module`
+    if test "$license" = "LGPL"; then
+      lgpl=true
+    else
+      lgpl=
+    fi
+
+    # Get dependencies for the current module.
+    modules=$imported_module
+    func_modules_transitive_closure
+
+    # Verify that the licenses of modules are compatible.
+    if test -n "$lgpl"; then
+      for module in $modules; do
+        license=`func_get_license $module`
+        case $license in
+          LGPL | 'GPLed build tool') ;;
+          'public domain' | 'unlimited' | 'unmodifiable license text') ;;
+        *) func_fatal_error "warning: module $imported_module depend on another module with incompatible license: $module" ;;
+        esac
+      done
+    fi
+  done
+
   # Determine final module list.
   func_modules_transitive_closure
   echo "Module list with included dependencies:"

Reply via email to