This is an automated email from the git hooks/post-receive script. rouca pushed a commit to branch tagrename in repository lintian.
commit f7dbaff42c945e329f9fc1329000e330c6c8fac7 Author: Bastien ROUCARIÈS <roucaries.bastien+deb...@gmail.com> Date: Sat Aug 15 21:51:28 2015 +0200 Allow tag to be renamed Allow renaming tag. --- data/override/renamed-tags | 7 +++++++ lib/Lintian/Tag/Override.pm | 9 +++++++++ lib/Lintian/Tags.pm | 12 ++++++++---- .../debian/debian/overrides-shown.lintian-overrides | 3 +++ t/tests/overrides-shown/tags | 4 ++++ t/tests/overrides/debian/debian/install | 1 + t/tests/overrides/debian/debian/overrides.lintian-overrides | 3 +++ t/tests/overrides/tags | 2 +- 8 files changed, 36 insertions(+), 5 deletions(-) diff --git a/data/override/renamed-tags b/data/override/renamed-tags new file mode 100644 index 0000000..7dab546 --- /dev/null +++ b/data/override/renamed-tags @@ -0,0 +1,7 @@ +# list of renamed tag old name => new name. Please alpha sort by old name +dep5-file-paragraph-reference-header-paragraph => dep5-file-paragraph-references-header-paragraph +package-install-apt-preferences => package-installs-apt-preferences +package-install-apt-sources => package-installs-apt-sources +package-install-ieee-data => package-installs-ieee-data +package-install-into-obsolete-dir => package-installs-into-obsolete-dir +privacy-breach-may-use-debian-package => privacy-breach-uses-embedded-file diff --git a/lib/Lintian/Tag/Override.pm b/lib/Lintian/Tag/Override.pm index 28e0634..20132a4 100644 --- a/lib/Lintian/Tag/Override.pm +++ b/lib/Lintian/Tag/Override.pm @@ -22,6 +22,7 @@ use strict; use warnings; use parent qw(Class::Accessor::Fast); +use Lintian::Data; =head1 NAME @@ -72,9 +73,17 @@ considered a pattern. =cut +# renamed tag list +my $RENAMED_TAGS = Lintian::Data->new('override/renamed-tags',qr/\s*=>\s*/); + sub new { my ($type, $tag, $data) = @_; $data = {} unless defined $data; + + if($RENAMED_TAGS->known($tag)) { + $tag = $RENAMED_TAGS->value($tag); + } + my $self = { 'arch' => $data->{'arch'}, 'comments' => $data->{'comments'}, diff --git a/lib/Lintian/Tags.pm b/lib/Lintian/Tags.pm index aea037f..13c5612 100644 --- a/lib/Lintian/Tags.pm +++ b/lib/Lintian/Tags.pm @@ -603,10 +603,6 @@ sub file_overrides { } next unless $found; } - if ($profile && !$profile->is_overridable($tag)) { - $self->{ignored_overrides}{$tag}++; - next; - } if ($last_over && $last_over->tag eq $tag && !scalar @$comments) { # There are no new comments, no "empty line" in between and @@ -624,6 +620,14 @@ sub file_overrides { }; $comments = []; $tagover = Lintian::Tag::Override->new($tag, $data); + # tag will be changed here if renamed reread + $tag = $tagover->{'tag'}; + + # treat here ignored overrides + if ($profile && !$profile->is_overridable($tag)) { + $self->{ignored_overrides}{$tag}++; + next; + } $info->{'overrides-data'}{$tag}{$extra} = $tagover; $info->{overrides}{$tag}{$extra} = 0; $last_over = $tagover; diff --git a/t/tests/overrides-shown/debian/debian/overrides-shown.lintian-overrides b/t/tests/overrides-shown/debian/debian/overrides-shown.lintian-overrides index dd2884b..04ae11b 100644 --- a/t/tests/overrides-shown/debian/debian/overrides-shown.lintian-overrides +++ b/t/tests/overrides-shown/debian/debian/overrides-shown.lintian-overrides @@ -14,4 +14,7 @@ FSSTND-dir-in-manual-page usr/share/man/man1/foo.1.gz:2* FSSTND-dir-in-manual-page */foo.1.gz:5 /usr/doc/ FSSTND-dir-in-manual-page */foo.1.gz:3* +# renamed tag +package-install-apt-sources * + #FSSTND-dir-in-manual-page usr/share/man/man1/foo.1.gz * more occurrences not shown diff --git a/t/tests/overrides-shown/tags b/t/tests/overrides-shown/tags index 2ffaf8c..075742d 100644 --- a/t/tests/overrides-shown/tags +++ b/t/tests/overrides-shown/tags @@ -1,3 +1,7 @@ +N: renamed tag +O: overrides-shown: package-installs-apt-sources etc/apt/sources.list.d/ +N: renamed tag +O: overrides-shown: package-installs-apt-sources etc/apt/sources.list.d/foo.1 N: exact extra information O: overrides-shown: FSSTND-dir-in-manual-page usr/share/man/man1/foo.1.gz:4 /usr/dict/ N: These are wildcard overrides diff --git a/t/tests/overrides/debian/debian/install b/t/tests/overrides/debian/debian/install new file mode 100644 index 0000000..747a313 --- /dev/null +++ b/t/tests/overrides/debian/debian/install @@ -0,0 +1 @@ +foo.1 /etc/apt/sources.list.d \ No newline at end of file diff --git a/t/tests/overrides/debian/debian/overrides.lintian-overrides b/t/tests/overrides/debian/debian/overrides.lintian-overrides index dd2884b..04ae11b 100644 --- a/t/tests/overrides/debian/debian/overrides.lintian-overrides +++ b/t/tests/overrides/debian/debian/overrides.lintian-overrides @@ -14,4 +14,7 @@ FSSTND-dir-in-manual-page usr/share/man/man1/foo.1.gz:2* FSSTND-dir-in-manual-page */foo.1.gz:5 /usr/doc/ FSSTND-dir-in-manual-page */foo.1.gz:3* +# renamed tag +package-install-apt-sources * + #FSSTND-dir-in-manual-page usr/share/man/man1/foo.1.gz * more occurrences not shown diff --git a/t/tests/overrides/tags b/t/tests/overrides/tags index ce876f0..8cbb094 100644 --- a/t/tests/overrides/tags +++ b/t/tests/overrides/tags @@ -1,4 +1,4 @@ I: overrides: FSSTND-dir-in-manual-page usr/share/man/man1/foo.1.gz:12 /usr/info/ I: overrides: FSSTND-dir-in-manual-page usr/share/man/man1/foo.1.gz:13 /usr/man/ I: overrides: FSSTND-dir-in-manual-page usr/share/man/man1/foo.1.gz:14 /usr/adm/ -N: 10 tags overridden (1 warning, 9 info) +N: 12 tags overridden (2 errors, 1 warning, 9 info) -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git