Commit bfa9348b authored by Felix Lechner's avatar Felix Lechner Committed by Chris Lamb

In frontend/dplint, use new changelog parser.

In response to Bug#933134, the changelog parser became part of
Lintian. This commit uses it in frontend/dplint.

Gbp-Dch: ignore
parent 52d5b674
......@@ -60,6 +60,7 @@ use warnings;
use Cwd qw(getcwd realpath);
use File::Basename qw(dirname basename);
use Getopt::Long();
use Path::Tiny;
# The $INIT_ROOT line below is (to be) replaced at install time to the
# actual root (i.e. '/usr/share/lintian'). The find_source_root call
......@@ -343,12 +344,14 @@ sub guess_version {
}
# git was not possible - maybe the changelog is available
if (-f "$rootdir/debian/changelog") {
require Parse::DebianChangelog;
eval {
my $changelog
= Parse::DebianChangelog->init(
{ infile => "$rootdir/debian/changelog" });
$guess = $changelog->dpkg->{'Version'} if $changelog;
require Lintian::Info::Changelog;
my $contents = path("$rootdir/debian/changelog")->slurp;
my $changelog = Lintian::Info::Changelog->new;
$changelog->parse($contents);
my @entries = @{$changelog->entries};
$guess = $entries[0]->{'Version'}
if @entries;
};
return $guess if $guess;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment