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

[SCM] Debian package checker branch, master, updated. 2.5.6-36-g00e97c0



The following commit has been merged in the master branch:
commit 00e97c0b4a7a2350acfceee831976a5912dc5ed3
Author: Niels Thykier <niels@thykier.net>
Date:   Sun Apr 1 19:53:37 2012 +0200

    c/binaries: Move embedded library data to a data file
    
    Signed-off-by: Niels Thykier <niels@thykier.net>

diff --git a/checks/binaries b/checks/binaries
index 2117659..f93a0b9 100644
--- a/checks/binaries
+++ b/checks/binaries
@@ -77,49 +77,42 @@ our %ARCH_64BIT_EQUIVS = (
         'sparc'         => 'sparc64',
 );
 
-our %EMBEDDED_LIBRARIES = (
-        # We exclude version strings starting with "4 " since that's a mark of the
-        # Pascal implementation, which is not what this tag is designed to detect.
-        # (The "4" is actually the string length (52 characters) in the Pascal
-        # counted string format.)
-        'zlib'          => {
-                            source => qr'(?:zlib|klibc|kfreebsd-kernel-di-\w+)',
-                            match => qr'(?m)(?<!4 )(?:in|de)flate (?:\d[ \w.\-]{1,20}[\w.\-])'
-                           },
-
-        'bzip2'         => qr'(?m)^This is a bug in bzip2',
-        'expat'         => qr'(?m)^requested feature requires XML_DTD support in Expat',
-        'file'          => qr'(?m)^could not find any magic files',
-        'libxml2'       => qr'root and DTD name do not match',
-        'pcre3'         => qr'this version of PCRE is not compiled with PCRE_UTF8 support',
-        'tiff'          => {
-                            source => qr/tiff(?:\d+)?/,
-                            match => qr'No space for PixarLog state block',
-                           },
-        'ftgl'          => qr'FTGlyphContainer',
-        't1lib'         => qr't1lib is copyright \(c\) Rainer Menzner',
-        'gl2ps'         => qr'\(C\) 1999-2009 C\. Geuzaine',
-        'libgd2'        => qr'gd-(?:png|jpeg:) error:',
-        'ncurses'       => qr'Not enough memory to create terminal structure',
-        'openssl'       => qr'You need to read the OpenSSL FAQ',
-        'sqlite'        => {source => qr'sqlite3?', match => qr'CREATE TABLE sqlite_master\('},
-        'libm'          => {source => qr'eglibc', match => qr'neg\*\*non-integral: DOMAIN error'},
-        'ltdl'          => {source => qr'libtool', match => qr'(?m)^library already shutdown'},
-        'curl'          => qr'A libcurl function was given a bad argument',
-        'libmng'        => qr'TERM misplaced during creation of MNG stream',
-        'libmsn'        => qr'The MSN server has terminated the connection with an unknown reason code\.',
-        'libmikmod'     => qr'APUN \(APlayer\) and UNI \(MikMod\)',
-        'libmysqlclient'=> {source => qr'mysql-\d.*', match => qr'MySQL client ran out of memory'},
-        'libpng'        => qr'(?m)^Potential overflow in png_zalloc',
-        'libjpeg'       => { source => qr'^libjpeg.*',
-                             match => qr'(?m)^Caution: quantization tables are too coarse for baseline JPEG'},
-        'openjpeg'      => qr'tcd_decode: incomplete bistream',
-        'tinyxml'       => qr'Error when TiXmlDocument added to document',
-        'libpcap'       => qr'(?:pcap_activate: The "any" device isn\'t supported|corrupted frame on kernel ring mac offset)',
-        'glee'          => qr'Extension name exceeds 1023 characters.',
-        'glew'          => qr'Missing GL version',
-        'libtheora'     => qr'Xiph.Org libtheora ',
-);
+sub _embedded_libs {
+    my ($key, $val, undef) = @_;
+    my $result = {
+        'libname' => $key,
+    };
+    my ($opts, $regex) = split m/\|\|/, $val, 2;
+    if (!$regex) {
+        $regex = $opts;
+        $opts = '';
+    } else {
+        $opts=~ s/^\s++//o;
+        $opts=~ s/^\s++//o;
+        foreach my $optstr (split m/\s++/, $opts) {
+            my ($opt, $val) = split m/=/, $optstr, 2;
+            if ($opt eq 'source' or $opt eq 'libname') {
+                $result->{$opt} = $val;
+            } elsif ($opt eq 'source-regex') {
+                $result->{$opt} = qr/$val/;
+            } else {
+                fail "Unknown option $opt used for $key (in binaries/embedded-libs)";
+            }
+        }
+    }
+
+    if (defined $result->{'source'} and $result->{'source-regex'}) {
+        fail "Both source and source-regex used for $key (in binaries/embedded-libs)";
+    } else {
+        $result->{'source'} = $key unless defined $result->{'source'};
+    }
+
+    $result->{'match'} = qr/$regex/;
+
+    return $result;
+}
+
+our $EMBEDDED_LIBRARIES = Lintian::Data->new ('binaries/embedded-libs', qr/\s*+\|\|/, \&_embedded_libs);
 
 our $MULTIARCH_DIRS = Lintian::Data->new('binaries/multiarch-dirs', '\s+');
 
@@ -347,16 +340,15 @@ foreach my $file (@{$info->sorted_file_info}) {
         }
     }
 
-    while (my ($src, $regex) = each %EMBEDDED_LIBRARIES) {
-        if (ref $regex eq 'HASH') {
-            next if ($proc->pkg_src =~ m/^$regex->{'source'}$/);
-
-            $regex = $regex->{'match'};
-        } elsif ($proc->pkg_src eq $src) {
-            next;
+    foreach my $emlib ($EMBEDDED_LIBRARIES->all) {
+        my $ldata = $EMBEDDED_LIBRARIES->value ($emlib);
+        if ($ldata->{'source-regex'}) {
+            next if $proc->pkg_src =~ m/^$ldata->{'source-regex'}$/;
+        } else {
+            next if $proc->pkg_src eq $ldata->{'source'};
         }
-        if ($strings =~ /$regex/) {
-            tag 'embedded-library', "$file: $src";
+        if ($strings =~ $ldata->{'match'}) {
+            tag 'embedded-library', "$file: $ldata->{'libname'}";
         }
     }
 
diff --git a/data/binaries/embedded-libs b/data/binaries/embedded-libs
new file mode 100644
index 0000000..704f621
--- /dev/null
+++ b/data/binaries/embedded-libs
@@ -0,0 +1,75 @@
+# Manually maintained table of embedded libraries.
+#
+# Basic syntax:
+#   key ||<regex>
+#   key || [options] ||<regex>
+#
+# Where [options] is space separated list of:
+#
+#  source=<src>
+#     - If present, it declares that this library is built from the
+#       source package <src>
+#     - If both "source" and "source-regex" are omitted, then
+#       Lintian will defailt to using "source" with a value equal
+#       to the key.
+#     - Cannot be used with "source-regex"
+#
+#  source-regex=<srcregex>
+#     - If present, it declares that this library is built from (or
+#       expected in binaries build from) any source package, which
+#       name matches <srcregex>.
+#     - Cannot be used with "source"
+#
+#  libname=<name>
+#     - Declares the "name" of the library.
+#     - If omitted, the key will be used.
+#
+# Note: Avoid unintended leading and trailing whitespace in <regex>
+# as Lintian will assume such whitespace is a part of the regex.
+# If possible, consider using \s or [ ] to mark intended trailing
+# whitespace.
+#
+# If <regex> contains the separator (||), then the "options" part is
+# not optional.
+#
+# Please keep it sorted by key.
+#
+
+bzip2     ||(?m)^This is a bug in bzip2
+curl      ||A libcurl function was given a bad argument
+expat     ||(?m)^requested feature requires XML_DTD support in Expat
+file      ||(?m)^could not find any magic files
+ftgl      ||FTGlyphContainer
+gl2ps     ||\(C\) 1999-2009 C\. Geuzaine
+glee      ||Extension name exceeds 1023 characters\.
+glew      ||Missing GL version
+libgd2    ||gd-(?:png|jpeg:) error:
+libjpeg   ||source-regex=libjpeg.* ||(?m)^Caution: quantization tables are too coarse for baseline JPEG
+libm      ||source=eglibc ||neg\*\*non-integral: DOMAIN error
+libmng    ||TERM misplaced during creation of MNG stream
+libmsn    ||The MSN server has terminated the connection with an unknown reason code\.
+libmikmod ||APUN \(APlayer\) and UNI \(MikMod\)
+libmysqlclient ||source-regex=mysql-\d.* ||MySQL client ran out of memory
+libpcap   ||(?:pcap_activate: The "any" device isn\'t supported|corrupted frame on kernel ring mac offset)
+libpng    ||(?m)^Potential overflow in png_zalloc
+
+# Trailing whitespace was present when the file was created (see commit: 77fd246)
+libtheora ||Xiph.Org libtheora\s
+
+libxml2   ||root and DTD name do not match
+ltdl      ||source=libtool ||(?m)^library already shutdown
+ncurses   ||Not enough memory to create terminal structure
+openjpeg  ||tcd_decode: incomplete bistream
+openssl   ||You need to read the OpenSSL FAQ
+pcre3     ||this version of PCRE is not compiled with PCRE_UTF8 support
+sqlite    ||source-regex=sqlite3? ||CREATE TABLE sqlite_master\(
+t1lib     ||t1lib is copyright \(c\) Rainer Menzner
+tiff      ||source-regex=tiff\d* ||No space for PixarLog state block
+tinyxml   ||Error when TiXmlDocument added to document
+
+# We exclude version strings starting with "4 " since that's a mark of the
+# Pascal implementation, which is not what this tag is designed to detect.
+# (The "4" is actually the string length (52 characters) in the Pascal
+# counted string format.)
+zlib      ||source-regex=(?:zlib|klibc|kfreebsd-kernel-di\w+) ||(?m)(?<!4 )(?:in|de)flate (?:\d[ \w.\-]{1,20}[\w.\-])
+
diff --git a/debian/changelog b/debian/changelog
index adcd765..3278b31 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -26,6 +26,8 @@ lintian (2.5.7) UNRELEASED; urgency=low
   * checks/*:
     + [NT] Remove some old tags that are no longer useful.
       (Closes: #663516)
+  * checks/binaries:
+    + [NT] Move embedded library data to a data file.
   * checks/deb-format{,.desc}:
     + [NT] Replace old udeb compression tag with a more general
       one.  (Closes: #664600)
@@ -63,6 +65,9 @@ lintian (2.5.7) UNRELEASED; urgency=low
     + [NT] Replace all usage of objdump with readelf.
       (Closes: #614034)
 
+  * data/binaries/embedded-libs:
+    + [NT] New file.
+
   * frontend/lintian:
     + [JW] Fix typo in error message.
     + [JW,NT] Fix handling of "override" option in the lintianrc file.

-- 
Debian package checker


Reply to: