[lintian] 01/01: Detect automake variable for pkg-config wrong flags
This is an automated email from the git hooks/post-receive script.
broucaries-guest pushed a commit to branch master
in repository lintian.
commit 153a319bd731b104d69cfaa11c2f64147aaf5b4e
Author: Bastien ROUCARIÈS <roucaries.bastien+debian@gmail.com>
Date: Sat Jul 5 16:09:08 2014 +0200
Detect automake variable for pkg-config wrong flags
Detect automake problem
Signed-off-by: Bastien ROUCARIÈS <roucaries.bastien+debian@gmail.com>
---
checks/files.pm | 4 +++-
data/files/pkg-config-bad-regex | 2 ++
t/tests/files-pkgconfig/debian/indep-really-bad.pc | 12 +++++++++---
t/tests/files-pkgconfig/desc | 1 +
4 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/checks/files.pm b/checks/files.pm
index 44e6683..b7a1bc8 100644
--- a/checks/files.pm
+++ b/checks/files.pm
@@ -582,6 +582,8 @@ sub run {
my $sfd = Lintian::SlidingWindow->new($fd);
BLOCK:
while (my $block = $sfd->readwindow()) {
+ # remove comment line
+ $block =~ s,\#\V*,,gsm;
# remove continuation line
$block =~ s,\\\n, ,gxsm;
# check if pkgconfig file include path point to
@@ -604,7 +606,7 @@ sub run {
PKG_CONFIG_TABOO:
foreach my $taboo ($PKG_CONFIG_BAD_REGEX->all) {
my $regex = $PKG_CONFIG_BAD_REGEX->value($taboo);
- if ($block =~ m{$regex}xms) {
+ while($block =~ m{$regex}xmsg) {
my $extra = $1 // '';
$extra =~ s/\s+/ /g;
tag 'pkg-config-bad-directive', $file, $extra;
diff --git a/data/files/pkg-config-bad-regex b/data/files/pkg-config-bad-regex
index e1bf596..7cad88b 100644
--- a/data/files/pkg-config-bad-regex
+++ b/data/files/pkg-config-bad-regex
@@ -31,5 +31,7 @@
^(?:[^:]*flags\h*:|[^=]*FLAGS\h*=) (?:\V*\h)? (-f(?:no-)?inline) \s
# found in libbt.pc
^(?:[lL]ibs\h*:|LDFLAGS\h*=) (?:\V*\h)? (-Wl,z,relro) \s
+# not replace automake variable
+(@[^@\s]*@)
diff --git a/t/tests/files-pkgconfig/debian/indep-really-bad.pc b/t/tests/files-pkgconfig/debian/indep-really-bad.pc
index 034e442..5825cb3 100644
--- a/t/tests/files-pkgconfig/debian/indep-really-bad.pc
+++ b/t/tests/files-pkgconfig/debian/indep-really-bad.pc
@@ -1,8 +1,10 @@
Name: indep-good
-Description: A library good
+Description: A library with ugly flags
Requires:
Version: 3.1.3
Libs:
+# a comment removed -L/usr/local/lib/somewhere \
+SOMEFLAGS=-I/var/cache/pbuilder/build/
Cflags: \
-I/usr/local/somewhere \
-D__linux__ \
@@ -24,6 +26,10 @@ Cflags: \
-DNEW_STDCPP \
-fno-check-new \
-fno-inline \
- -Wl,z,relro
+ -Wl,z,relro \
+ @SOME_FLAGS@
+#False positive
+Fflags: \
+ @SOME_FLAGS \
+ @
-
diff --git a/t/tests/files-pkgconfig/desc b/t/tests/files-pkgconfig/desc
index 09268ca..0cf7917 100644
--- a/t/tests/files-pkgconfig/desc
+++ b/t/tests/files-pkgconfig/desc
@@ -3,4 +3,5 @@ Sequence: 6000
Version: 1.0
Description: Check for detection of pkgconfig problem
Test-For:
+ pkg-config-bad-directive
pkg-config-multi-arch-wrong-dir
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git
Reply to: