/usr/bin/parsechangelog is in libparse-debianchangelog-perl 1.2.0-12.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 | #!/usr/bin/perl
# -*- perl -*-
# Copyright 2005 Frank Lichtenheld <frank@lichtenheld.de>
#
# 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, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
=head1 NAME
parsechangelog - parse Debian changelogs and output them in other formats
=head1 SYNOPSIS
parsechangelog [options] [changelogfile]
Options:
--help, -h print usage information
--version, -V print version information
--file, -l <file> changelog file to parse, defaults
to 'debian/changelog'
-F<changelogformat> ignored if changelogformat = 'debian'
for compatibility with dpkg-dev
-L<libdir> ignored for compatibility with dpkg-dev
--format <outputformat> see man page for list of available
output formats, defaults to 'dpkg'
for compatibility with dpkg-dev
--since, -s, -v <version> include all changes later than version
--until, -u <version> include all changes earlier than version
--from, -f <version> include all changes equal or later
than version
--to, -t <version> include all changes up to or equal
than version
--count, -c, -n <number> include <number> entries from the top
(or the tail if <number> is lower than 0)
--offset, -o <number> change the starting point for --count,
counted from the top (or the tail if
<number> is lower than 0)
--all include all changes
If neither C<changelogfile> nor C<-l E<lt>fileE<gt>> are specified,
F<debian/changelog> will be used. If two different files are
specified the program will abort.
If the filename is C<-> the program reads the changelog from
standard input.
C<--all> overrides all other range selecting options. C<--count>
overrides all other range selection options except for C<--all>.
The range selecting options can be mixed together, but only one
of C<--since> and C<--from> and one of C<--until> and C<--to> can be
specified at the same time.
The dpkg and rfc822 formats default to showing only the first entry
when no other options are given with while the HTML and XML formats
default to showing all entries.
For a more extensive documentation of the range selecting options and
some (hopefully enlightening) examples see
L<Parse::DebianChangelog/"COMMON OUTPUT OPTIONS">.
=head1 DESCRIPTION
parsechangelog parses Debian changelogs as described in the Debian
policy (version 3.9.8 at the time of this writing) and converts
them to other output formats. See section L<"SEE ALSO"> for
locations where to find the full format definition.
The output formats supported are currently:
=over 4
=item dpkg
Format as known from L<dpkg-parsechangelog(1)>. All requested entries
(see L<"SYNOPSIS"> on how to select specific entries) are returned in
the usual Debian control format, merged in one stanza, ready to be used
in a F<.changes> file.
=item rfc822
Similar to the C<dpkg> format, but the requested entries are returned
as one stanza each, i.e. they are not merged. This is probably the format
to use if you want a machine-usable representation of the changelog.
=item xml
Just a simple XML dump of the changelog data. Without any schema or
DTD currently, just some made up XML. The actual format might still
change. Comments and Improvements welcome.
=item html
The changelog is converted to a somewhat nice looking HTML file with
some nice features as a quick-link bar with direct links to every entry.
NOTE: This is not configurable yet and was specifically designed
to be used on L<http://packages.debian.org/>. This is planned to be
changed until version 1.0. The used Parse::DebianChangelog module
already supports configuration, however, this isn't exposed by this
program yet.
=back
=cut
use strict;
use warnings;
use Getopt::Long qw(:config gnu_getopt auto_help);
use Pod::UsageTrans;
use Locale::gettext;
use POSIX;
use Parse::DebianChangelog;
setlocale(LC_MESSAGES, '');
textdomain('Parse-DebianChangelog');
my ( $since, $until, $from, $to, $all, $count, $offset, $file );
my $default_file = 'debian/changelog';
my $format = 'dpkg';
my %allowed_formats = (
dpkg => 1,
html => 1,
xml => 1,
rfc822 => 1,
);
sub unsupported {
my ($opt, $val) = @_;
$opt ||= '';
$val ||= '';
if ($opt eq 'F' and $val ne 'debian') {
die sprintf( gettext('changelog format %s not supported')."\n",
$val );
}
if ($opt eq 'L') {
warn gettext('ignored option -L')."\n";
}
}
sub set_format {
my ($opt, $val) = @_;
unless ($allowed_formats{$val}) {
die sprintf( gettext('output format %s not supported')."\n",
$val );
}
$format = $val;
}
sub help {
pod2usage(-msg => "$0 $Parse::DebianChangelog::VERSION\n".
gettext( "Copyright (C) 2005 by Frank Lichtenheld\n" ).
gettext( "This is free software; see the GNU General Public ".
"Licence version 2 or later for copying conditions. ".
"There is NO warranty." )."\n",
-textdomain => 'Parse-DebianChangelog-Pod',
-exitstatus => 0);
}
sub version {
print "$0 $Parse::DebianChangelog::VERSION\n";
exit 0;
}
GetOptions( "file|l=s" => \$file,
"since|v=s" => \$since,
"until|u=s" => \$until,
"from|f=s" => \$from,
"to|t=s" => \$to,
"count|c|n=i" => \$count,
"offset|o=i" => \$offset,
"F=s" => \&unsupported,
"L=s" => \&unsupported,
"help|h" => \&help,
"version|V" => \&version,
"format=s" => \&set_format,
"all|a" => \$all,
)
or pod2usage({
-exitvalue => 2,
-textdomain => 'Parse-DebianChangelog-Pod'
});
die gettext('too many arguments')."\n" if @ARGV > 1;
if (@ARGV) {
if ($file && ($file ne $ARGV[0])) {
die sprintf( gettext('more than one file specified (%s and %s)')."\n",
$file, $ARGV[0] );
}
$file = $ARGV[0];
}
my $changes = Parse::DebianChangelog->init();
$file ||= $default_file;
if ($file eq '-') {
$changes->parse({ handle => \*STDIN, handlename => '<stdin>' })
or die sprintf( gettext('fatal error occured while parsing %s')."\n",
'input' );
} else {
$changes->parse({ infile => $file })
or die sprintf( gettext('fatal error occured while parsing %s')."\n",
$file );
}
my @all = $all ? ( all => $all ) : ();
{
# I know that looks ugly, but at least it is safer than an eval...
no strict 'refs';
my $func_name = "Parse::DebianChangelog::${format}_str";
print &{"$func_name"}( $changes,
{ since => $since, until => $until,
from => $from, to => $to,
count => $count, offset => $offset,
@all });
}
__END__
=head1 BUGS
Any version given with C<--since>, C<--until>, C<--from>, or C<--to>
must exist in the changelogfile, else parsechangelog will a wrong result
or even abort with an error message. See
L<https://bugs.debian.org/576606>
=head1 SEE ALSO
Parse::DebianChangelog, the underlying Perl module
Description of the Debian changelog format in the Debian policy:
L<http://www.debian.org/doc/debian-policy/ch-source.html#s-dpkgchangelog>.
=head1 AUTHOR
Frank Lichtenheld, E<lt>frank@lichtenheld.deE<gt>
=head1 COPYRIGHT AND LICENSE
Copyright (C) 2005 by Frank Lichtenheld
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, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
=cut
|