[libparse-debianchangelog-perl] 01/03: Initial revision

Intrigeri intrigeri at moszumanska.debian.org
Sun May 24 12:37:51 UTC 2015


This is an automated email from the git hooks/post-receive script.

intrigeri pushed a commit to tag debian_version_0_7-1
in repository libparse-debianchangelog-perl.

commit e9479609d6f0f912d6daba295c39c991e472e41b
Author: Frank Lichtenheld <frank at lichtenheld.de>
Date:   Tue Aug 16 00:43:56 2005 +0000

    Initial revision
---
 bin/parsechangelog | 196 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 196 insertions(+)

diff --git a/bin/parsechangelog b/bin/parsechangelog
new file mode 100755
index 0000000..788c705
--- /dev/null
+++ b/bin/parsechangelog
@@ -0,0 +1,196 @@
+#!/usr/bin/perl
+# -*- perl -*-
+# Copyright 2005 Frank Lichtenheld <frank at 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]
+
+ Options:
+    --help, -h                  print usage information
+    -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
+    --all                       include all changes
+
+C<--all> overrides all other range selecting options.
+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.
+
+Most formats default to showing only the first entry when no other
+options are given with exception of the HTML format which defaults
+to showing all entries.
+
+=head1 DESCRIPTION
+
+parsechangelog parses Debian changelogs as described in the Debian
+policy (version 3.6.2.1 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 html
+
+The changelog is converted to a somewhat nice looking HTML file with
+some nice features as a quicklink 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.
+
+=back
+
+=cut
+
+    use strict;
+use warnings;
+
+use Getopt::Long qw(:config gnu_getopt auto_help);
+use Pod::Usage;
+use Locale::gettext;
+use POSIX;
+use Parse::DebianChangelog;
+
+setlocale(LC_MESSAGES, '');
+textdomain('Parse-DebianChangelog');
+
+my ( $since, $until, $from, $to, $all );
+my $file = 'debian/changelog';
+my $format = 'dpkg';
+my %allowed_formats = (
+		       dpkg => 1,
+		       html => 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".
+	      "Copyright (C) 2005 Frank Lichtenheld\n".
+	      "This is free software; see the GNU General Public Licence\n".
+	      "version 2 or later for copying conditions.  There is NO warranty.\n",
+	      -exitstatus => 0);
+}
+
+GetOptions( "file|l=s" => \$file,
+	    "since|v=s" => \$since,
+	    "until|u=s" => \$until,
+	    "F=s" => \&unsupported,
+	    "L=s" => \&unsupported,
+	    "from|f=s" => \$from,
+	    "to|t=s" => \$to,
+	    "help|h" => \&help,
+	    "format=s" => \&set_format,
+	    "all|a" => \$all,
+	    )
+    or pod2usage(2);
+
+my $changes = Parse::DebianChangelog->init();
+$changes->parse({ infile => $file })
+    or die sprintf( gettext('error while parsing %s')."\n", $file );
+
+my $all_str = $all ? "all => \$all" : "";
+eval "print \$changes->${format}_str({ since => \$since, until => \$until, from => \$from, to => \$to, $all_str })";
+die $@ if $@;
+
+__END__
+=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 at 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

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libparse-debianchangelog-perl.git



More information about the Pkg-perl-cvs-commits mailing list