diff options
author | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2014-08-04 02:04:44 +0100 |
---|---|---|
committer | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2014-08-04 02:04:44 +0100 |
commit | 6b0c4982c4d3aa25970e87df150162e7cd4160c1 (patch) | |
tree | ce61d14cd426aedc9db1fec9209c0432c8292638 | |
parent | e4fb7e9b2592d0a80ca213c94f3a462abd31c6c8 (diff) |
Improve error message for .dsc having already been signed (iff using libdpkg-perl 1.17.x)
-rw-r--r-- | debian/changelog | 2 | ||||
-rwxr-xr-x | dgit | 31 |
2 files changed, 27 insertions, 6 deletions
diff --git a/debian/changelog b/debian/changelog index f5f7b38..eccb21a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -33,6 +33,8 @@ dgit (0.22~experimental1) experimental; urgency=low * Provide `dgit clean'. Closes:#736527. * When cloning, set up a remote `vcs-git' from the package's Vcs-Git (and put an appropriate caveat in the manpage). Closes:#740687. + * Improve error message for .dsc having already been signed (iff + using libdpkg-perl 1.17.x) Major new feature, currently stalled awaiting server infrastructure: * dgit-repos-server: New program for receiving signed-tag-based @@ -594,11 +594,30 @@ sub access_giturl () { return "$url/$package.git"; } -sub parsecontrolfh ($$@) { - my ($fh, $desc, @opts) = @_; - my %opts = ('name' => $desc, @opts); - my $c = Dpkg::Control::Hash->new(%opts); - $c->parse($fh) or die "parsing of $desc failed"; +sub parsecontrolfh ($$;$) { + my ($fh, $desc, $allowsigned) = @_; + our $dpkgcontrolhash_noissigned; + my $c; + for (;;) { + my %opts = ('name' => $desc); + $opts{allow_pgp}= $allowsigned || !$dpkgcontrolhash_noissigned; +print STDERR Dumper(\%opts); + $c = Dpkg::Control::Hash->new(%opts); + $c->parse($fh) or die "parsing of $desc failed"; + last if $allowsigned; + last if $dpkgcontrolhash_noissigned; + my $issigned= $c->get_option('is_pgp_signed'); + if (!defined $issigned) { + $dpkgcontrolhash_noissigned= 1; + seek $fh, 0,0 or die "seek $desc: $!"; + } elsif ($issigned) { + fail "control file $desc is (already) PGP-signed. ". + " Note that dgit push needs to modify the .dsc and then". + " do the signature itself"; + } else { + last; + } + } return $c; } @@ -857,7 +876,7 @@ sub get_archive_dsc () { } my $dscfh = new IO::File \$dscdata, '<' or die $!; printdebug Dumper($dscdata) if $debug>1; - $dsc = parsecontrolfh($dscfh,$dscurl, allow_pgp=>1); + $dsc = parsecontrolfh($dscfh,$dscurl,1); printdebug Dumper($dsc) if $debug>1; my $fmt = getfield $dsc, 'Format'; fail "unsupported source format $fmt, sorry" unless $format_ok{$fmt}; |