This is an automated email from the git hooks/post-receive script. lamby pushed a commit to branch master in repository lintian.
commit 4cf1e31cd014e61ce9ebde064b53da06b7b2b4d6 Author: Chris Lamb <la...@debian.org> Date: Fri Feb 16 21:53:37 2018 +0000 lib/Lintian/Collect/{Changes,Sources}.pm: Add repacked subroutines to check whether a package has been repacked or not. --- checks/changes-file.pm | 2 +- checks/rules.pm | 7 +++---- checks/source-copyright.pm | 2 +- debian/changelog | 3 +++ lib/Lintian/Collect/Changes.pm | 19 ++++++++++++++++++- lib/Lintian/Collect/Source.pm | 19 ++++++++++++++++++- 6 files changed, 44 insertions(+), 8 deletions(-) diff --git a/checks/changes-file.pm b/checks/changes-file.pm index 6be546e..3256ccb 100644 --- a/checks/changes-file.pm +++ b/checks/changes-file.pm @@ -200,7 +200,7 @@ sub run { if ( $has_signing_key && $file =~ m/\.orig(-[A-Za-z\d-]+)?\.tar\./ && $file !~ m/\.asc$/ - && $info->field('version') !~ m/(?:dfsg|debian|ds|repack)/) { + && !$info->repacked) { tag 'orig-tarball-missing-upstream-signature', $file unless exists $files->{"$file.asc"}; } diff --git a/checks/rules.pm b/checks/rules.pm index dd1143f..2a79fed 100644 --- a/checks/rules.pm +++ b/checks/rules.pm @@ -405,10 +405,9 @@ sub run { } elsif ($typerule eq 'recommended_allindep') { tag 'debian-rules-missing-recommended-target', $target; } elsif ($typerule eq 'goodpractice_dfsg') { - if ($version =~ /(dfsg|debian|ds)/) { - tag 'debian-rules-missing-good-practice-target-dfsg', - $target; - } + tag 'debian-rules-missing-good-practice-target-dfsg', + $target + if $info->repacked; } else { $typerule ||= '<N/A>'; croak( diff --git a/checks/source-copyright.pm b/checks/source-copyright.pm index 47409e9..66c0e4c 100644 --- a/checks/source-copyright.pm +++ b/checks/source-copyright.pm @@ -284,7 +284,7 @@ sub _parse_dep5 { if $info->source_field('section', '') =~ m{^(contrib|non-free)(/.+)?$} and none { defined $first_para->{$_} } qw(comment disclaimer); tag 'missing-explanation-for-repacked-upstream-tarball' - if $info->field('version', '') =~ m{(?:dfsg|debian|ds|repack)} + if $info->repacked and none { defined $first_para->{$_} } qw(comment files-excluded); my (undef, $full_license_header, undef,@short_licenses_header) diff --git a/debian/changelog b/debian/changelog index 6ba16e7..de7bf3e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -28,6 +28,9 @@ lintian (2.5.76) UNRELEASED; urgency=medium * lib/Lintian/Util.pm: + [CL] Factor out the regex that matches "repacked" tarballs based on their filename. + * lib/Lintian/Collect/{Changes,Sources}.pm: + + [CL] Add repacked subroutines to check whether a package has been + repacked or not. * t/scripts/changelog-format.t: + [CL] Provide some possibly-helpful advice when violating the "entry diff --git a/lib/Lintian/Collect/Changes.pm b/lib/Lintian/Collect/Changes.pm index 112dbfb..e9cef7f 100644 --- a/lib/Lintian/Collect/Changes.pm +++ b/lib/Lintian/Collect/Changes.pm @@ -22,7 +22,7 @@ use strict; use warnings; use parent 'Lintian::Collect'; -use Lintian::Util qw(strip); +use Lintian::Util qw(strip $PKGREPACK_REGEX); =head1 NAME @@ -168,6 +168,23 @@ sub files { return $self->{files}; } +=item repacked + +Returns true if the source package referenced in this changes file has been +"repacked" and false otherwise. This is determined from the version name +containing "dfsg" or similar. + +Needs-Info requirements for using I<repacked>: L<Same as field|Lintian::Collect/field ([FIELD[, DEFAULT]])> + +=cut + +sub repacked { + my ($self) = @_; + return $self->{repacked} if exists $self->{repacked}; + $self->{repacked} = $self->field('version', '') =~ $PKGREPACK_REGEX; + return $self->{repacked}; +} + =back =head1 AUTHOR diff --git a/lib/Lintian/Collect/Source.pm b/lib/Lintian/Collect/Source.pm index 2c89a97..5921df7 100644 --- a/lib/Lintian/Collect/Source.pm +++ b/lib/Lintian/Collect/Source.pm @@ -29,7 +29,8 @@ use Scalar::Util qw(blessed); use Lintian::Relation; use Parse::DebianChangelog; -use Lintian::Util qw(get_file_checksum read_dpkg_control $PKGNAME_REGEX); +use Lintian::Util + qw(get_file_checksum read_dpkg_control $PKGNAME_REGEX $PKGREPACK_REGEX); =head1 NAME @@ -186,6 +187,22 @@ sub native { return $self->{native}; } +=item repacked + +Returns true if the source package has been "repacked" and false otherwise. +This is determined from the version name containing "dfsg" or similar. + +Needs-Info requirements for using I<repacked>: L<Same as field|Lintian::Collect/field ([FIELD[, DEFAULT]])> + +=cut + +sub repacked { + my ($self) = @_; + return $self->{repacked} if exists $self->{repacked}; + $self->{repacked} = $self->field('', '1.0-1') =~ $PKGREPACK_REGEX; + return $self->{repacked}; +} + =item binaries Returns a list of the binary and udeb packages listed in the -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git