[SCM] Debian package checker branch, master, updated. 2.5.0-rc3-24-gdf92d26
The following commit has been merged in the master branch:
commit df92d268fe480b1a9b93829991e91c7f0b4d64c4
Author: Niels Thykier <niels@thykier.net>
Date: Thu Apr 28 10:49:06 2011 +0200
Allow simple architecture specific overrides
This patch allows overrides to be architecture specific without
architecture wildcards nor sanity checks of architectures listed.
The new override syntax will be:
[[pkgname] [archlist] [pkgtype]:]<tag>[ extra]
Where [archlist] is the same format* as in the B-D field and the
rest of the fields are known from the current/previous syntax.
* including the [], so [i386 amd64] etc.
diff --git a/debian/changelog b/debian/changelog
index 68d02f3..6cac4ed 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -28,6 +28,10 @@ lintian (2.5.0~rc4) UNRELEASED; urgency=low
* lib/Lintian/Tags.pm:
+ [NT] Allow overrides to use wildcards anywhere instead of only in
the beginning or the end. (Closes: #617991)
+ + [NT] Allow simple architecture overrides such as [i386] or [!i386].
+ Architecture wildcards are not supported yet. The actual syntax
+ for the architecture the same as the one used in the Build-Depends.
+ (Closes: #622888)
-- Adam D. Barratt <adam@adam-barratt.org.uk> Sat, 23 Apr 2011 13:37:52 +0100
diff --git a/doc/lintian.xml b/doc/lintian.xml
index 150c19e..5bbc311 100644
--- a/doc/lintian.xml
+++ b/doc/lintian.xml
@@ -496,8 +496,10 @@ $
<para>
The format of the overrides file is simple, it consists of one override per
line (and may contain empty lines and comments, starting with a <literal>#</literal>, on others):
- <literal>[<replaceable><package></replaceable>[ <replaceable><type></replaceable>]: ]<replaceable><lintian-tag></replaceable>[
+ <literal>[[<replaceable><package></replaceable>][ <replaceable><archlist></replaceable>][ <replaceable><type></replaceable>]: ]<replaceable><lintian-tag></replaceable>[
[*]<replaceable><lintian-info></replaceable>[*]]</literal>. <replaceable><package></replaceable> is the package name;
+ <replaceable><archlist></replaceable> is an architecture list
+ in the same format as for the Build-Depends field (except architecture wildcards are not supported);
<replaceable><type></replaceable> is one of <literal>binary</literal>, <literal>udeb</literal> and
<literal>source</literal>,
and <replaceable><lintian-info></replaceable> is all
diff --git a/lib/Lintian/Tags.pm b/lib/Lintian/Tags.pm
index 8d570a8..ba25545 100644
--- a/lib/Lintian/Tags.pm
+++ b/lib/Lintian/Tags.pm
@@ -548,13 +548,43 @@ sub file_overrides {
next if /^(?:\#|\z)/;
s/\s+/ /go;
my $override = $_;
- $override =~ s/^\Q$info->{package}\E( \Q$info->{type}\E)?: //;
- if ($override eq '' or $override !~ /^[\w.+-]+(?:\s.*)?$/) {
- tag('malformed-override', $_);
- } else {
- my ($tag, $extra) = split(/ /, $override, 2);
+ # The override looks like the following:
+ # [[pkg-name] [arch-list] [pkg-type]:] <tag> [extra]
+ if ($override =~ m/^(?: # start optional part
+ (?:\Q$info->{package}\E)? # Optionally starts with package name
+ (?: \s*+ \[([^\]]+?)\])? # optionally followed by an [arch-list] (like in B-D) -> $1
+ (?: \s*+ \Q$info->{type}\E)? # optionally followed by the type
+ :\s++)? # end optional part
+ (.+)$/x){ # <tag-name> [extra] -> $2
+ # Valid - so far at least
+ my ($archlist, $tagdata) = ($1, $2);
+ my ($tag, $extra) = split(m/ /o, $tagdata, 2);
+ if ($archlist) {
+ # parse and figure
+ my (@archs) = split(m/\s++/o, $archlist);
+ my $negated = 0;
+ my $found = 0;
+ foreach my $a (@archs){
+ $negated++ if $a =~ s/^!//o;
+ $found = 1 if $a eq $info->{arch};
+ }
+ if ($negated > 0 && scalar @archs != $negated){
+ # missing a ! somewhere
+ tag 'malformed-override', $_, 'Inconsistent architecture negation';
+ next;
+ }
+ # missing wildcard checks and sanity checking archs $arch
+ if ($negated) {
+ $found = 1 if !$found;
+ } else {
+ $found = 0 if $found;
+ }
+ next unless $found;
+ }
$extra = '' unless defined $extra;
$info->{overrides}{$tag}{$extra} = 0;
+ } else {
+ tag('malformed-override', $_);
}
}
close $file;
diff --git a/t/tests/overrides/debian/debian/overrides.lintian-overrides b/t/tests/overrides/debian/debian/overrides.lintian-overrides
index 23f3eb5..854c581 100644
--- a/t/tests/overrides/debian/debian/overrides.lintian-overrides
+++ b/t/tests/overrides/debian/debian/overrides.lintian-overrides
@@ -1,5 +1,9 @@
# override without extra information
manpage-has-bad-whatis-entry
+# Architecture specific override - which is retarded considering
+# it is an arch: all package we are testing >.>
+[i386]: hyphen-used-as-minus-sign usr/share/man/man1/foo.1.gz:12
+[!i386]: hyphen-used-as-minus-sign usr/share/man/man1/foo.1.gz:6
# exact extra information
hyphen-used-as-minus-sign usr/share/man/man1/foo.1.gz:4
# wildcards
diff --git a/t/tests/overrides/tags b/t/tests/overrides/tags
index 01a576c..c3eb94a 100644
--- a/t/tests/overrides/tags
+++ b/t/tests/overrides/tags
@@ -1,5 +1,4 @@
I: overrides: hyphen-used-as-minus-sign usr/share/man/man1/foo.1.gz:12
I: overrides: hyphen-used-as-minus-sign usr/share/man/man1/foo.1.gz:13
I: overrides: hyphen-used-as-minus-sign usr/share/man/man1/foo.1.gz:14
-I: overrides: hyphen-used-as-minus-sign usr/share/man/man1/foo.1.gz:6
-N: 8 tags overridden (1 warning, 7 info)
+N: 9 tags overridden (1 warning, 8 info)
--
Debian package checker
Reply to: