[SCM] Debian package checker branch, master, updated. 2.5.10-84-gdc5ab1a
The following commit has been merged in the master branch:
commit 758bd566eb9fa5d4da7a51ea988cdd7ec9f49563
Author: Niels Thykier <niels@thykier.net>
Date: Mon Jul 23 14:51:54 2012 +0200
L::C::Binary: Add API for checking if a file is a conffile
Signed-off-by: Niels Thykier <niels@thykier.net>
diff --git a/checks/md5sums b/checks/md5sums
index 94b571e..314336e 100644
--- a/checks/md5sums
+++ b/checks/md5sums
@@ -33,20 +33,6 @@ my $control = $info->control('md5sums');
my %control_entry;
my %info_entry;
-my %conffile;
-
-# read in conffiles
-if (-f $info->control('conffiles')) {
- open(C, '<', $info->control('conffiles'))
- or fail("cannot open control file conffiles: $!");
- while (<C>) {
- chop;
- next if m/^\s*$/o;
- s,^/,,o;
- $conffile{$_} = 1;
- }
- close(C);
-}
# Is there a md5sums control file?
unless (-f $control) {
@@ -61,7 +47,7 @@ unless (-f $control) {
foreach my $file ($info->sorted_index) {
# Skip non-files, they will not appear in the md5sums file
next unless $info->index ($file)->is_regular_file;
- unless ($conffile{$file}) {
+ unless ($info->is_conffile ($file)) {
$only_conffiles = 0;
last;
}
@@ -104,7 +90,7 @@ for my $file (keys %control_entry) {
for my $file (keys %{ $info->md5sums }) {
next if $control_entry{$file};
tag 'file-missing-in-md5sums', $file
- unless ($conffile{$file} || $file =~ m%^var/lib/[ai]spell/.%o);
+ unless ($info->is_conffile ($file) || $file =~ m%^var/lib/[ai]spell/.%o);
}
}
diff --git a/debian/changelog b/debian/changelog
index 7149f16..2545133 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -39,6 +39,9 @@ lintian (2.5.11) UNRELEASED; urgency=low
the groff pipeline.
+ [CW,NT] Use the L::Util gzip decompressor to open gzipped
manpages.
+ * checks/md5sums:
+ + [NT] Use L::Collect's conffile API instead of accessing the
+ "conffiles" control file directly.
* checks/scripts{,.desc}:
+ [NT] Retire check for dpkg-maintscript-helper in preinst.
+ [NT] Fix false positive "executable-not-elf-or-script" when
@@ -82,6 +85,8 @@ lintian (2.5.11) UNRELEASED; urgency=low
of the methods.
* lib/Lintian/Collect/Binary.pm:
+ [NT] Bump API for objdump method.
+ + [NT] Add API for checking if a file is considered a
+ conffile.
* lib/Lintian/Collect/Package.pm:
+ [NT] Strip leading slash off files extracted from tar.
* lib/Lintian/Internal/FrontendUtil.pm:
diff --git a/lib/Lintian/Collect/Binary.pm b/lib/Lintian/Collect/Binary.pm
index 3f40008..8a8ab92 100644
--- a/lib/Lintian/Collect/Binary.pm
+++ b/lib/Lintian/Collect/Binary.pm
@@ -359,6 +359,36 @@ sub is_transitional {
return $desc =~ m/transitional package/;
}
+# Returns a truth value if the file is listed in the conffiles file
+# - Note files should be passed relative to the package root.
+# sub is_conffile Needs-Info bin-pkg-control
+sub is_conffile {
+ my ($self, $file) = @_;
+ if (exists $self->{'conffiles'}) {
+ return 1 if exists $self->{'conffiles'}->{$file};
+ return;
+ }
+ my $cf = $self->control ('conffiles');
+ my %conffiles = ();
+ $self->{'conffiles'} = \%conffiles;
+ # No real packages use links in their control.tar.gz and conffiles
+ # must be a file.
+ return if -l $cf or not -f $cf;
+ open my $fd, '<', $cf or fail "opening control/conffiles: $!";
+ while ( my $line = <$fd> ) {
+ chomp $line;
+ next if $line =~ m/^\s*$/;
+ # Look up happens with a relative path (e.g. etc/file.conf).
+ # Side-effect is that we silently "fix" relative conffiles,
+ # but checks/conffiles catches those for us.
+ $line =~ s,^/++,,o;
+ $conffiles{$line} = 1;
+ }
+ close $fd;
+ return 1 if exists $conffiles{$file};
+ return;
+}
+
=head1 NAME
Lintian::Collect::Binary - Lintian interface to binary package data collection
@@ -532,6 +562,17 @@ This is based on the package's description.
Returns an open handle, which will read the data from coll/strings for
FILE.
+=item is_conffile (FILE)
+
+Returns a truth value if FILE is listed in the conffiles control file.
+If the control file is not present or FILE is not listed in it, it
+returns C<undef>.
+
+Note that FILE should be the filename relative to the package root
+(even though the control file uses absolute paths). If the control
+file does relative paths, they are assumed to be relative to the
+package root as well (and used without warning).
+
=back
=head1 AUTHOR
--
Debian package checker
Reply to: