chiark / gitweb /
dgit-repos-server: parsetag: Print a bit more debug about junk
[dgit.git] / infra / dgit-repos-server
index f5767aefdeb0fe2f2ee9b24ba74dbdf806bff6e0..f75d7e527ea28dc14582fa0da1ad92a6cacadfdb 100755 (executable)
@@ -591,7 +591,8 @@ sub parsetag_general ($$) {
                if ($dgititemfn->()) {
                } elsif (s/^distro\=(\S+) //) {
                    $distrofn->($1);
-               } elsif (s/^[-+.=0-9a-z]\S* //) {
+               } elsif (s/^([-+.=0-9a-z]\S*) //) {
+                   printdebug " parsetag ignoring unrecognised \`$1'\n";
                } else {
                    die "unknown dgit info in tag ($_)";
                }
@@ -1073,10 +1074,10 @@ our @hookenvs = qw(distro suitesfile suitesformasterfile policyhook
 # workrepo and destrepo handled ad-hoc
 
 sub mode_tag2upload () {
-    # PROTOTYPE
     # CALLER MUST PREVENT MULTIPLE CONCURRENT RUNS IN SAME CWD
     # If we fail (exit nonzero), caller should capture our stderr,
     #  and retry some bounded number of times in some appropriate way
+    # Uses whatever ambient gpg key is available
     @ARGV==2 or die;
 
     my $url;
@@ -1252,6 +1253,16 @@ END
 
     runcmd qw(git checkout -q), "refs/tags/$tagval";
 
+    my $clogp = parsechangelog();
+    my $clogf = sub {
+       my ($f, $exp) = @_;
+       my $got = getfield $clogp, $f;
+       return if $got eq $exp;
+       reject "mismatch: changelog $f $got != $exp";
+    };
+    $clogf->('Version', $version);
+    $clogf->('Source',  $package);
+
     @fetch = (@dgit, qw(fetch), $suite);
     debugcmd "+",@_;
     $!=0; $?=-1;
@@ -1260,7 +1271,9 @@ END
     }
     # this is just to get the orig, so we don't really care about the ref
     if (defined $upstreamc) {
-       $upstreamc eq git_rev_parse "refs/tags/$upstreamt" or die;
+       my $need_upstreamc = git_rev_parse "refs/tags/$upstreamt";
+       $upstreamc eq $need_upstreamc or reject
+           "upstream-commitish=$upstreamc but tag refers to $need_upstreamc";
        runcmd qw(git deborig), "$upstreamc";
     }
 
@@ -1270,12 +1283,12 @@ END
     if (defined $quilt) {
        push @dgitcmd, "--quilt=$quilt";
        if ($quilt =~ m/baredebian/) {
-           die "needed upstream commmitish with --quilt=baredebian";
+           die "needed upstream commmitish with --quilt=baredebian"
+               unless defined $upstreamc;
            push @dgitcmd, "--upstream-commitish=$upstreamc";
        }
     }
     push @dgitcmd, qw(push-source --new --overwrite), $suite;
-    # xxx what about the key to use?
     
     runcmd @dgitcmd;