chiark / gitweb /
wip changes for remote push - split off sign_changes
[dgit.git] / dgit
diff --git a/dgit b/dgit
index b551eacd1e9c7a6fa73d49a612b72e1e088efc13..9d2d8769974355e5fcd7135225295cbb589d1c87 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -1127,6 +1127,16 @@ END
     return ($tagobjfn);
 }
 
+sub sign_changes ($) {
+    my ($changesfile) = @_;
+    if ($sign) {
+       my @debsign_cmd = @debsign;
+       push @debsign_cmd, "-k$keyid" if defined $keyid;
+       push @debsign_cmd, $changesfile;
+       runcmd_ordryrun @debsign_cmd;
+    }
+}
+
 sub dopush () {
     print DEBUG "actually entering push\n";
     prep_ud();
@@ -1222,19 +1232,15 @@ sub dopush () {
        }
     }
 
-    if ($sign) {
-       if ($we_are_responder) {
-           my $dryrunsuffix = $dryrun ? ".tmp" : "";
-           responder_receive_files('signed-changes-dsc',
-                                   "$changesfile$dryrunsuffix",
-                                   "../$dscfn$dryrunsuffix");
-       } else {
-           my @debsign_cmd = @debsign;
-           push @debsign_cmd, "-k$keyid" if defined $keyid;
-           push @debsign_cmd, $changesfile;
-           runcmd_ordryrun @debsign_cmd;
-       }
+    if ($we_are_responder) {
+       my $dryrunsuffix = $dryrun ? ".tmp" : "";
+       responder_receive_files('signed-dsc-changes',
+                               "../$dscfn$dryrunsuffix",
+                               "$changesfile$dryrupnsuffix");
+    } else {
+       sign_changes $changesfile;
     }
+
     runcmd_ordryrun @git, qw(push),access_giturl(),"refs/tags/$tag";
     my $host = access_cfg('upload-host','RETURN-UNDEF');
     my @hostarg = defined($host) ? ($host,) : ();
@@ -1406,7 +1412,45 @@ sub cmd_rpush {
     };
     i_cleanup();
     die $@;
+}
+
+sub i_resp_progress ($) {
+    my ($rhs) = @_;
+    my $msg = protocol_read_bytes \*RO, $rhs;
+    progress $msg;
+}
+
+sub i_resp_complete {
+    i_cleanup();
+    exit 0;
+}
+
+sub i_resp_file ($) {
+    my ($keyword) = @_;
+    my $localname = i_method "i_localname_", $keyword;
+    my $localpath = "$i_tmp/$localname";
+    stat $localpath and badproto \*RO, "file $keyword ($localpath) twice";
+    protocol_receive_file \*RO, $localpath;
+}
+
+sub i_resp_want ($) {
+    my ($keyword) = @_;
+    my @localpaths = i_method "i_want_", $keyword;
+    foreach my $localpath (@localpaths) {
+       protocol_send_file \*RI, $localpath;
     }
+    print RI "end-files\n" or die $!;
+}
+
+our ($i_clogp, $i_version, $i_tag, $i_dscfn);
+
+sub i_localname_parsed_changelog { return "remote-changelog.822"; }
+sub i_localname_changes { return "remote.changes"; }
+sub i_localname_dsc {
+    ($i_clogp, $i_version, $i_tag, $i_dscfn) =
+       push_parse_changelog 'remote-changelog.822';
+    die if $i_dscfn =~ m#/|^\W#;
+    return $dscfn;
 }
 
 #---------- building etc. ----------