#! /usr/bin/perl

# Given paths to  debian/changelog, output the distribution
# of the top/most recent entry

use Dpkg::Changelog::Debian;

use strict;

my $filename=$ARGV[0];

if ( -d $filename ) {
    $filename = $filename . "/debian/changelog";
}

my $c = Dpkg::Changelog::Debian->new();
$c->load($filename);

# my $control = $c->dpkg({});
my @control = $c->format_range("dpkg", {count => 1} );
my $dist = $control[0]->{Distribution};

print $dist,"\n";
