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

Re: Licensecheck returns UNKOWN, but it's GPL



Hallo Luca,

Luca Niccoli <lultimouomo@gmail.com> wrote:
> Souce files of the program I'm packaging contain the following header:
>
> /* fswebcam - Small and simple webcam for *nix               */
> /*===========================================================*/
> /* Copyright (C)2005-2006 Philip Heron <phil@firestorm.cx>   */
> /*                                                           */
> /* This program is distributed under the terms of the GNU    */
> /* General Public License, version 2. You may use, modify,   */
> /* and redistribute it under the terms of this license. A    */
> /* copy should be included with this source.                 */
>
> which isn't recognised as a GPL license statement by licensecheck.
> What should I do?
> Simply ignore it, file a bug against licensecheck,

It's a bug in licensecheck. It doesn't handle the C comments and sees
“GNU / General Public License.” It must remove the comments, before it
removes the character *, because after this it will not know if a single
slash was a single slash or part of a C comment.

#v+
--- /usr/bin/licensecheck       2009-01-22 20:34:36.000000000 +0100
+++ /tmp/licensecheck   2009-01-31 13:03:45.445308037 +0100
@@ -283,8 +283,8 @@
        if $opt_verbose;
 
     $content =~ tr/\t\r\n/ /;
+    $content =~ s#(:?\*/|/[/\*])##g;
     $content =~ tr% A-Za-z.,@;0-9\(\)/-%%cd;
-    $content =~ s#//##g;
     $content =~ s/ c //g; # Remove fortran comments
     $content =~ tr/ //s;
 
#v-

But the parsing of the license text can also be improved.

#v+
--- /usr/bin/licensecheck       2009-01-22 20:34:36.000000000 +0100
+++ /tmp/licensecheck   2009-01-31 13:03:45.445308037 +0100
@@ -406,8 +406,12 @@
        $license = "GPL$gplver$extrainfo $license";
     }
 
-    if ($licensetext =~ /is distributed.*terms.*GPL/) {
-       $license = "GPL (unversioned/unknown version) $license";
+    if ($licensetext =~ /is distributed.*terms.*(:?GPL|GNU General Public License)/) {
+        if ($licensetext =~ /version ([\d.]*)/) {
+            $license = "GPLv$1 $license";
+        } else {
+            $license = "GPL (unversioned/unknown version) $license";
+        }
     }
 
     if ($licensetext =~ /This file is part of the .*Qt GUI Toolkit. This file may be distributed under the ter
#v-

Bye, Jörg.
-- 
Mathematiker beim Kuchenessen (aus dem wahren Leben):
J: Du überlegst wohl, wie du das Stück optimal teilst?
K: Ja, ich wende gerade den Simplex‐Algorithmus darauf an.
C: Schau mal, da hast du schon vier Ecken.


Reply to: