Re: [PATCH] dpkg-genchanges: Enhance logic to decide if we include orig tarballs
On Wed, Jan 16, 2008 at 02:11:39PM +0100, Raphael Hertzog wrote:
> @@ -189,7 +189,11 @@ my $changelog = parse_changelog(%options);
> delete $options{"since"};
> $options{"count"} = 1;
> $options{"offset"} = 1;
> -my $prev_changelog = parse_changelog(%options);
> +my ($prev_changelog, $bad_parser);
> +eval { # Do not fail if parser failed due to unsupported options
> + $prev_changelog = parse_changelog(%options);
> +};
> +$bad_parser = 1 if ($@);
That hunk really should go into the former patch. Or the hunk that
introduces the code you fix should vanish from the former patch.
> # Other initializations
> my $control = Dpkg::Control->new($controlfile);
> my $fields = Dpkg::Fields::Object->new();
> @@ -402,7 +406,28 @@ if (!is_binaryonly) {
> $f2pri{$f} = $pri;
> }
>
> - if (($sourcestyle =~ m/i/ && $sversion !~ m/-(0|1|0\.1)$/ ||
> + # Compare upstream version to previous upstream version to decide if
> + # the .orig tarballs must be included
> + my $include_tarball;
> + if (defined($prev_changelog)) {
> + my $cur_uv = $sversion;
> + my $prev_uv = $prev_changelog->{"Version"};
> + $prev_uv =~ s/^\d+://;
> + $cur_uv =~ s/-[^-]+$//;
> + $prev_uv =~ s/-[^-]+$//;
> + $include_tarball = ($cur_uv ne $prev_uv) ? 1 : 0;
Could we please use Dpkg::Version here? And change it if it doesn't
support something like this yet. No need to reinvent the wheel.
> + } else {
> + if ($bad_parser) {
> + # The parser doesn't support extracting a previous version
> + # Fallback to version check
> + $include_tarball = ($sversion =~ /-(0|1|0\.1)$/) ? 1 : 0;
> + } else {
> + # No previous entry means first upload, tarball required
> + $include_tarball = 1;
> + }
Hmm, have you tested the latter case? (i.e. only one entry in the
changelog). I suddenly recall there was something I wanted to fix there.
Gruesse,
--
Frank Lichtenheld <djpig@debian.org>
www: http://www.djpig.de/
Reply to: