The branch, parsechangelog has been updated via 2d2cda573d619b203b944d48e80acb56026be4f9 (commit) via 56d96807333a93135c349a4e7b9a955a5b079d2c (commit) via 50cd7649d73629aa377ebad856689c39801b8976 (commit) via 3a0acd9df121cd3d96c426f905ec89a536dd6fd3 (commit) via 571014e137c1765637416ae301f5b093986cd594 (commit) via 16b90057dd938d3f0bd725aa4ff979827da9f7b7 (commit) via 7a970d3d153565ffcdf1bf22e62e6999337dee70 (commit) via 9b0dc09dc1e51d4a862f9e0d5bf247fd7e0cd2c3 (commit) via 3e6159b6f15f2d96fba5e56488eeb1179af8ba76 (commit) via dacc191d48ac524a97c9e8b490a0911462e914ce (commit) via 3e08a921ba067840c9012eeedf74a3bb27f07a02 (commit) via ef169716b64598385a978e17c5c8a8e1d64c8877 (commit) via e01f80e41d877cc1a03bca4c9a711797257a783b (commit) via 4476d61767e4e533bb2cb9aac45e2ea3d18aac01 (commit) via 0c78affb383d1cd00dc5885dce4eeb0ae4f641be (commit) via 9de0a9a74539f9408c5dc77f34bc5c696eae91ae (commit) via 4666362bd344c93399eca5e31caf7b65d2bc6379 (commit) via 21ca0b9357fd682c37f6592a4088e54ad5065aa2 (commit) via 8b282a3e34710f5182b35d5ae5a591ca83d2df52 (commit) via 0e6f9ad18568b2216596670bdd24e1d04fc1d9f2 (commit) via c5a2d0121bc4ce05960cc8f83ec1774fb2dbc5d0 (commit) via 41ad47b069c35c4312696494236bb2ddb37480da (commit) via 9c0b3956238099de9fe8bf2ebb442cff6eb88b50 (commit) via 7054b21af056d244eb9ff3c3ec81c07942dd8545 (commit) via 608d0155981dce4bdded8391e90f970b0007b3aa (commit) via 058c87d1fc2385a4e7a5b403798f5a4a8ff93cc2 (commit) via b8542b78ae7a1df678515d518c744e85b9c3046f (commit) from 496a5b6f7163ca67742c0bee82c40b52b780349d (commit)
- Shortlog ------------------------------------------------------------ 2d2cda5 dpkg-parsechangelog: Fix an error in command line parsing 56d9680 Actually install Dpkg::Changelog and Dpkg::Changelog:Debian 50cd764 Merge branch 'master' into parsechangelog 3a0acd9 debian/changelog entry for parsechangelog branch 571014e Teach dpkg-parsechangelog about the new debian parser options 16b9005 dpkg-parsechangelog: Make the -L option actually work 7a970d3 dpkg-parsechangelog: Clean-up 9b0dc09 Import parsechangelog script from Parse::DebianChangelog 3e6159b Dpkg::Changelog: Fix error handling dacc191 Dpkg::ErrorHandling: export report function 3e08a92 Add Dpkg::Changelog .pm and testcase files to file lists Summary of changes: ChangeLog | 55 ++++++ debian/changelog | 22 ++- debian/control | 2 +- debian/dpkg-dev.docs | 1 + debian/dpkg-dev.install | 4 + debian/dpkg-dev.preinst | 42 ++++ debian/dselect.docs | 1 + debian/dselect.preinst | 42 ++++ debian/rules | 10 +- dpkg-deb/info.c | 2 +- man/ChangeLog | 9 + man/Makefile.am | 1 + man/deb-version.5 | 6 +- man/po/de.po | 317 ++++++++++++++++++++++++++----- man/po/dpkg-man.pot | 252 ++++++++++++++++++++++-- man/po/es.po | 321 +++++++++++++++++++++++++----- man/po/fr.po | 317 ++++++++++++++++++++++++++----- man/po/hu.po | 315 +++++++++++++++++++++++++----- man/po/ja.po | 317 ++++++++++++++++++++++++++----- man/po/pl.po | 319 ++++++++++++++++++++++++++----- man/po/po4a.cfg | 5 + man/po/pt_BR.po | 315 +++++++++++++++++++++++++----- man/po/ru.po | 315 +++++++++++++++++++++++++----- man/po/sv.po | 400 +++++++++++++++++++++++++++++--------- scripts/Dpkg.pm | 9 + scripts/Dpkg/Changelog.pm | 24 ++-- scripts/Dpkg/Changelog/Debian.pm | 43 ++-- scripts/Dpkg/ErrorHandling.pm | 7 +- scripts/Makefile.am | 10 +- scripts/changelog/debian.pl | 232 ++++++++--------------- scripts/dpkg-buildpackage.pl | 12 +- scripts/dpkg-genchanges.pl | 201 +++++++++++-------- scripts/dpkg-parsechangelog.pl | 48 ++++-- scripts/dpkg-source.pl | 13 +- scripts/po/ChangeLog | 4 + scripts/po/fr.po | 360 ++++++++++++++++++++++------------ 36 files changed, 3435 insertions(+), 918 deletions(-) ----------------------------------------------------------------------- Details of changes: commit 2d2cda573d619b203b944d48e80acb56026be4f9 Author: Frank Lichtenheld <[EMAIL PROTECTED]> Date: Thu Dec 6 05:12:50 2007 +0100 dpkg-parsechangelog: Fix an error in command line parsing diff --git a/scripts/dpkg-parsechangelog.pl b/scripts/dpkg-parsechangelog.pl index 95401a2..d8b346b 100755 --- a/scripts/dpkg-parsechangelog.pl +++ b/scripts/dpkg-parsechangelog.pl @@ -74,8 +74,8 @@ while (@ARGV) { if (m/^-l/ && length($_)>2) { $changelogfile=$POSTMATCH; next; } m/^--$/ && last; m/^-[cfnostuv]/ && next; - m/^--(all|count|file|from|offset|since|to|until)(.*)$/ && do { - push(@ap, shift(@ARGV)) unless $1; + m/^--(all|count|file|format|from|offset|since|to|until)(.*)$/ && do { + push(@ap, shift(@ARGV)) unless $2; next; }; if (m/^-(h|-help)$/) { &usage; exit(0); } commit 56d96807333a93135c349a4e7b9a955a5b079d2c Author: Frank Lichtenheld <[EMAIL PROTECTED]> Date: Thu Dec 6 05:03:03 2007 +0100 Actually install Dpkg::Changelog and Dpkg::Changelog:Debian diff --git a/debian/dpkg-dev.install b/debian/dpkg-dev.install index 5ad0fa9..b8a5190 100644 --- a/debian/dpkg-dev.install +++ b/debian/dpkg-dev.install @@ -64,6 +64,8 @@ usr/share/man/*/*/dpkg-source.1 usr/share/man/*/dpkg-source.1 usr/share/perl5/Dpkg/Arch.pm usr/share/perl5/Dpkg/BuildOptions.pm +usr/share/perl5/Dpkg/Changelog.pm +usr/share/perl5/Dpkg/Changelog/Debian.pm usr/share/perl5/Dpkg/ErrorHandling.pm usr/share/perl5/Dpkg/Deps.pm usr/share/perl5/Dpkg/Fields.pm commit 50cd7649d73629aa377ebad856689c39801b8976 Merge: 3a0acd9df121cd3d96c426f905ec89a536dd6fd3 ef169716b64598385a978e17c5c8a8e1d64c8877 Author: Frank Lichtenheld <[EMAIL PROTECTED]> Date: Thu Dec 6 04:56:16 2007 +0100 Merge branch 'master' into parsechangelog Conflicts: ChangeLog debian/changelog scripts/Makefile.am diff --combined ChangeLog index 790f99f,ea2f691..f030920 --- a/ChangeLog +++ b/ChangeLog @@@ -1,11 -1,50 +1,58 @@@ +2007-12-06 Frank Lichtenheld <[EMAIL PROTECTED]> + + * scripts/dpkg-parsechangelog.pl: Make the + -L option actually work (it's only been eleven + years...) + + * scripts/Dpkg/ErrorHandling.pm (report): export. + + 2007-12-05 Frank Lichtenheld <[EMAIL PROTECTED]> + + * scripts/dpkg-buildpackage.pl: Add new + -A option (passed to dpkg-genchanges). + * scripts/dpkg-genchanges.pl: Add new -A + option that will include only arch-indep + packages into the upload. + + 2007-12-05 Frank Lichtenheld <[EMAIL PROTECTED]> + Goswin von Brederlow <[EMAIL PROTECTED]> + Bastian Blank <[EMAIL PROTECTED]> + + * scripts/dpkg-genchanges.pl: Support more + than one arch and more than one type of + a package in debian/files. + + 2007-12-04 Frank Lichtenheld <[EMAIL PROTECTED]> + + * dpkg-deb/info.c (info_spew): Replace a + %ld with %lu to fix compiler warning. + + * scripts/dpkg-genchanges.pl: Use comp_regex + from Dpkg to correctly exlucde the .orig.tar + even if it is not compressed with gzip. + + * scripts/dpkg-source.pl: Move definition + of @comp_supported, %comp_supported, %comp_ext, + $comp_regex to... + * scripts/Dpkg.pm: ...here. Make them exportable + via the :compression tag. + + * scripts/Dpkg/ErrorHandling.pm (usageerr): + Support format strings like all the other + error reporting functions. + + * scripts/Makefile.am (EXTRA_DIST): Add + missing files from scripts/t/. + + * debian/rules: Call dh_installchangelogs + and dh_installdocs for all packages instead + of only for dpkg. + * debian/dpkg-dev.docs: Symlink to dpkg.docs. + * debian/dselect.docs: Likewise. + * debian/dpkg-dev.preinst: Remove + /usr/share/doc/dpkg-dev symlink on upgrade. + * debian/dselect.preinst: Likewise. + 2007-11-29 Frank Lichtenheld <[EMAIL PROTECTED]> * scripts/controllib.pl (parsecdata): Fix diff --combined debian/changelog index 8f59688,66b2130..5b3bed0 --- a/debian/changelog +++ b/debian/changelog @@@ -16,23 -16,15 +16,24 @@@ dpkg (1.14.13) UNRELEASED; urgency=lo * Allow building only architecture independent packages (-A). Closes: #109794, #200454 * Bump Standards-Version to 3.7.3 (no changes) + * Make the -L option of dpkg-parsechangelog actually work (it's + only been eleven years...) + * Import the code from my external Parse::DebianChangelog as + Dpkg::Changelog and Dpkg::Changelog::Debian. Using this + from parsechangelog/debian adds the following requested + features: + - Option to use a non-lossy format. Closes: #95579 + - Various options to better control how many entries + should be displayed. Closes: #226932 [ Updated man pages translations ] * Swedish (Peter Karlsson) [ Updated scripts translations ] + * French (Frédéric Bothamy). * Swedish (Peter Karlsson) - -- Frank Lichtenheld <[EMAIL PROTECTED]> Wed, 05 Dec 2007 15:05:56 +0100 + -- Frank Lichtenheld <[EMAIL PROTECTED]> Thu, 06 Dec 2007 04:27:17 +0100 dpkg (1.14.12) unstable; urgency=low diff --combined scripts/Dpkg/ErrorHandling.pm index 099d28c,53bd45d..ba2f687 --- a/scripts/Dpkg/ErrorHandling.pm +++ b/scripts/Dpkg/ErrorHandling.pm @@@ -5,7 -5,7 +5,7 @@@ use Dpkg::Gettext use base qw(Exporter); our @EXPORT_OK = qw(warning warnerror error failure unknown syserr internerr - subprocerr usageerr $warnable_error $quiet_warnings); + subprocerr usageerr report $warnable_error $quiet_warnings); our $warnable_error = 1; our $quiet_warnings = 0; @@@ -80,7 -80,10 +80,10 @@@ sub subprocerr(@ sub usageerr(@) { - printf(STDERR "%s: %s\n\n", $progname, "@_"); + my ($msg) = (shift); + + $msg = sprintf($msg, @_) if (@_); + warn "$progname: $msg\n\n"; # XXX: access to main namespace main::usage(); exit(2); diff --combined scripts/Makefile.am index 1252c27,4a7ca23..0a711a5 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@@ -67,10 -67,8 +67,12 @@@ EXTRA_DIST = t/200_Dpkg_Shlibs/objdump.libc6-2.6 \ t/200_Dpkg_Shlibs/objdump.dbd-pg \ t/200_Dpkg_Shlibs/objdump.ls \ + t/300_Dpkg_BuildOptions.t \ - t/400_Dpkg_Deps.t ++ t/400_Dpkg_Deps.t \ + t/600_Dpkg_Changelog.t \ + t/600_Dpkg_Changelog/countme \ + t/600_Dpkg_Changelog/misplaced-tz \ + t/600_Dpkg_Changelog/shadow CLEANFILES = \ $(bin_SCRIPTS) $(sbin_SCRIPTS) $(changelog_SCRIPTS) \ @@@ -80,8 -78,6 +82,8 @@@ perllibdir = $(PERL_LIBDIR nobase_dist_perllib_DATA = \ Dpkg/Arch.pm \ Dpkg/BuildOptions.pm \ + Dpkg/Changelog.pm \ + Dpkg/Changelog/Debian.pm \ Dpkg/ErrorHandling.pm \ Dpkg/Deps.pm \ Dpkg/Fields.pm \ commit 3a0acd9df121cd3d96c426f905ec89a536dd6fd3 Author: Frank Lichtenheld <[EMAIL PROTECTED]> Date: Thu Dec 6 04:35:24 2007 +0100 debian/changelog entry for parsechangelog branch diff --git a/debian/changelog b/debian/changelog index 6623e39..8f59688 100644 --- a/debian/changelog +++ b/debian/changelog @@ -18,6 +18,13 @@ dpkg (1.14.13) UNRELEASED; urgency=low * Bump Standards-Version to 3.7.3 (no changes) * Make the -L option of dpkg-parsechangelog actually work (it's only been eleven years...) + * Import the code from my external Parse::DebianChangelog as + Dpkg::Changelog and Dpkg::Changelog::Debian. Using this + from parsechangelog/debian adds the following requested + features: + - Option to use a non-lossy format. Closes: #95579 + - Various options to better control how many entries + should be displayed. Closes: #226932 [ Updated man pages translations ] * Swedish (Peter Karlsson) @@ -25,7 +32,7 @@ dpkg (1.14.13) UNRELEASED; urgency=low [ Updated scripts translations ] * Swedish (Peter Karlsson) - -- Frank Lichtenheld <[EMAIL PROTECTED]> Thu, 29 Nov 2007 23:04:33 +0100 + -- Frank Lichtenheld <[EMAIL PROTECTED]> Thu, 06 Dec 2007 04:27:17 +0100 dpkg (1.14.12) unstable; urgency=low commit 571014e137c1765637416ae301f5b093986cd594 Author: Frank Lichtenheld <[EMAIL PROTECTED]> Date: Thu Dec 6 04:15:53 2007 +0100 Teach dpkg-parsechangelog about the new debian parser options diff --git a/scripts/changelog/debian.pl b/scripts/changelog/debian.pl index 08225c6..3423196 100755 --- a/scripts/changelog/debian.pl +++ b/scripts/changelog/debian.pl @@ -36,8 +36,6 @@ Options: --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 --format <outputformat> see man page for list of available output formats, defaults to 'dpkg' for compatibility with dpkg-dev diff --git a/scripts/dpkg-parsechangelog.pl b/scripts/dpkg-parsechangelog.pl index 40be538..95401a2 100755 --- a/scripts/dpkg-parsechangelog.pl +++ b/scripts/dpkg-parsechangelog.pl @@ -40,11 +40,27 @@ sub usage { Options: -l<changelogfile> get per-version info from this file. - -v<sinceversion> include all changes later than version. -F<changelogformat> force change log format. -L<libdir> look for change log parsers in <libdir>. -h, --help show this help message. --version show the version. + +parser options: + --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 "), $progname; } @@ -57,7 +73,11 @@ while (@ARGV) { push(@ap,$_); if (m/^-l/ && length($_)>2) { $changelogfile=$POSTMATCH; next; } m/^--$/ && last; - m/^-v/ && next; + m/^-[cfnostuv]/ && next; + m/^--(all|count|file|from|offset|since|to|until)(.*)$/ && do { + push(@ap, shift(@ARGV)) unless $1; + next; + }; if (m/^-(h|-help)$/) { &usage; exit(0); } if (m/^--version$/) { &version; exit(0); } &usageerr(_g("unknown option \`%s'"), $_); commit 16b90057dd938d3f0bd725aa4ff979827da9f7b7 Author: Frank Lichtenheld <[EMAIL PROTECTED]> Date: Thu Dec 6 04:03:35 2007 +0100 dpkg-parsechangelog: Make the -L option actually work diff --git a/ChangeLog b/ChangeLog index b1193af..790f99f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2007-12-06 Frank Lichtenheld <[EMAIL PROTECTED]> + * scripts/dpkg-parsechangelog.pl: Make the + -L option actually work (it's only been eleven + years...) + * scripts/Dpkg/ErrorHandling.pm (report): export. 2007-11-29 Frank Lichtenheld <[EMAIL PROTECTED]> diff --git a/debian/changelog b/debian/changelog index 1195aeb..6623e39 100644 --- a/debian/changelog +++ b/debian/changelog @@ -6,6 +6,18 @@ dpkg (1.14.13) UNRELEASED; urgency=low * Fix control file parsing for field values starting with a colon. Apparently nobody ever needed this until Vcs-Cvs came along. Closes: #453364 + * Copy the usr/share/doc directory to dpkg-dev and dselect (Instead + of using symlinks). The space requirements are minimal and adding + the needed dependencies to comply with policy would be way more + inconvenient. Pointed out by Rene Engelhard. Closes: #452730 + * Allow more than one arch and more than one type of a package + in debian/files. Parts of the patch by Goswin von Brederlow + and Bastian Blank. Closes: #356299, #377400, #229143 + * Allow building only architecture independent packages (-A). + Closes: #109794, #200454 + * Bump Standards-Version to 3.7.3 (no changes) + * Make the -L option of dpkg-parsechangelog actually work (it's + only been eleven years...) [ Updated man pages translations ] * Swedish (Peter Karlsson) diff --git a/scripts/dpkg-parsechangelog.pl b/scripts/dpkg-parsechangelog.pl index be4db97..40be538 100755 --- a/scripts/dpkg-parsechangelog.pl +++ b/scripts/dpkg-parsechangelog.pl @@ -17,7 +17,7 @@ my $changelogfile = 'debian/changelog'; my @parserpath = ("/usr/local/lib/dpkg/parsechangelog", "$dpkglibdir/parsechangelog"); -my $libdir; # XXX: Not used!? +my $libdir; my $force; @@ -79,6 +79,7 @@ if (not $force and $changelogfile ne "-") { my ($pa, $pf); +unshift(@parserpath, $libdir) if $libdir; for my $pd (@parserpath) { $pa= "$pd/$format"; if (!stat("$pa")) { commit 7a970d3d153565ffcdf1bf22e62e6999337dee70 Author: Frank Lichtenheld <[EMAIL PROTECTED]> Date: Thu Dec 6 03:41:28 2007 +0100 dpkg-parsechangelog: Clean-up use English error handling fixes use newer open syntax diff --git a/scripts/dpkg-parsechangelog.pl b/scripts/dpkg-parsechangelog.pl index 64340c0..be4db97 100755 --- a/scripts/dpkg-parsechangelog.pl +++ b/scripts/dpkg-parsechangelog.pl @@ -3,6 +3,7 @@ use strict; use warnings; +use English; use POSIX; use POSIX qw(:errno_h); use Dpkg; @@ -51,24 +52,23 @@ my @ap = (); while (@ARGV) { last unless $ARGV[0] =~ m/^-/; $_= shift(@ARGV); - if (m/^-L/ && length($_)>2) { $libdir=$'; next; } + if (m/^-L/ && length($_)>2) { $libdir=$POSTMATCH; next; } if (m/^-F([0-9a-z]+)$/) { $force=1; $format=$1; next; } push(@ap,$_); - if (m/^-l/ && length($_)>2) { $changelogfile=$'; next; } + if (m/^-l/ && length($_)>2) { $changelogfile=$POSTMATCH; next; } m/^--$/ && last; m/^-v/ && next; if (m/^-(h|-help)$/) { &usage; exit(0); } if (m/^--version$/) { &version; exit(0); } - &usageerr("unknown option \`$_'"); + &usageerr(_g("unknown option \`%s'"), $_); } @ARGV && usageerr(_g("%s takes no non-option arguments"), $progname); -$changelogfile= "./$changelogfile" if $changelogfile =~ m/^\s/; if (not $force and $changelogfile ne "-") { - open(STDIN,"< $changelogfile") || - error(_g("cannot open %s to find format: %s"), $changelogfile, $!); - open(P,"tail -n 40 |") || die sprintf(_g("cannot fork: %s"), $!)."\n"; + open(STDIN,"<", $changelogfile) || + syserr(_g("cannot open %s to find format"), $changelogfile); + open(P,"-|","tail","-n",40) || syserr(_g("cannot fork")); while(<P>) { next unless m/\schangelog-format:\s+([0-9a-z]+)\W/; $format=$1; @@ -90,11 +90,12 @@ for my $pd (@parserpath) { last; } } - + defined($pf) || error(_g("format %s unknown"), $pa); if ($changelogfile ne "-") { - open(STDIN,"< $changelogfile") || die sprintf(_g("cannot open %s: %s"), $changelogfile, $!)."\n"; + open(STDIN,"<", $changelogfile) + || syserr(_g("cannot open %s: %s"), $changelogfile); } -exec($pf,@ap); die sprintf(_g("cannot exec format parser: %s"), $!)."\n"; +exec($pf,@ap) || syserr(_g("cannot exec format parser: %s")); commit 9b0dc09dc1e51d4a862f9e0d5bf247fd7e0cd2c3 Author: Frank Lichtenheld <[EMAIL PROTECTED]> Date: Thu Dec 6 03:26:49 2007 +0100 Import parsechangelog script from Parse::DebianChangelog Replaces changelog/debian.pl diff --git a/scripts/changelog/debian.pl b/scripts/changelog/debian.pl index 2760c14..08225c6 100755 --- a/scripts/changelog/debian.pl +++ b/scripts/changelog/debian.pl @@ -3,35 +3,24 @@ use strict; use warnings; +use Getopt::Long qw(:config gnu_getopt auto_help); +use POSIX; + use Dpkg; use Dpkg::Gettext; -use Dpkg::ErrorHandling qw(error internerr usageerr); -use Dpkg::Fields qw(set_field_importance); - -push(@INC,$dpkglibdir); -require 'controllib.pl'; - -our %f; +use Dpkg::ErrorHandling qw(usageerr failure); +use Dpkg::Changelog::Debian; textdomain("dpkg-dev"); -my $controlfile = 'debian/control'; -my $changelogfile = 'debian/changelog'; -my $fileslistfile = 'debian/files'; -my $since = ''; -my %mapkv = (); # XXX: for future use - -my @changelog_fields = qw(Source Version Distribution Urgency Maintainer - Date Closes Changes); - $progname = "parsechangelog/$progname"; - sub version { printf _g("Debian %s version %s.\n"), $progname, $version; printf _g(" -Copyright (C) 1996 Ian Jackson."); +Copyright (C) 1996 Ian Jackson. +Copyright (C) 2005,2007 Frank Lichtenheld."); printf _g(" This is free software; see the GNU General Public Licence version 2 or later for copying conditions. There is NO warranty. @@ -40,152 +29,93 @@ later for copying conditions. There is NO warranty. sub usage { printf _g( -"Usage: %s [<option>] +"Usage: %s [<option>...] [<changelogfile>] Options: - -l<changelog> use <changelog> as the file name when reporting. - -v<versionsince> print changes since <versionsince>. - -h, --help print this help message. - --version print program version. + --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 + --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 "), $progname; } -while (@ARGV) { - $_=shift(@ARGV); - if (m/^-v(.+)$/) { - $since= $1; - } elsif (m/^-l(.+)$/) { - $changelogfile = $1; - } elsif (m/^-(h|-help)$/) { - &usage; exit(0); - } elsif (m/^--version$/) { - &version; exit(0); - } else { - &usageerr(sprintf(_g("unknown option \`%s'"), $_)); +my ( $since, $until, $from, $to, $all, $count, $offset, $file ); +my $default_file = 'debian/changelog'; +my $format = 'dpkg'; +my %allowed_formats = ( + dpkg => 1, + rfc822 => 1, + ); + +sub set_format { + my ($opt, $val) = @_; + + unless ($allowed_formats{$val}) { + usageerr(_g('output format %s not supported'), $val ); } + + $format = $val; } -my %urgencies; -my $i = 1; -grep($urgencies{$_} = $i++, qw(low medium high critical emergency)); - -my $expect = 'first heading'; -my $blanklines; - -while (<STDIN>) { - s/\s*\n$//; -# printf(STDERR "%-39.39s %-39.39s\n",$expect,$_); - if (m/^(\w[-+0-9a-z.]*) \(([^\(\) \t]+)\)((\s+[-+0-9a-z.]+)+)\;/i) { - if ($expect eq 'first heading') { - $f{'Source'}= $1; - $f{'Version'}= $2; - $f{'Distribution'}= $3; - &error(_g("-v<since> option specifies most recent version")) if - $2 eq $since; - $f{'Distribution'} =~ s/^\s+//; - } elsif ($expect eq 'next heading or eof') { - last if $2 eq $since; - $f{'Changes'}.= " .\n"; - } else { - &clerror(sprintf(_g("found start of entry where expected %s"), $expect)); - } - my $rhs = $'; - $rhs =~ s/^\s+//; - my %kvdone; - for my $kv (split(/\s*,\s*/, $rhs)) { - $kv =~ m/^([-0-9a-z]+)\=\s*(.*\S)$/i || - &clerror(sprintf(_g("bad key-value after \`;': \`%s'"), $kv)); - my $k = (uc substr($1, 0, 1)).(lc substr($1, 1)); - my $v = $2; - $kvdone{$k}++ && &clwarn(sprintf(_g("repeated key-value %s"), $k)); - if ($k eq 'Urgency') { - $v =~ m/^([-0-9a-z]+)((\s+.*)?)$/i || - &clerror(_g("badly formatted urgency value")); - - my $newurg = lc $1; - my $oldurg; - my $newurgn = $urgencies{lc $1}; - my $oldurgn; - my $newcomment = $2; - my $oldcomment; - - $newurgn || - &clwarn(sprintf(_g("unknown urgency value %s - comparing very low"), $newurg)); - if (defined($f{'Urgency'})) { - $f{'Urgency'} =~ m/^([-0-9a-z]+)((\s+.*)?)$/i || - &internerr(sprintf(_g("urgency >%s<"), $f{'Urgency'})); - $oldurg= lc $1; - $oldurgn= $urgencies{lc $1}; $oldcomment= $2; - } else { - $oldurgn= -1; - $oldcomment= ''; - } - $f{'Urgency'}= - (($newurgn > $oldurgn ? $newurg : $oldurg). - $oldcomment. - $newcomment); - } elsif (defined($mapkv{$k})) { - $f{$mapkv{$k}}= $v; - } elsif ($k =~ m/^X[BCS]+-/i) { - # Extensions - XB for putting in Binary, - # XC for putting in Control, XS for putting in Source - $f{$k}= $v; - } else { - &clwarn(sprintf(_g("unknown key-value key %s - copying to %s"), $k, "XS-$k")); - $f{"XS-$k"}= $v; - } - } - $expect= 'start of change data'; $blanklines=0; - $f{'Changes'}.= " $_\n .\n"; - } elsif (m/^\S/) { - &clerror(_g("badly formatted heading line")); - } elsif (m/^ \-\- (.*) <(.*)> ((\w+\,\s*)?\d{1,2}\s+\w+\s+\d{4}\s+\d{1,2}:\d\d:\d\d\s+[-+]\d{4}(\s+\([^\\\(\)]\))?)$/) { - $expect eq 'more change data or trailer' || - &clerror(sprintf(_g("found trailer where expected %s"), $expect)); - $f{'Maintainer'}= "$1 <$2>" unless defined($f{'Maintainer'}); - $f{'Date'}= $3 unless defined($f{'Date'}); -# $f{'Changes'}.= " .\n $_\n"; - $expect= 'next heading or eof'; - last if $since eq ''; - } elsif (m/^ \-\-/) { - &clerror(_g("badly formatted trailer line")); - } elsif (m/^\s{2,}\S/) { - $expect eq 'start of change data' || $expect eq 'more change data or trailer' || - &clerror(sprintf(_g("found change data where expected %s"), $expect)); - $f{'Changes'}.= (" .\n"x$blanklines)." $_\n"; $blanklines=0; - $expect= 'more change data or trailer'; - } elsif (!m/\S/) { - next if $expect eq 'start of change data' || $expect eq 'next heading or eof'; - $expect eq 'more change data or trailer' || - &clerror(sprintf(_g("found blank line where expected %s"), $expect)); - $blanklines++; - } else { - &clerror(_g("unrecognised line")); +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, + "help|h" => sub{usage();exit(0)}, + "version|V" => sub{version();exit(0)}, + "format=s" => \&set_format, + "all|a" => \$all, + ) + or do { usage(); exit(2) }; + +usageerr('too many arguments') if @ARGV > 1; + +if (@ARGV) { + if ($file && ($file ne $ARGV[0])) { + usageerr(_g('more than one file specified (%s and %s)'), + $file, $ARGV[0] ); } + $file = $ARGV[0]; } -$expect eq 'next heading or eof' || die sprintf(_g("found eof where expected %s"), $expect); - -$f{'Changes'} =~ s/\n$//; -$f{'Changes'} =~ s/^/\n/; - -my @closes; - -while ($f{'Changes'} =~ /closes:\s*(?:bug)?\#?\s?\d+(?:,\s*(?:bug)?\#?\s?\d+)*/ig) { - push(@closes, $& =~ /\#?\s?(\d+)/g); +my $changes = Dpkg::Changelog::Debian->init(); + +$file ||= $default_file; +if ($file eq '-') { + my @input = <STDIN>; + $changes->parse({ instring => join('', @input) }) + or failure(_g('fatal error occured while parsing input')); +} else { + $changes->parse({ infile => $file }) + or failure(_g('fatal error occured while parsing %s'), + $file ); } -$f{'Closes'} = join(' ',sort { $a <=> $b} @closes); -set_field_importance(@changelog_fields); -outputclose(); -sub clerror -{ - &error(sprintf(_g("%s, at file %s line %d"), $_[0], $changelogfile, $.)); -} - -sub clwarn -{ - &warn(sprintf(_g("%s, at file %s line %d"), $_[0], $changelogfile, $.)); -} +my @all = $all ? ( all => $all ) : (); +eval("print \$changes->${format}_str( + { since => \$since, until => \$until, + from => \$from, to => \$to, + count => \$count, offset => \$offset, + [EMAIL PROTECTED] })"); commit 3e6159b6f15f2d96fba5e56488eeb1179af8ba76 Author: Frank Lichtenheld <[EMAIL PROTECTED]> Date: Thu Dec 6 03:24:08 2007 +0100 Dpkg::Changelog: Fix error handling Especially format string handling was very inconsistent before. diff --git a/scripts/Dpkg/Changelog.pm b/scripts/Dpkg/Changelog.pm index a1cb87a..1f1e0f6 100644 --- a/scripts/Dpkg/Changelog.pm +++ b/scripts/Dpkg/Changelog.pm @@ -39,7 +39,7 @@ use English; use Dpkg; use Dpkg::Gettext; -use Dpkg::ErrorHandling; +use Dpkg::ErrorHandling qw(warning report); use base qw(Exporter); @@ -160,9 +160,9 @@ sub get_parse_errors { my $res = ""; foreach my $e (@{$self->{errors}{parser}}) { if ($e->[3]) { - $res .= warning(_g("%s(l%s): %s\nLINE: %s"), @$e ); + $res .= report(_g('warning'),_g("%s(l%s): %s\nLINE: %s"), @$e ); } else { - $res .= warning(_g("%s(l%s): %s"), @$e ); + $res .= report(_g('warning'),_g("%s(l%s): %s"), @$e ); } } return $res; @@ -170,10 +170,10 @@ sub get_parse_errors { } sub _do_fatal_error { - my ($self, @msg) = @_; + my ($self, $msg, @msg) = @_; - $self->{errors}{fatal} = "@msg"; - warning(_g("FATAL: %s"), "@msg")."\n" unless $self->{config}{quiet}; + $self->{errors}{fatal} = report(_g('fatal error'), $msg, @msg); + warning($msg, @msg) unless $self->{config}{quiet}; } =pod @@ -592,12 +592,12 @@ sub data2rfc822 { my $v= $data->{$f} or next; $v =~ m/\S/o || next; # delete whitespace-only fields $v =~ m/\n\S/o - && warning(_g("field %s has newline then non whitespace >%s<", - $f, $v )); - $v =~ m/\n[ \t]*\n/o && warning(_g("field %s has blank lines >%s<", - $f, $v )); - $v =~ m/\n$/o && warning(_g("field %s has trailing newline >%s<", - $f, $v )); + && warning(_g("field %s has newline then non whitespace >%s<"), + $f, $v); + $v =~ m/\n[ \t]*\n/o && warning(_g("field %s has blank lines >%s<"), + $f, $v); + $v =~ m/\n$/o && warning(_g("field %s has trailing newline >%s<"), + $f, $v); $v =~ s/\$\{\}/\$/go; $rfc822_str .= "$f: $v\n"; } diff --git a/scripts/Dpkg/Changelog/Debian.pm b/scripts/Dpkg/Changelog/Debian.pm index 7cfd0ac..752214b 100644 --- a/scripts/Dpkg/Changelog/Debian.pm +++ b/scripts/Dpkg/Changelog/Debian.pm @@ -67,7 +67,6 @@ use Date::Parse; use Dpkg; use Dpkg::Gettext; -use Dpkg::ErrorHandling; use Dpkg::Changelog qw( :util ); use base qw(Dpkg::Changelog); @@ -136,8 +135,8 @@ sub parse { unless ($expect eq 'first heading' || $expect eq 'next heading or eof') { $entry->{ERROR} = [ $file, $NR, - _g( "found start of entry where expected %s", - $expect ), "$_" ]; + sprintf(_g("found start of entry where expected %s"), + $expect), "$_" ]; $self->_do_parse_error(@{$entry->{ERROR}}); } unless ($entry->is_empty) { @@ -160,15 +159,15 @@ sub parse { for my $kv (split(/\s*,\s*/,$rhs)) { $kv =~ m/^([-0-9a-z]+)\=\s*(.*\S)$/i || $self->_do_parse_error($file, $NR, - _g( "bad key-value after \`;': \`%s'", $kv )); + sprintf(_g("bad key-value after \`;': \`%s'"), $kv)); my $k = ucfirst $1; my $v = $2; $kvdone{$k}++ && $self->_do_parse_error($file, $NR, - _g( "repeated key-value %s", $k )); + sprintf(_g("repeated key-value %s"), $k)); if ($k eq 'Urgency') { $v =~ m/^([-0-9a-z]+)((\s+.*)?)$/i || $self->_do_parse_error($file, $NR, - _g( "badly formatted urgency value" ), + _g("badly formatted urgency value"), $v); $entry->{'Urgency'} = "$1"; $entry->{'Urgency_LC'} = lc("$1"); @@ -179,7 +178,7 @@ sub parse { $entry->{$k}= $v; } else { $self->_do_parse_error($file, $NR, - _g( "unknown key-value key %s - copying to XS-%s", $k, $k )); + sprintf(_g("unknown key-value key %s - copying to XS-%s"), $k, $k)); $entry->{ExtraFields}{"XS-$k"} = $v; } } @@ -210,12 +209,12 @@ sub parse { $self->{oldformat} .= join "", <$fh>; } elsif (m/^\S/) { $self->_do_parse_error($file, $NR, - _g( "badly formatted heading line" ), "$_"); + _g("badly formatted heading line"), "$_"); } elsif (m/^ \-\- (.*) <(.*)>( ?)((\w+\,\s*)?\d{1,2}\s+\w+\s+\d{4}\s+\d{1,2}:\d\d:\d\d\s+[-+]\d{4}(\s+\([^\\\(\)]\))?)$/o) { $expect eq 'more change data or trailer' || $self->_do_parse_error($file, $NR, - _g( "found trailer where expected %s", - $expect ), "$_"); + sprintf(_g("found trailer where expected %s"), + $expect), "$_"); if ($3 ne ' ') { $self->_do_parse_error($file, $NR, _g( "badly formatted trailer line" ), @@ -228,8 +227,8 @@ sub parse { $entry->{'Timestamp'} = str2time($4); unless (defined $entry->{'Timestamp'}) { $self->_do_parse_error( $file, $NR, - _g( "couldn't parse date %s", - "$4" ) ); + sprintf(_g("couldn't parse date %s"), + "$4")); } } $expect = 'next heading or eof'; @@ -244,8 +243,8 @@ sub parse { || $expect eq 'more change data or trailer' || do { $self->_do_parse_error($file, $NR, - _g( "found change data where expected %s", - $expect ), "$_"); + sprintf(_g("found change data where expected %s"), + $expect), "$_"); if (($expect eq 'next heading or eof') && !$entry->is_empty) { # lets assume we have missed the actual header line @@ -259,8 +258,8 @@ sub parse { $entry->{Version} = 'unknown'.($unknowncounter++); $entry->{Urgency_Comment} = ''; $entry->{ERROR} = [ $file, $NR, - _g( "found change data where expected %s", - $expect ), "$_" ]; + sprintf(_g("found change data where expected %s"), + $expect), "$_" ]; } }; $entry->{'Changes'} .= (" \n" x $blanklines)." $_\n"; @@ -277,8 +276,8 @@ sub parse { || $expect eq 'next heading or eof'; $expect eq 'more change data or trailer' || $self->_do_parse_error($file, $NR, - _g( "found blank line where expected %s", - $expect )); + sprintf(_g("found blank line where expected %s"), + $expect)); $blanklines++; } else { $self->_do_parse_error($file, $NR, _g( "unrecognised line" ), @@ -305,8 +304,8 @@ sub parse { $expect eq 'next heading or eof' || do { $entry->{ERROR} = [ $file, $NR, - _g( "found eof where expected %s", - $expect ) ]; + sprintf(_g("found eof where expected %s"), + $expect) ]; $self->_do_parse_error( @{$entry->{ERROR}} ); }; unless ($entry->is_empty) { @@ -316,8 +315,8 @@ sub parse { if ($self->{config}{infile}) { close $fh or do { - $self->_do_fatal_error( _g( "can't close file %s: %s", - $file, $! )); + $self->_do_fatal_error( _g("can't close file %s: %s"), + $file, $!); return undef; }; } commit dacc191d48ac524a97c9e8b490a0911462e914ce Author: Frank Lichtenheld <[EMAIL PROTECTED]> Date: Thu Dec 6 03:16:45 2007 +0100 Dpkg::ErrorHandling: export report function diff --git a/ChangeLog b/ChangeLog index 3f38c61..b1193af 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2007-12-06 Frank Lichtenheld <[EMAIL PROTECTED]> + + * scripts/Dpkg/ErrorHandling.pm (report): export. + 2007-11-29 Frank Lichtenheld <[EMAIL PROTECTED]> * scripts/controllib.pl (parsecdata): Fix diff --git a/scripts/Dpkg/ErrorHandling.pm b/scripts/Dpkg/ErrorHandling.pm index 8297859..099d28c 100644 --- a/scripts/Dpkg/ErrorHandling.pm +++ b/scripts/Dpkg/ErrorHandling.pm @@ -5,7 +5,7 @@ use Dpkg::Gettext; use base qw(Exporter); our @EXPORT_OK = qw(warning warnerror error failure unknown syserr internerr - subprocerr usageerr $warnable_error $quiet_warnings); + subprocerr usageerr report $warnable_error $quiet_warnings); our $warnable_error = 1; our $quiet_warnings = 0; commit 3e08a921ba067840c9012eeedf74a3bb27f07a02 Author: Frank Lichtenheld <[EMAIL PROTECTED]> Date: Thu Dec 6 02:05:44 2007 +0100 Add Dpkg::Changelog .pm and testcase files to file lists diff --git a/scripts/Makefile.am b/scripts/Makefile.am index c86e70b..1252c27 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -66,7 +66,11 @@ EXTRA_DIST = \ t/200_Dpkg_Shlibs/objdump.libc6-2.3 \ t/200_Dpkg_Shlibs/objdump.libc6-2.6 \ t/200_Dpkg_Shlibs/objdump.dbd-pg \ - t/200_Dpkg_Shlibs/objdump.ls + t/200_Dpkg_Shlibs/objdump.ls \ + t/600_Dpkg_Changelog.t \ + t/600_Dpkg_Changelog/countme \ + t/600_Dpkg_Changelog/misplaced-tz \ + t/600_Dpkg_Changelog/shadow CLEANFILES = \ $(bin_SCRIPTS) $(sbin_SCRIPTS) $(changelog_SCRIPTS) \ @@ -76,6 +80,8 @@ perllibdir = $(PERL_LIBDIR) nobase_dist_perllib_DATA = \ Dpkg/Arch.pm \ Dpkg/BuildOptions.pm \ + Dpkg/Changelog.pm \ + Dpkg/Changelog/Debian.pm \ Dpkg/ErrorHandling.pm \ Dpkg/Deps.pm \ Dpkg/Fields.pm \ -- dpkg's main repository -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]