Bug#586313: [new check] Check if package contains .la file
tag 586313 + patch
thanks
Hi,
I've made a patch that fix this bug.
The only thing that still need to be done is to write good description
for the new tags.
Cheers
Laurent Bigonville
checks/shared-libs | 27 +++++++++++--------
checks/shared-libs.desc | 10 +++++++
t/tests/shared-libs-la-files/debian/debian/install | 1 +
t/tests/shared-libs-la-files/debian/libenchant.la | 15 +++++++++++
t/tests/shared-libs-la-files/desc | 5 +++-
t/tests/shared-libs-la-files/tags | 5 +++
6 files changed, 51 insertions(+), 12 deletions(-)
diff --git a/checks/shared-libs b/checks/shared-libs
index 6fb812d..4ed36cf 100644
--- a/checks/shared-libs
+++ b/checks/shared-libs
@@ -164,18 +164,23 @@ for my $cur_file (@{$info->sorted_index}) {
local $_;
open(LAFILE, "< unpacked/$cur_file")
or fail("Could not open unpacked/$cur_file for reading!");
+ tag "package-installs-la-file", $cur_file;
while(<LAFILE>) {
- next unless (m/^libdir='(.+?)'$/);
- my $actual = $1;
- $actual =~ s,/+$,,;
- my ($expected) = ("/$cur_file" =~ m,^(.+)/[^/]+$,);
-
- # python-central is a special case since the libraries are moved
- # at install time.
- next if ($actual =~ m,^/usr/lib/python[\d.]+/(?:site|dist)-packages,
- and $expected =~ m,^/usr/share/pyshared,);
- tag "incorrect-libdir-in-la-file", $cur_file, "$actual != $expected"
- unless($expected eq $actual);
+ next unless (m/^libdir='.+?'$/) or (m/^dependency_libs='.+?'$/);
+ if (m/^libdir='(.+?)'$/) {
+ my $actual = $1;
+ $actual =~ s,/+$,,;
+ my ($expected) = ("/$cur_file" =~ m,^(.+)/[^/]+$,);
+
+ # python-central is a special case since the libraries are moved
+ # at install time.
+ next if ($actual =~ m,^/usr/lib/python[\d.]+/(?:site|dist)-packages,
+ and $expected =~ m,^/usr/share/pyshared,);
+ tag "incorrect-libdir-in-la-file", $cur_file, "$actual != $expected"
+ unless($expected eq $actual);
+ } elsif (m/^dependency_libs='.+?'$/) {
+ tag 'non-empty-dependency-libs-in-la-file', $cur_file;
+ }
last;
}
close(LAFILE);
diff --git a/checks/shared-libs.desc b/checks/shared-libs.desc
index f00288c..46fdae7 100644
--- a/checks/shared-libs.desc
+++ b/checks/shared-libs.desc
@@ -409,3 +409,13 @@ Info: The given .la file points to a libdir other than the path where it is
time instead of using <tt>DESTDIR</tt>. The incorrect path will cause
packages linking to this library using libtool to build incorrectly (adding
incorrect paths to RPATH, for example).
+
+Tag: package-installs-la-file
+Severity: wishlist
+Certainty: certain
+Info: The package is shipping a .la file, bad you.
+
+Tag: non-empty-dependency-libs-in-la-file
+Severity: normal
+Certainty: possible
+Info: The .la file contains non-empty dependency_libs field
diff --git a/t/tests/shared-libs-la-files/debian/debian/install b/t/tests/shared-libs-la-files/debian/debian/install
index 7bdf454..b77863c 100644
--- a/t/tests/shared-libs-la-files/debian/debian/install
+++ b/t/tests/shared-libs-la-files/debian/debian/install
@@ -1,3 +1,4 @@
kio_locate.la usr/lib/kde3
trailing-slash.la usr/lib/lintian
_python_module.la usr/share/pyshared
+libenchant.la usr/lib
diff --git a/t/tests/shared-libs-la-files/debian/libenchant.la b/t/tests/shared-libs-la-files/debian/libenchant.la
new file mode 100644
index 0000000..4c4c2ab
--- /dev/null
+++ b/t/tests/shared-libs-la-files/debian/libenchant.la
@@ -0,0 +1,15 @@
+# Generated by ltmain.sh (GNU libtool) 2.2.6b
+dlname='libenchant.so.1'
+library_names='libenchant.so.1.6.0 libenchant.so.1 libenchant.so'
+old_library='libenchant.a'
+inherited_linker_flags=' -pthread'
+dependency_libs=' /usr/lib/libgmodule-2.0.la -lrt /usr/lib/libglib-2.0.la'
+weak_library_names=''
+current=7
+age=6
+revision=0
+installed=yes
+shouldnotlink=no
+dlopen=''
+dlpreopen=''
+libdir='/usr/lib'
diff --git a/t/tests/shared-libs-la-files/desc b/t/tests/shared-libs-la-files/desc
index 4e5ce00..069bf9c 100644
--- a/t/tests/shared-libs-la-files/desc
+++ b/t/tests/shared-libs-la-files/desc
@@ -2,4 +2,7 @@ Testname: shared-libs-la-files
Sequence: 6000
Version: 1.0
Description: Test checks related to libtool .la files
-Test-For: incorrect-libdir-in-la-file
+Test-For:
+ incorrect-libdir-in-la-file
+ package-installs-la-file
+ non-empty-dependency-libs-in-la-file
diff --git a/t/tests/shared-libs-la-files/tags b/t/tests/shared-libs-la-files/tags
index 5e31e3c..4eeb457 100644
--- a/t/tests/shared-libs-la-files/tags
+++ b/t/tests/shared-libs-la-files/tags
@@ -1 +1,6 @@
E: shared-libs-la-files: incorrect-libdir-in-la-file usr/lib/kde3/kio_locate.la /build/buildd/kio-locate-0.4.5+ds/debian/kio-locate/usr/lib/kde3 != /usr/lib/kde3
+I: shared-libs-la-files: package-installs-la-file usr/lib/kde3/kio_locate.la
+I: shared-libs-la-files: package-installs-la-file usr/lib/libenchant.la
+I: shared-libs-la-files: package-installs-la-file usr/lib/lintian/trailing-slash.la
+I: shared-libs-la-files: package-installs-la-file usr/share/pyshared/_python_module.la
+W: shared-libs-la-files: non-empty-dependency-libs-in-la-file usr/lib/libenchant.la
Reply to: