[lintian] 02/02: Drop debian-readme coll
This is an automated email from the git hooks/post-receive script.
nthykier pushed a commit to branch master
in repository lintian.
commit b5e5c7f3e0fb00ab59d17c64c0ee422d87845f3b
Author: Niels Thykier <niels@thykier.net>
Date: Wed Apr 19 10:21:28 2017 +0000
Drop debian-readme coll
It depends on unpacked, so it is not faster than unpacked. It is
auto-removed (and even if it wasn't, we use a temporarily lab on
lintian.d.o), so the files are not retained. Finally, the extracted
data is only used by one single check that can trivially implement
this logic itself.
This saves a stat calls, avoids some "low-level" code (which is more
likely to have information leak bugs) and finally it means there is
one less short-lived coll to load and run.
Signed-off-by: Niels Thykier <niels@thykier.net>
---
checks/debian-readme.desc | 2 +-
checks/debian-readme.pm | 22 ++++++++++-
collection/debian-readme | 89 -------------------------------------------
collection/debian-readme.desc | 9 -----
debian/changelog | 7 ++++
5 files changed, 28 insertions(+), 101 deletions(-)
diff --git a/checks/debian-readme.desc b/checks/debian-readme.desc
index 9a46881..c7021c2 100644
--- a/checks/debian-readme.desc
+++ b/checks/debian-readme.desc
@@ -2,7 +2,7 @@ Check-Script: debian-readme
Author: Richard Braakman <dark@xs4all.nl>
Abbrev: drm
Type: binary
-Needs-Info: debian-readme
+Needs-Info: unpacked
Info: This script checks the <tt>README.Debian</tt> file for various problems.
Tag: readme-debian-mentions-usr-doc
diff --git a/checks/debian-readme.pm b/checks/debian-readme.pm
index f95c4db..74d2851 100644
--- a/checks/debian-readme.pm
+++ b/checks/debian-readme.pm
@@ -29,11 +29,29 @@ use Lintian::Tags qw(tag);
my $SPELLING_ERROR_IN_README
= spelling_tag_emitter('spelling-error-in-readme-debian');
+sub open_readme {
+ my ($pkg_name, $info) = @_;
+ my $doc_dir = $info->index_resolved_path("usr/share/doc/${pkg_name}/");
+ if ($doc_dir) {
+ for my $name (
+ qw(README.Debian.gz README.Debian README.debian.gz README.debian)){
+ my $path = $doc_dir->child($name);
+ next if not $path or not $path->is_open_ok;
+ if ($name =~ m/\.gz$/) {
+ return $path->open_gz;
+ }
+ return $path->open;
+ }
+ }
+ return;
+}
+
sub run {
- my (undef, undef, $info, undef, $group) = @_;
+ my ($pkg_name, undef, $info, undef, $group) = @_;
my $readme = '';
- open(my $fd, '<', $info->lab_data_path('README.Debian'));
+ my $fd = open_readme($pkg_name, $info);
+ return if not defined($fd);
while (my $line = <$fd>) {
if ($line =~ m,/usr/doc\b,) {
tag 'readme-debian-mentions-usr-doc', "line $.";
diff --git a/collection/debian-readme b/collection/debian-readme
deleted file mode 100755
index a1f4893..0000000
--- a/collection/debian-readme
+++ /dev/null
@@ -1,89 +0,0 @@
-#!/usr/bin/perl -w
-# debian-readme -- lintian collector script
-
-# Copyright (C) 1998 Richard Braakman
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, you can find it on the World Wide
-# Web at http://www.gnu.org/copyleft/gpl.html, or write to the Free
-# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
-# MA 02110-1301, USA.
-
-package Lintian::coll::debian_readme;
-
-no lib '.';
-
-use strict;
-use warnings;
-use autodie;
-
-use lib "$ENV{'LINTIAN_ROOT'}/lib";
-use Lintian::Util qw(fail gunzip_file touch_file is_ancestor_of);
-
-sub collect {
- my ($pkg, $type, $dir) = @_;
-
- if (-f "$dir/README.Debian") {
- unlink("$dir/README.Debian");
- }
-
- # If we are asked to only remove the files stop right here
- if ($type =~ m/^remove-/) {
- return;
- }
-
- # Pick the first of these files that exists.
- my @readmes = (
- "$dir/unpacked/usr/share/doc/$pkg/README.Debian.gz",
- "$dir/unpacked/usr/share/doc/$pkg/README.Debian",
- "$dir/unpacked/usr/share/doc/$pkg/README.debian.gz",
- "$dir/unpacked/usr/share/doc/$pkg/README.debian",
- );
-
- if (-d "$dir/unpacked/usr/share/doc/$pkg"
- && !is_ancestor_of("$dir/unpacked", "$dir/unpacked/usr/share/doc/$pkg")
- ) {
- # Unsafe path, stop here
- touch_file("$dir/README.Debian");
- return;
- }
-
- my $file;
- for (@readmes) {
- if (-f $_) {
- $file = $_;
- last;
- }
- }
-
- if (not defined $file) {
- # no README found
- touch_file("$dir/README.Debian");
- } elsif ($file =~ m/\.gz$/) {
- gunzip_file($file, "$dir/README.Debian");
- } else {
- link($file, "$dir/README.Debian");
- }
-
- return;
-}
-
-collect(@ARGV) if $0 =~ m,(?:^|/)debian-readme$,;
-
-1;
-
-# Local Variables:
-# indent-tabs-mode: nil
-# cperl-indent-level: 4
-# End:
-# vim: syntax=perl sw=4 sts=4 sr et
diff --git a/collection/debian-readme.desc b/collection/debian-readme.desc
deleted file mode 100644
index ae122cb..0000000
--- a/collection/debian-readme.desc
+++ /dev/null
@@ -1,9 +0,0 @@
-Collector-Script: debian-readme
-Author: Richard Braakman <dark@xs4all.nl>
-Info: This script copies the <tt>README.Debian</tt> file of a package into
- the lintian directory.
-Type: binary
-Version: 1
-Needs-Info: unpacked
-Interface: perl-coll
-Auto-Remove: yes
diff --git a/debian/changelog b/debian/changelog
index 9603685..27d5e73 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -18,6 +18,9 @@ lintian (2.5.51) UNRELEASED; urgency=medium
+ [BR] Correct a typo in description of tag
license-problem-convert-utf-code.
+ [BR] Avoid a false positive in gfdl file detection.
+ * checks/debian-readme.{desc,pm}:
+ + [NT] Locate the README.Debian using the index rather than relying
+ on a collection.
* checks/fields.pm:
+ [BR] Enforce naming convention for debug package. (Closes: #645455).
* checks/files.pm:
@@ -29,6 +32,10 @@ lintian (2.5.51) UNRELEASED; urgency=medium
+ [NT] Apply patch from Laurent Bigonville to check desktop files
for missing "Icon" field. (Closes: #854132)
+ * coll/debian-readme{,desc}:
+ + [NT] Remove. Merge what little functionality it offers into the
+ debian-readme check.
+
* data/common/source-fields:
+ [NT] Add new "Testsuite-Restrictions" field.
* data/obsolete-sites/obsolete-sites:
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git
Reply to: