[lintian] 02/04: Detect cross architecture pkg-config
This is an automated email from the git hooks/post-receive script.
lamby pushed a commit to branch sl2
in repository lintian.
commit 4b430e0122631bb90dcb1bccbadf0aae36a0fb02
Author: Bastien ROUCARIÈS <roucaries.bastien+debian@gmail.com>
Date: Sat Jul 5 12:08:03 2014 +0200
Detect cross architecture pkg-config
Cross architecture pkg-config file are not acceptable. Warn about it.
Signed-off-by: Bastien ROUCARIÈS <roucaries.bastien+debian@gmail.com>
---
checks/files.desc | 5 +++++
checks/files.pm | 21 +++++++++++++++------
.../debian/generated/arch-include-arch.pc.in | 6 ++++++
t/tests/files-pkgconfig/post_test | 1 +
t/tests/files-pkgconfig/tags | 3 ++-
5 files changed, 29 insertions(+), 7 deletions(-)
diff --git a/checks/files.desc b/checks/files.desc
index f9df988..a77c94c 100644
--- a/checks/files.desc
+++ b/checks/files.desc
@@ -1499,6 +1499,11 @@ Info: The arch all pkg-config file contains a reference to a multi-arch path.
Another likely cause is using debhelper 9 or newer (thus enabling
multi-arch paths by default) on a package without multi-arch support.
The usual cure in this case is to update it for multi-arch.
+ .
+ Last but not least, this file could contains a reference to a cross
+ architecture. Like for instance a x86_64-linux-gnu pkg-config file
+ referencing a i386-linux-gnu file. In this case the usual cure is to
+ fix this path.
Tag: dir-or-file-in-home
Severity: serious
diff --git a/checks/files.pm b/checks/files.pm
index b723c7a..35b0e40 100644
--- a/checks/files.pm
+++ b/checks/files.pm
@@ -571,26 +571,35 @@ sub run {
}
# ---------------- arch-indep pkconfig
elsif ($file->is_regular_file
- && $fname =~ m,^usr/(?:lib|share)/pkgconfig/[^/]+\.pc$,) {
+ && $fname
+ =~ m,^usr/(?:lib(/[^/]+)?|share)/pkgconfig/[^/]+\.pc$,) {
+ my $pkg_config_arch = $1 // '';
+ $pkg_config_arch =~ s,\A/,,ms;
+
open(my $fd, '<:raw', $info->unpacked($file));
my $sfd = Lintian::SlidingWindow->new($fd);
-
BLOCK:
while (my $block = $sfd->readwindow()) {
# check if pkgconfig file include path point to
# arch specific dir
+ MULTI_ARCH_DIR:
foreach my $multiarch_dir ($MULTIARCH_DIRS->all) {
- my $regex
- = $MULTIARCH_DIRS->value($multiarch_dir)->{'match'};
+ my $value = $MULTIARCH_DIRS->value($multiarch_dir);
+ my $pkgconfig_dir = $value->{'dir'};
+ my $regex = $value->{'match'};
+ if ($pkg_config_arch eq $pkgconfig_dir) {
+ next MULTI_ARCH_DIR;
+ }
if ($block =~ m{$regex}) {
- tag 'pkg-config-multi-arch-wrong-dir',$file;
+ tag 'pkg-config-multi-arch-wrong-dir',$file,
+ 'full text contains architecture specific dir',
+ $pkgconfig_dir;
last BLOCK;
}
}
}
close($fd);
}
-
#----------------- /usr/X11R6/
# links to FHS locations are allowed
diff --git a/t/tests/files-pkgconfig/debian/generated/arch-include-arch.pc.in b/t/tests/files-pkgconfig/debian/generated/arch-include-arch.pc.in
new file mode 100644
index 0000000..f857bd8
--- /dev/null
+++ b/t/tests/files-pkgconfig/debian/generated/arch-include-arch.pc.in
@@ -0,0 +1,6 @@
+Name: arch-include-arch
+Description: A library that include some arch dir
+Requires:
+Version: 3.1.3
+Libs:
+Cflags: -I/usr/include/$(ARCH)/arch-include-arch
diff --git a/t/tests/files-pkgconfig/post_test b/t/tests/files-pkgconfig/post_test
new file mode 100644
index 0000000..6c64c5e
--- /dev/null
+++ b/t/tests/files-pkgconfig/post_test
@@ -0,0 +1 @@
+s/full text contains architecture specific dir \S+$/full text contains architecture specific dir ARCH/
diff --git a/t/tests/files-pkgconfig/tags b/t/tests/files-pkgconfig/tags
index 0df537c..a3933e9 100644
--- a/t/tests/files-pkgconfig/tags
+++ b/t/tests/files-pkgconfig/tags
@@ -1 +1,2 @@
-E: pkgconfig-all: pkg-config-multi-arch-wrong-dir usr/lib/pkgconfig/indep-include-arch.pc
+E: pkgconfig-all: pkg-config-multi-arch-wrong-dir usr/lib/pkgconfig/indep-include-arch.pc full text contains architecture specific dir ARCH
+E: pkgconfig-any: pkg-config-multi-arch-wrong-dir usr/lib/x86_64-linux-gnu/pkgconfig/arch-cross.pc full text contains architecture specific dir ARCH
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git
Reply to: