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

[SCM] Debian package checker branch, master, updated. 2.5.4-50-g70b8550



The following commit has been merged in the master branch:
commit 70b855067788c64bee8d423e33ec1c5d595d7580
Author: Niels Thykier <niels@thykier.net>
Date:   Wed Dec 21 15:36:25 2011 +0100

    Implemented a simple file-conflict check in group-checks
    
    Most test are solved properly.  Though in a few cases, conflicts
    have been (ab)used.
    
    Signed-off-by: Niels Thykier <niels@thykier.net>

diff --git a/checks/group-checks b/checks/group-checks
index 13e0365..ccf6d3b 100644
--- a/checks/group-checks
+++ b/checks/group-checks
@@ -47,8 +47,11 @@ my @nodes = ();
 my %edges = ();
 my $sccs;
 my $ginfo = $group->info;
+my @procs = $group->get_processables ('binary');
 
-foreach my $proc ($group->get_processables('binary')) {
+_check_file_overlap (@procs);
+
+foreach my $proc (@procs) {
     my $deps = $ginfo->direct_dependencies ($proc);
     if (scalar @$deps > 0) {
         # it depends on another package - it can cause
@@ -96,6 +99,51 @@ sub _check_priorities {
     }
 }
 
+sub _check_file_overlap {
+    my (@procs) = @_;
+    # Sort them for stable output
+    my @sorted = sort { $a->pkg_name cmp $b->pkg_name } @procs;
+    for (my $i = 0 ; $i < scalar @sorted ; $i++) {
+        my $proc = $sorted[$i];
+        my $pinfo = $proc->info;
+        for (my $j = $i ; $j < scalar @sorted ; $j++) {
+            my $other = $sorted[$j];
+            my $oinfo = $other->info;
+            # poor man's "Multi-arch: same" work-around.
+            next if $proc->pkg_name eq $other->pkg_name;
+
+            # $other conflicts/replaces with $proc
+            next if $oinfo->relation ('conflicts')->implies ($proc->pkg_name);
+            next if $oinfo->relation ('replaces')->implies ($proc->pkg_name);
+
+            # $proc conflicts/replaces with $other
+            next if $pinfo->relation ('conflicts')->implies ($other->pkg_name);
+            next if $pinfo->relation ('replaces')->implies ($other->pkg_name);
+
+            _overlap_check ($proc, $pinfo, $other, $oinfo);
+        }
+    }
+}
+
+sub _overlap_check {
+    my ($a_proc, $a_info, $b_proc, $b_info) = @_;
+    my $b_index = $b_info->index;
+    foreach my $raw (@{ $a_info->sorted_index }) {
+        my $file;
+        my $a_file;
+        my $b_file;
+        next unless $raw;
+        $file = $raw; # copy, because we have to modifiy it
+        $file =~ s,/$,,o;
+        $b_file = $b_index->{$file} // $b_index->{"$file/"};
+        if ($b_file) {
+            $a_file = $a_info->index->{$file} // $a_info->index->{"$file/"};
+            next if $a_file->{type} eq $b_file->{type} && $a_file->{type} eq 'd';
+            tag 'binaries-have-file-conflict', $a_proc->pkg_name, $b_proc->pkg_name, $file;
+        }
+    }
+}
+
 ## Encapsulate Tarjan's algorithm in an class/object to keep
 ## the run sub somewhat sane.
 package Lintian::group_checks::Graph;
diff --git a/checks/group-checks.desc b/checks/group-checks.desc
index b31ed54..4f71c6b 100644
--- a/checks/group-checks.desc
+++ b/checks/group-checks.desc
@@ -33,3 +33,14 @@ Info: The package depends on a package with lower priority than
  package.  A full check of all dependencies built from different
  source packages is beyond the scope of Lintian.  The depcheck service
  can do this.
+
+Tag: binaries-have-file-conflict
+Severity: normal
+Certainty: possible
+Experimental: no
+Info: The binaries appears to have overlapping files without proper
+ conflicts relation.
+ .
+ Note the check is completely based on the file index for the
+ packages.  Possible known false-positives include dpkg-diverts in
+ maintainer scripts.
diff --git a/debian/changelog b/debian/changelog
index 7eb6df8..227ae18 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -32,6 +32,9 @@ lintian (2.5.5) UNRELEASED; urgency=low
     + [NT] Allow fonts in packages starting with "fonts-".  This
       completes the fix for #646838.  Thanks to أحمد المحمودي
       for the follow up report.  (Closes: #651045)
+  * checks/group-check{,.desc}:
+    + [NT] Check for file conflicts in binaries built from the same
+      source package.  (Closes: #293838)
   * checks/nmu:
     + [JW] Properly handle uploader names with commas.
   * checks/scripts:
diff --git a/t/tests/files-fonts/debian/debian/control.in b/t/tests/files-fonts/debian/debian/control.in
index 15cef41..2fe3f15 100644
--- a/t/tests/files-fonts/debian/debian/control.in
+++ b/t/tests/files-fonts/debian/debian/control.in
@@ -18,6 +18,8 @@ Description: {$description}
 
 Package: ttf-{$srcpkg}
 Architecture: {$architecture}
+# Due to file-conflict
+Conflicts: {$srcpkg}
 Depends: $\{misc:Depends\}
 Description: {$description} (okay)
  Font package containing fonts.
diff --git a/t/tests/files-games-section/debian/debian/control.in b/t/tests/files-games-section/debian/debian/control.in
index 95d4a37..43ef52a 100644
--- a/t/tests/files-games-section/debian/debian/control.in
+++ b/t/tests/files-games-section/debian/debian/control.in
@@ -8,6 +8,7 @@ Build-Depends: debhelper (>= 7)
 Package: {$srcpkg}-both
 Architecture: {$architecture}
 Depends: $\{shlibs:Depends\}, $\{misc:Depends\}
+Conflicts: {$srcpkg}-good, {$srcpkg}-wrong, {$srcpkg}-no-games
 Description: {$description} (both)
  Package has both regular binaries and games.
  .
@@ -39,6 +40,7 @@ Package: {$srcpkg}-wrong
 Section: devel
 Architecture: {$architecture}
 Depends: $\{shlibs:Depends\}, $\{misc:Depends\}
+Conflicts: {$srcpkg}-good
 Description: {$description} (wrong)
  Games package in wrong section.
  .
diff --git a/t/tests/menu-format-general/debian/Makefile b/t/tests/menu-format-general/debian/Makefile
index a483ab9..2754f69 100644
--- a/t/tests/menu-format-general/debian/Makefile
+++ b/t/tests/menu-format-general/debian/Makefile
@@ -1,5 +1,11 @@
 all: pargs
+	sed s/pargs/pargs-broken/ pargs > pargs-broken
+	sed s/pargs/pargs-section/ pargs > pargs-section
 	pod2man --section=1 pargs pargs.1
+	pod2man --section=1 pargs-broken pargs-broken.1
+	pod2man --section=1 pargs-section pargs-section.1
+
 
 clean:
-	rm -f pargs.1
+	rm -f pargs*.1
+	rm -f pargs-*
diff --git a/t/tests/menu-format-general/debian/debian/menu-broken.install b/t/tests/menu-format-general/debian/debian/menu-broken.install
index bf2c0f6..f352ad9 100644
--- a/t/tests/menu-format-general/debian/debian/menu-broken.install
+++ b/t/tests/menu-format-general/debian/debian/menu-broken.install
@@ -1 +1 @@
-pargs         usr/bin
+pargs-broken         usr/bin
diff --git a/t/tests/menu-format-general/debian/debian/menu-broken.manpages b/t/tests/menu-format-general/debian/debian/menu-broken.manpages
index 6fb56bc..9f8d467 100644
--- a/t/tests/menu-format-general/debian/debian/menu-broken.manpages
+++ b/t/tests/menu-format-general/debian/debian/menu-broken.manpages
@@ -1 +1 @@
-pargs.1
+pargs-broken.1
diff --git a/t/tests/menu-format-general/debian/debian/menu-broken.menu b/t/tests/menu-format-general/debian/debian/menu-broken.menu
index 8765274..fee3e7f 100644
--- a/t/tests/menu-format-general/debian/debian/menu-broken.menu
+++ b/t/tests/menu-format-general/debian/debian/menu-broken.menu
@@ -1,12 +1,12 @@
 ?package(menu-broken):needs="X11" section="Applications/Programming"\
-  title="pargs (missing slash)" command="/usr/bin/pargs"\
+  title="pargs (missing slash)" command="/usr/bin/pargs-broken"\
   longtitle="Argument printer (bad-test)"
   icon="none" newtag=unquoted-value
 ?package(wrong-package):needs="X11" section="Applications/Programming"\
-  title="pargs (wrong pkg)" command="/usr/bin/pargs"\
+  title="pargs (wrong pkg)" command="/usr/bin/pargs-broken"\
   longtitle="Argument printer"
 ?package(menu-broken):needs="X11" section="Applications/Programming"\
-  title="pargs (dup+unparse)" command="/usr/bin/pargs"\
+  title="pargs (dup+unparse)" command="/usr/bin/pargs-broken"\
   longtitle="Argument printer"\
   longtitle="Argument printer"\
   unparseable-stuff
diff --git a/t/tests/menu-format-general/debian/debian/menu-section.install b/t/tests/menu-format-general/debian/debian/menu-section.install
index bf2c0f6..0df55d7 100644
--- a/t/tests/menu-format-general/debian/debian/menu-section.install
+++ b/t/tests/menu-format-general/debian/debian/menu-section.install
@@ -1 +1 @@
-pargs         usr/bin
+pargs-section         usr/bin
diff --git a/t/tests/menu-format-general/debian/debian/menu-section.manpages b/t/tests/menu-format-general/debian/debian/menu-section.manpages
index 6fb56bc..bfc1a5b 100644
--- a/t/tests/menu-format-general/debian/debian/menu-section.manpages
+++ b/t/tests/menu-format-general/debian/debian/menu-section.manpages
@@ -1 +1 @@
-pargs.1
+pargs-section.1
diff --git a/t/tests/menu-format-general/debian/debian/menu-section.menu b/t/tests/menu-format-general/debian/debian/menu-section.menu
index 8c56fde..31ac76c 100644
--- a/t/tests/menu-format-general/debian/debian/menu-section.menu
+++ b/t/tests/menu-format-general/debian/debian/menu-section.menu
@@ -1,12 +1,12 @@
 ?package(menu-section):needs="X11" section="Root"\
-  title="pargs (new root)" command="/usr/bin/pargs"\
+  title="pargs (new root)" command="/usr/bin/pargs-section"\
   longtitle="Argument printer"
 ?package(menu-section):needs="X11" section="Apps/Games"\
-  title="pargs (apps/games)" command="/usr/bin/pargs"\
+  title="pargs (apps/games)" command="/usr/bin/pargs-section"\
   longtitle="Argument printer"
 ?package(menu-section):needs="X11" section="Apps/Programming"\
-  title="pargs (apps/prog)" command="/usr/bin/pargs"\
+  title="pargs (apps/prog)" command="/usr/bin/pargs-section"\
   longtitle="Argument printer"
 ?package(menu-section):needs="X11" section="WindowManagers/Programming"\
-  title="pargs (vm)" command="/usr/bin/pargs"\
+  title="pargs (vm)" command="/usr/bin/pargs-section"\
   longtitle="Argument printer"
diff --git a/t/tests/ocaml-general/debian/Makefile b/t/tests/ocaml-general/debian/Makefile
index 24fe22c..b174871 100644
--- a/t/tests/ocaml-general/debian/Makefile
+++ b/t/tests/ocaml-general/debian/Makefile
@@ -1,9 +1,9 @@
 # A simple makefile to build a *.o file and a *.a file to install to test
 # the OCaml checks for dangling *.cmx files.
-all: symbol.a
+all: symbol.a symbol-dev.a
 
-symbol.a: symbol.o
-	ar rv symbol.a symbol.o
+%.a: %.o
+	ar rv $@ $<
 
-symbol.o: symbol.c
-	cc -c symbol.c
+symbol-dev.o: symbol.c
+	cc -c $< -o $@
diff --git a/t/tests/ocaml-general/debian/debian/libocaml-general-ocaml-dev.install b/t/tests/ocaml-general/debian/debian/libocaml-general-ocaml-dev.install
index 5a1e87a..02b95d1 100644
--- a/t/tests/ocaml-general/debian/debian/libocaml-general-ocaml-dev.install
+++ b/t/tests/ocaml-general/debian/debian/libocaml-general-ocaml-dev.install
@@ -1 +1 @@
-symbol.a usr/lib/ocaml
+symbol-dev.a usr/lib/ocaml
diff --git a/t/tests/ocaml-general/debian/debian/rules b/t/tests/ocaml-general/debian/debian/rules
index 8199f8f..7d19ef0 100755
--- a/t/tests/ocaml-general/debian/debian/rules
+++ b/t/tests/ocaml-general/debian/debian/rules
@@ -13,8 +13,8 @@ override_dh_installdirs:
 	touch debian/libocaml-general-ocaml-dev/usr/lib/ocaml/bar.cmi
 	touch debian/libocaml-general-ocaml-dev/usr/lib/ocaml/baz.cmi
 	touch debian/libocaml-general-ocaml-dev/usr/lib/ocaml/boo.cmi
-	touch debian/libocaml-general-ocaml-dev/usr/lib/ocaml/symbol.cmx
 	touch debian/libocaml-general-ocaml-dev/usr/lib/ocaml/symbol2.cmx
+	touch debian/libocaml-general-ocaml-dev/usr/lib/ocaml/symbol-dev.cmx
 	touch debian/libocaml-general-ocaml-dev/usr/lib/ocaml/bleh.cmo
 	touch debian/libocaml-general-ocaml-dev/usr/lib/ocaml/bleh.cma
 	touch debian/libocaml-general-ocaml-dev/usr/lib/ocaml/META
diff --git a/testset/tags.libbaz b/testset/tags.libbaz
index 3b0ef46..9ec3ed1 100644
--- a/testset/tags.libbaz
+++ b/testset/tags.libbaz
@@ -36,6 +36,8 @@ I: libbaz2: no-md5sums-control-file
 I: libbaz2: no-symbols-control-file usr/lib/libbaz2.so.1.0.3b
 N: 4 tags overridden (4 warnings)
 W: libbaz source: ancient-standards-version 3.2.1 (current is 3.9.2)
+W: libbaz source: binaries-have-file-conflict libbaz1 libbaz1-dev usr/lib/perl5/auto/Foo/Foo.so
+W: libbaz source: binaries-have-file-conflict libbaz1 libbaz2-dev usr/lib/libbaz2.a
 W: libbaz source: changelog-should-mention-nmu
 W: libbaz source: debhelper-but-no-misc-depends libbaz1
 W: libbaz source: debhelper-but-no-misc-depends libbaz1-dev

-- 
Debian package checker


Reply to: