The branch, parsechangelog has been updated
via 24b37628a18c4921882d7e9068f12ca4bd42151d (commit)
via 0287c4c511e38a97a9b87e67332b80bd89f2413c (commit)
via 78adb13396e4eb966269b338b0e382a424b54f52 (commit)
from 352ac7c7d2ed1bdad84096d1c33a11ca75dc43c5 (commit)
- Shortlog ------------------------------------------------------------
24b3762 Dpkg::Changelog::Debian: Don't lock the input file
0287c4c Allow changelog parser to abort early
78adb13 Dpkg::Changelog: Make warnings from __sanity_check_range more
informative
Summary of changes:
scripts/Dpkg/Changelog.pm | 53 +++++++++++++++++++++++++++++++++++---
scripts/Dpkg/Changelog/Debian.pm | 6 +---
scripts/changelog/debian.pl | 22 +++++++++------
3 files changed, 63 insertions(+), 18 deletions(-)
-----------------------------------------------------------------------
Details of changes:
commit 24b37628a18c4921882d7e9068f12ca4bd42151d
Author: Frank Lichtenheld <[EMAIL PROTECTED]>
Date: Tue Dec 11 00:51:37 2007 +0100
Dpkg::Changelog::Debian: Don't lock the input file
We don't lock any other input files in dpkg-dev, so
don't start it here.
diff --git a/scripts/Dpkg/Changelog/Debian.pm b/scripts/Dpkg/Changelog/Debian.pm
index e99118b..ae2b310 100644
--- a/scripts/Dpkg/Changelog/Debian.pm
+++ b/scripts/Dpkg/Changelog/Debian.pm
@@ -99,11 +99,6 @@ sub parse {
$file, $! );
return undef;
};
- flock $fh, LOCK_SH or do {
- $self->_do_fatal_error( _g("can't lock file %s: %s"),
- $file, $! );
- return undef;
- };
} elsif (my $string = $self->{config}{instring}) {
eval { require IO::String };
if ($@) {
commit 0287c4c511e38a97a9b87e67332b80bd89f2413c
Author: Frank Lichtenheld <[EMAIL PROTECTED]>
Date: Tue Dec 11 00:50:51 2007 +0100
Allow changelog parser to abort early
Dpkg::Changelog->_abort_early() tests whether the parser
can abort.
Dpkg::Changelog::Debian->parse() checks this after each
finished entry.
parsechangelog/debian sets count explicetly to 1 if no
other range options are given so that the parser
aborts early in this case.
diff --git a/scripts/Dpkg/Changelog.pm b/scripts/Dpkg/Changelog.pm
index 4cf0ca6..80fc701 100644
--- a/scripts/Dpkg/Changelog.pm
+++ b/scripts/Dpkg/Changelog.pm
@@ -303,6 +303,51 @@ sub _data_range {
return [EMAIL PROTECTED];
}
+sub _abort_early {
+ my ($self) = @_;
+
+ my $data = $self->data or return;
+ my $config = $self->{config} or return;
+
+# use Data::Dumper;
+# warn "Abort early? (\$# = $#$data)\n".Dumper($config);
+
+ return if $config->{all};
+
+ my $since = $config->{since} || '';
+ my $until = $config->{until} || '';
+ my $from = $config->{from} || '';
+ my $to = $config->{to} || '';
+ my $count = $config->{count} || 0;
+ my $offset = $config->{offset} || 0;
+
+ return if $offset and not $count;
+ return if $offset < 0 or $count < 0;
+ if ($offset > 0) {
+ $offset -= ($count < 0);
+ }
+ my $start = my $end = $offset;
+ $end += $count-1 if $count > 0;
+
+ unless ($from or $to or $since or $until or $start or $end) {
+ return if not $count;
+ return 1 if @$data;
+ }
+
+ return 1 if ($start or $end)
+ and $start < @$data and $end < @$data;
+
+ return unless $since or $from;
+ foreach (@$data) {
+ my $v = $_->{Version};
+
+ return 1 if $v eq $since;
+ return 1 if $v eq $from;
+ }
+
+ return;
+}
+
=pod
=head3 dpkg
diff --git a/scripts/Dpkg/Changelog/Debian.pm b/scripts/Dpkg/Changelog/Debian.pm
index 752214b..e99118b 100644
--- a/scripts/Dpkg/Changelog/Debian.pm
+++ b/scripts/Dpkg/Changelog/Debian.pm
@@ -144,6 +144,7 @@ sub parse {
# print STDERR, Dumper($entry);
push @{$self->{data}}, $entry;
$entry = Dpkg::Changelog::Entry->init();
+ last if $self->_abort_early;
}
{
$entry->{'Source'} = "$1";
diff --git a/scripts/changelog/debian.pl b/scripts/changelog/debian.pl
index 3423196..6e3b64f 100755
--- a/scripts/changelog/debian.pl
+++ b/scripts/changelog/debian.pl
@@ -99,21 +99,25 @@ if (@ARGV) {
my $changes = Dpkg::Changelog::Debian->init();
$file ||= $default_file;
+unless ($since or $until or $from or $to or
+ $offset or $count or $all) {
+ $count = 1;
+}
+my @all = $all ? ( all => $all ) : ();
+my $opts = { since => $since, until => $until,
+ from => $from, to => $to,
+ count => $count, offset => $offset,
+ @all };
+
if ($file eq '-') {
my @input = <STDIN>;
- $changes->parse({ instring => join('', @input) })
+ $changes->parse({ instring => join('', @input), %$opts })
or failure(_g('fatal error occured while parsing input'));
} else {
- $changes->parse({ infile => $file })
+ $changes->parse({ infile => $file, %$opts })
or failure(_g('fatal error occured while parsing %s'),
$file );
}
-my @all = $all ? ( all => $all ) : ();
-
-eval("print \$changes->${format}_str(
- { since => \$since, until => \$until,
- from => \$from, to => \$to,
- count => \$count, offset => \$offset,
- [EMAIL PROTECTED] })");
+eval("print \$changes->${format}_str(\$opts)");
commit 78adb13396e4eb966269b338b0e382a424b54f52
Author: Frank Lichtenheld <[EMAIL PROTECTED]>
Date: Tue Dec 11 00:47:00 2007 +0100
Dpkg::Changelog: Make warnings from __sanity_check_range more informative
Explicetly tell which information will be ignored.
diff --git a/scripts/Dpkg/Changelog.pm b/scripts/Dpkg/Changelog.pm
index 1f1e0f6..4cf0ca6 100644
--- a/scripts/Dpkg/Changelog.pm
+++ b/scripts/Dpkg/Changelog.pm
@@ -223,19 +223,19 @@ sub __sanity_check_range {
$$from = $$since = $$to = $$until = '';
}
if ($$from && $$since) {
- warning(_g( "you can only specify one of 'from' and 'since'" ));
+ warning(_g( "you can only specify one of 'from' and 'since', using
'since'" ));
$$from = '';
}
if ($$to && $$until) {
- warning(_g( "you can only specify one of 'to' and 'until'" ));
+ warning(_g( "you can only specify one of 'to' and 'until', using
'until'" ));
$$to = '';
}
if ($$since && ($data->[0]{Version} eq $$since)) {
- warning(_g( "'since' option specifies most recent version" ));
+ warning(_g( "'since' option specifies most recent version, ignoring" ));
$$since = '';
}
if ($$until && ($data->[$#{$data}]{Version} eq $$until)) {
- warning(_g( "'until' option specifies oldest version" ));
+ warning(_g( "'until' option specifies oldest version, ignoring" ));
$$until = '';
}
$$start = 0 if $$start < 0;
--
dpkg's main repository
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]