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

[SCM] Debian package checker branch, master, updated. 2.2.6-7-gff42008



The following commit has been merged in the master branch:
commit ff4200803d6ff1211640327968531ffc4fd7966b
Author: Adam D. Barratt <adam@adam-barratt.org.uk>
Date:   Thu Feb 26 20:50:52 2009 +0000

    Handle ORed depencies in symbols files.
    
    Extend the parsing of dependency templates in symbols files to handle
    ORed dependencies.
    
    Also take the opportunity to restructure the code and make it more readable
    and robust.

diff --git a/checks/shared-libs b/checks/shared-libs
index 288c4f2..c727291 100644
--- a/checks/shared-libs
+++ b/checks/shared-libs
@@ -359,46 +359,68 @@ if ($#shlibs == -1 and not %unversioned_shlibs) {
     my @symbols_depends;
     my $dep_templates = 0;
     my $meta_info_seen = 0;
+    my $warned = 0;
     my $symbol_count = 0;
 
     while (<IN>) {
 	chomp;
 	next if m/^\s*$/ or /^#/;
 
-	if (m/^([^\s|*]\S+)\s(\S+)(?:\s(\S+))?/) {
+	if (m/^([^\s|*]\S+)\s\S+\s*(\(\S+\s+\S+\)|#MINVER#)?/) {
 	    # soname, main dependency template
 
-	    ($soname, $dep_package, $dep) = ($1, $2, $3);
-	    $dep ||= '';
+	    $soname = $1;
+	    s/^$soname\s*//;
 	    $soname = format_soname($soname);
 
 	    if ($symbols_control{$soname}) {
 		tag "duplicate-entry-in-symbols-control-file", $soname;
 	    } else {
 		$symbols_control{$soname} = 1;
-		push @symbols_depends, $dep_package . ' ' . $dep;
+		$warned = 0;
+
+		foreach my $part (split /\s*,\s*/) {
+		    foreach my $subpart (split /\s*\|\s*/, $part) {
+			$subpart =~ m,^(\S+)\s*(\(\S+\s+\S+\)|#MINVER#)?$,;
+			($dep_package, $dep) = ($1, $2 || '');
+			if (defined $dep_package) {
+			    push @symbols_depends, $dep_package . ' ' . $dep;
+			} else {
+			    tag "syntax-error-in-symbols-file", $.
+				unless $warned;
+			    $warned = 1;
+			}
+		    }
+		}
 	    }
 
 	    $dep_templates = 0;
 	    $meta_info_seen = 0;
 	    $symbol_count = 0;
-	} elsif (m/^\|\s+(\S+)(?:\s(\S+\s\S+))?(\s*,\s+\S+(\s\S+\s\S+)?)*$/) {
-	    # alternative dependency template
+	} elsif (m/^\|\s+\S+\s*(\(\S+\s+\S+\)|#MINVER#)?/) {
+	    $warned = 0;
 
 	    if ($meta_info_seen or not defined $soname) {
 		tag "syntax-error-in-symbols-file", $.;
+		$warned = 1;
 	    }
 
-	    ($dep_package, $dep) = ($1, $2 || '');
-	    push @symbols_depends, $dep_package . ' ' . $dep;
-	    if (defined $3) {
-		my $deps = $3;
-		while ($deps =~ m/\s*,\s+(\S+)(?:\s(\S+\s\S+))?/g) {
+	    s/^\|\s*//;
+
+	    foreach my $part (split /\s*,\s*/) {
+		foreach my $subpart (split /\s*\|\s*/, $part) {
+		    $subpart =~ m,^(\S+)\s*(\(\S+\s+\S+\)|#MINVER#)?$,;
 		    ($dep_package, $dep) = ($1, $2 || '');
-		    push @symbols_depends, $dep_package . ' '. $dep;
+		    if (defined $dep_package) {
+			push @symbols_depends, $dep_package . ' ' . $dep;
+		    } else {
+			tag "syntax-error-in-symbols-file", $. unless $warned;
+			$warned = 1;
+		    }
 		}
 	    }
-	    $dep_templates++;
+
+	    $dep_templates++ unless $warned;
 	} elsif (m/^\*\s(\S+):\s(\S+)/) {
 	    # meta-information
 
diff --git a/debian/changelog b/debian/changelog
index 775edd1..a3bc100 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -17,6 +17,8 @@ lintian (2.2.7) UNRELEASED; urgency=low
       the symbol list.  The code that was intended to check this resulted
       in a false positive syntax error being generated if a file with
       alternative dependency templates used meta-information.
+    + [ADB] Extend the parsing of dependency templates in symbols files to
+      handle ORed dependencies.
 
   * debian/control:
     + [CW] Depend on man-db (>= 2.4.0) for '-E UTF-8'.
diff --git a/testset/debug/debian/_symbols b/testset/debug/debian/_symbols
index e9ec69c..46e6af1 100644
--- a/testset/debug/debian/_symbols
+++ b/testset/debug/debian/_symbols
@@ -4,11 +4,12 @@
  and so should this
 
 libhello.so.0 libhello0 #MINVER#
-| libhello0c2 (>= 1.2), libhelloc0c2 (<< 1.3)
+| libhello0c2 (>= 1.2) , libhelloc0c2 (<< 1.3)
+| hello-dbg3| libhelloc0c3|foobar (= 1.2) |hello-dbg2
 | hello-dbg
  hello@Base 1.0
 * Build-Dep-Foo: bar
- hello2@Base 2.0 3
+ hello2@Base 2.0 4
  hello3@Base 2.0 1
  hello3@Base 2.0 A
  dummy
diff --git a/testset/tags.debug b/testset/tags.debug
index 674bbe4..3d77239 100644
--- a/testset/tags.debug
+++ b/testset/tags.debug
@@ -8,17 +8,17 @@ E: libhello0-dbg: binary-with-bad-dynamic-table ./usr/lib/libhello.so.dbg
 E: libhello0-dbg: missing-dependency-on-libc needed by ./usr/lib/debug/lib/libhello.so.0.0 and 1 others
 E: libhello0-dbg: sharedobject-in-library-directory-missing-soname usr/lib/libhello.so.dbg
 E: libhello0: duplicate-entry-in-symbols-control-file libhello 0
-E: libhello0: invalid-template-id-in-symbols-file 11
-E: libhello0: invalid-template-id-in-symbols-file 13
+E: libhello0: invalid-template-id-in-symbols-file 12
+E: libhello0: invalid-template-id-in-symbols-file 14
 E: libhello0: invalid-template-id-in-symbols-file 4
 E: libhello0: symbols-declared-but-not-shlib libhello 2
 E: libhello0: syntax-error-in-symbols-file 1
-E: libhello0: syntax-error-in-symbols-file 10
-E: libhello0: syntax-error-in-symbols-file 14
-E: libhello0: syntax-error-in-symbols-file 18
+E: libhello0: syntax-error-in-symbols-file 11
+E: libhello0: syntax-error-in-symbols-file 15
+E: libhello0: syntax-error-in-symbols-file 19
 E: libhello0: syntax-error-in-symbols-file 3
 E: libhello0: syntax-error-in-symbols-file 4
-E: libhello0: unknown-meta-field-in-symbols-file Build-Dep-Foo, line 10
+E: libhello0: unknown-meta-field-in-symbols-file Build-Dep-Foo, line 11
 W: debug source: ancient-standards-version 3.7.0 (current is 3.8.0)
 W: debug source: changelog-should-not-mention-nmu
 W: debug source: dbg-package-missing-depends hi-dbg
@@ -35,9 +35,13 @@ W: libhello0-dbg: debug-file-should-use-detached-symbols ./usr/lib/debug/lib/lib
 W: libhello0-dbg: latest-debian-changelog-entry-without-new-version
 W: libhello0-dbg: shared-lib-without-dependency-information ./usr/lib/libhello.so.dbg
 W: libhello0: latest-debian-changelog-entry-without-new-version
+W: libhello0: symbols-declares-dependency-on-other-package foobar (= 1.2)
 W: libhello0: symbols-declares-dependency-on-other-package hello-dbg 
+W: libhello0: symbols-declares-dependency-on-other-package hello-dbg2 
+W: libhello0: symbols-declares-dependency-on-other-package hello-dbg3 
 W: libhello0: symbols-declares-dependency-on-other-package libhello0c2 (>= 1.2)
 W: libhello0: symbols-declares-dependency-on-other-package libhello2 #MINVER#
 W: libhello0: symbols-declares-dependency-on-other-package libhello2 (>= 1:2.3)
 W: libhello0: symbols-declares-dependency-on-other-package libhelloc0c2 (<< 1.3)
+W: libhello0: symbols-declares-dependency-on-other-package libhelloc0c3 
 W: libhello0: unused-shlib-entry-in-symbols-control-file libhello 2

-- 
Debian package checker


Reply to: