[SCM] Debian package checker branch, vendor-profile, updated. 2.5.0-23-gb077740
The following commit has been merged in the vendor-profile branch:
commit b077740ffff4f8ac293e31e48e7818b8b978efe1
Merge: bb9376d05780a500e30218b18e6bad94cbbd1e54 b176a2e8d819df983085f3e0e8b1f70ecfb2555f
Author: Niels Thykier <niels@thykier.net>
Date: Tue May 31 16:32:55 2011 +0200
Merge branch 'master' into vendor-profile
Conflicts:
lib/Lintian/Tags.pm
diff --combined lib/Lintian/Tags.pm
index c13acab,8bd6f3b..3b9bc38
--- a/lib/Lintian/Tags.pm
+++ b/lib/Lintian/Tags.pm
@@@ -159,7 -159,6 +159,7 @@@ sub new
show_pedantic => 0,
statistics => {},
suppress => {},
+ ignored_overrides => {},
};
bless($self, $class);
$GLOBAL = $self unless $GLOBAL;
@@@ -202,11 -201,24 +202,24 @@@ sub _check_overrides
} elsif ($extra ne '') {
for (sort keys %$overrides) {
my $pattern = $_;
- next unless ($pattern =~ /^\*/ or $pattern =~ /\*\z/);
- my ($start, $end) = ('', '');
- $start = '.*' if $pattern =~ s/^\*//;
- $end = '.*' if $pattern =~ s/\*$//;
- if ($extra =~ /^$start\Q$pattern\E$end\z/) {
+ my $end = '';
+ my $pat = '';
+ next unless $pattern =~ m/\Q*\E/o;
+ # Split does not help us if $text ends with *
+ # so we deal with that now
+ if ($pattern =~ s/\Q*\E+\z//o){
+ $end = '.*';
+ }
+ # Are there any * left (after the above)?
+ if ($pattern =~ m/\Q*\E/o) {
+ # this works even if $text starts with a *, since
+ # that is split as '', <text>
+ my @pargs = split(m/\Q*\E++/o, $pattern);
+ $pat = join('.*', map { quotemeta($_) } @pargs);
+ } else {
+ $pat = $pattern;
+ }
+ if ($extra =~ m/^$pat$end\z/) {
$overrides->{$_}++;
return "$tag $_";
}
@@@ -523,7 -535,6 +536,7 @@@ file cannot be opened
sub file_overrides {
my ($self, $overrides) = @_;
+ my $ignored = $self->{ignored_overrides};
unless (defined $self->{current}) {
die 'no current file when adding overrides';
}
@@@ -537,14 -548,41 +550,42 @@@
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
+ ([\-\.a-zA-Z_0-9]+ (?:\s.+)?)$/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 = $found ? 0 : 1;
+ }
+ next unless $found;
+ }
+ next if $ignored->{$tag};
$extra = '' unless defined $extra;
$info->{overrides}{$tag}{$extra} = 0;
+ } else {
+ tag('malformed-override', $_);
}
}
close $file;
@@@ -639,12 -677,6 +680,12 @@@ sub displayed
my ($self, $tag) = @_;
my $info = Lintian::Tag::Info->new($tag);
return 0 if ($info->experimental and not $self->{show_experimental});
+ my $only = $self->{only_issue};
+ if (%$only) {
+ return 1 if $only->{$tag};
+ return 0;
+ }
+ return 0 if $self->suppressed($tag);
my $severity = $info->severity;
my $certainty = $info->certainty;
@@@ -695,21 -727,6 +736,21 @@@ sub suppressed
return;
}
+=item ignore_overrides(TAG[, ...])
+
+Ignores all future overrides for all tags given as arguments.
+
+=cut
+
+sub ignore_overrides {
+ my ($self, @tags) = @_;
+ my $ignored = $self->{ignored_overrides};
+ foreach my $tag (@tags){
+ $ignored->{$tag} = 1;
+ }
+ return 1;
+}
+
=back
=head1 AUTHOR
--
Debian package checker
Reply to: