[SCM] Debian package checker branch, master, updated. 2.1.6-12-gca85ece
The following commit has been merged in the master branch:
commit 57927a2b5445ecb1055e3ca9a625009c3ace26d5
Author: Russ Allbery <rra@debian.org>
Date: Sat Jan 24 01:39:27 2009 -0800
Add a Lintian::Collect::Binary method to read the changelog
* checks/changelog-file:
+ [RA] Use Lintian::Collect to read the changelog.
* lib/Lintian/Collect/Binary.pm:
+ [RA] Add a changelog() method to return the parsed changelog.
diff --git a/checks/changelog-file b/checks/changelog-file
index e83257f..b710592 100644
--- a/checks/changelog-file
+++ b/checks/changelog-file
@@ -20,6 +20,7 @@
package Lintian::changelog_file;
use strict;
+
use Spelling;
use Dep;
use Tags;
@@ -258,8 +259,7 @@ if ($line) {
tag "debian-changelog-file-uses-obsolete-national-encoding", "at line $line"
}
-my $changes = Parse::DebianChangelog->init( { infile => 'changelog',
- quiet => 1 } );
+my $changes = $info->changelog;
if (my @errors = $changes->get_parse_errors) {
foreach (@errors) {
tag "syntax-error-in-debian-changelog", "line $_->[1]", "\"$_->[2]\"";
diff --git a/debian/changelog b/debian/changelog
index cb64ce1..dcf9373 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -4,6 +4,8 @@ lintian (2.1.7) UNRELEASED; urgency=low
+ [RA] Replace `' "balanced" quotes with straight double-quotes. The
old style looks strange with modern fonts. Based on work by Raphael
Geissert.
+ * checks/changelog-file:
+ + [RA] Use Lintian::Collect to read the changelog.
* checks/control-file.desc:
+ [ADB] Fix a typo ("arne't"). Thanks, Raphael Geissert.
* checks/debhelper.desc:
@@ -31,6 +33,8 @@ lintian (2.1.7) UNRELEASED; urgency=low
* lib/Checker.pm:
+ [ADB] Remove some unused code.
+ * lib/Lintian/Collect/Binary.pm:
+ + [RA] Add a changelog() method to return the parsed changelog.
* lib/Lintian/Collect/Source.pm:
+ [ADB] Add a missing "use Util" as the module uses the fail() function
from that module. Thanks, Raphael Geissert. (Closes: #512560)
diff --git a/lib/Lintian/Collect/Binary.pm b/lib/Lintian/Collect/Binary.pm
index f03a047..d847786 100644
--- a/lib/Lintian/Collect/Binary.pm
+++ b/lib/Lintian/Collect/Binary.pm
@@ -1,7 +1,7 @@
# -*- perl -*-
# Lintian::Collect::Binary -- interface to binary package data collection
-# Copyright (C) 2008 Russ Allbery
+# Copyright (C) 2008, 2009 Russ Allbery
# Copyright (C) 2008 Frank Lichtenheld
#
# This program is free software; you can redistribute it and/or modify it
@@ -43,6 +43,20 @@ sub native {
$self->{native} = ($version !~ m/-/);
}
+# Get the changelog file of a binary package as a Parse::DebianChangelog
+# object. Returns undef if the changelog file couldn't be found.
+sub changelog {
+ my ($self) = @_;
+ return $self->{changelog} if exists $self->{changelog};
+ if (-l 'changelog' || ! -f 'changelog') {
+ $self->{changelog} = undef;
+ } else {
+ my %opts = (infile => 'changelog', quiet => 1);
+ $self->{changelog} = Parse::DebianChangelog->init(\%opts);
+ }
+ return $self->{changelog};
+}
+
# Returns the information from the indices
# FIXME: should maybe return an object
sub index {
@@ -276,6 +290,13 @@ documented in the Lintian::Collect module are also available.
=over 4
+=item changelog()
+
+Returns the changelog of the binary package as a Parse::DebianChangelog
+object, or undef if the changelog doesn't exist. The changelog-file
+collection script must have been run to create the changelog file, which
+this method expects to find in F<changelog>.
+
=item native()
Returns true if the binary package is native and false otherwise.
--
Debian package checker
Reply to: