my ($command) = @_;
return unless $we_are_responder;
# called even without $we_are_responder
- printdebug "<< $command\n";
+ printdebug ">> $command\n";
print PO $command, "\n" or die $!;
}
sub responder_send_file ($$) {
my ($keyword, $ourfn) = @_;
return unless $we_are_responder;
- printdebug "[[ $keyword $ourfn\n";
+ printdebug "]] $keyword $ourfn\n";
responder_send_command "file $keyword";
protocol_send_file \*PO, $ourfn;
}
sub responder_receive_files ($@) {
my ($keyword, @ourfns) = @_;
die unless $we_are_responder;
- printdebug "]] $keyword @ourfns\n";
+ printdebug "[[ $keyword @ourfns\n";
responder_send_command "want $keyword";
foreach my $fn (@ourfns) {
protocol_receive_file \*PI, $fn;
}
+ printdebug "[[\$\n";
protocol_expect { m/^files-end$/ } \*PI;
}
}
my $cversion = getfield $clogp, 'Version';
+ my $clogsuite = getfield $clogp, 'Distribution';
# We make the git tag by hand because (a) that makes it easier
# to control the "tagger" (b) we can do remote signing
tag $tag
tagger $authline
-$package release $cversion for $csuite [dgit]
+$package release $cversion for $clogsuite [dgit]
END
close TO or die $!;
responder_send_command("param head $head");
my $tfn = sub { ".git/dgit/tag$_[0]"; };
- my ($tagobjfn) =
- $we_are_responder
- ? responder_receive_files('signed-tag', $tfn->('.signed.tmp'))
- : push_mktag($head,$clogp,$tag,
- "../$dscfn",
- $changesfile,$changesfile,
- $tfn);
+ my $tagobjfn;
+
+ if ($we_are_responder) {
+ $tagobjfn = $tfn->('.signed.tmp');
+ responder_receive_files('signed-tag', $tagobjfn);
+ } else {
+ $tagobjfn =
+ push_mktag($head,$clogp,$tag,
+ "../$dscfn",
+ $changesfile,$changesfile,
+ $tfn);
+ }
my $tag_obj_hash = cmdoutput @git, qw(hash-object -w -t tag), $tagobjfn;
runcmd_ordryrun @git, qw(verify-tag), $tag_obj_hash;
};
i_method "i_resp", $icmd, $iargs;
}
-
- my $pid = $i_child_pid;
- $i_child_pid = undef; # prevents killing some other process with same pid
- printdebug "waiting for remote child $pid...";
- my $got = waitpid $pid, 0;
- die $! unless $got == $pid;
- die "remote child failed $?" if $?;
-
- i_cleanup();
- exit 0;
}
sub i_resp_progress ($) {
}
sub i_resp_complete {
+ my $pid = $i_child_pid;
+ $i_child_pid = undef; # prevents killing some other process with same pid
+ printdebug "waiting for remote child $pid...\n";
+ my $got = waitpid $pid, 0;
+ die $! unless $got == $pid;
+ die "remote child failed $?" if $?;
+
i_cleanup();
+ printdebug "all done\n";
exit 0;
}
my $localpath = "$i_tmp/$localname";
stat $localpath and badproto \*RO, "file $keyword ($localpath) twice";
protocol_receive_file \*RO, $localpath;
+ i_method "i_file", $keyword;
}
our %i_param;
my ($keyword) = @_;
die "$keyword ?" if $i_wanted{$keyword}++;
my @localpaths = i_method "i_want", $keyword;
- printdebug "]] $keyword @localpaths\n";
+ printdebug "[[ $keyword @localpaths\n";
foreach my $localpath (@localpaths) {
protocol_send_file \*RI, $localpath;
}
- print RI "end-files\n" or die $!;
+ print RI "files-end\n" or die $!;
}
-our ($i_clogp, $i_version, $i_tag, $i_dscfn);
+our ($i_clogp, $i_version, $i_tag, $i_dscfn, $i_changesfn);
-sub i_localname_parsed_changelog { return "remote-changelog.822"; }
-sub i_localname_changes { return "remote.changes"; }
-sub i_localname_dsc {
+sub i_localname_parsed_changelog {
+ return "remote-changelog.822";
+}
+sub i_file_parsed_changelog {
($i_clogp, $i_version, $i_tag, $i_dscfn) =
push_parse_changelog "$i_tmp/remote-changelog.822";
die if $i_dscfn =~ m#/|^\W#;
+}
+
+sub i_localname_dsc {
+ defined $i_dscfn or badproto \*RO, "dsc (before parsed-changelog)";
return $i_dscfn;
}
+sub i_file_dsc { }
+
+sub i_localname_changes {
+ defined $i_dscfn or badproto \*RO, "dsc (before parsed-changelog)";
+ $i_changesfn = $i_dscfn;
+ $i_changesfn =~ s/\.dsc$/_dgit.changes/ or die;
+ return $i_changesfn;
+}
+sub i_file_changes { }
sub i_want_signed_tag {
printdebug Dumper(\%i_param, $i_dscfn);
- defined $i_param{'head'} && defined $i_dscfn
- or badproto \*RO, "sequencing error";
+ defined $i_param{'head'} && defined $i_dscfn && defined $i_clogp
+ or badproto \*RO, "premature desire for signed-tag";
my $head = $i_param{'head'};
die if $head =~ m/[^0-9a-f]/ || $head !~ m/^../;
- push_parse_dsc $i_dscfn, 'remote dsc',
+ push_parse_dsc $i_dscfn, 'remote dsc', $i_version;
- push_mktag $head, $i_clogp, $i_tag,
- $i_dscfn,
- 'remote.changes', 'remote changes',
- 'tag.tag';
+ my $tagobjfn =
+ push_mktag $head, $i_clogp, $i_tag,
+ $i_dscfn,
+ $i_changesfn, 'remote changes',
+ sub { "tag$_[0]"; };
- return 'tag.tag';
+ return $tagobjfn;
}
sub i_want_signed_dsc_changes {
rename "$i_dscfn.tmp","$i_dscfn" or die "$i_dscfn $!";
- sign_changes 'remote.changes';
- return ($i_dscfn, 'remote.changes');
+ sign_changes $i_changesfn;
+ return ($i_dscfn, $i_changesfn);
}
#---------- building etc. ----------