chiark / gitweb /
New --initiator-tempdir option.
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 22 Oct 2013 15:25:40 +0000 (16:25 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 22 Oct 2013 15:25:40 +0000 (16:25 +0100)
debian/changelog
dgit
dgit.1

index 5b350d01a16e3ee655cbc381f25475927d051977..c9becc7290c5a75744a4138e9991b60575c6987e 100644 (file)
@@ -4,6 +4,7 @@ dgit (0.17~experimental1) experimental; urgency=low
   * Improvements to implementation of --dry-run and --damp-run.
   * More fixes to remote implementation.
   * Report chdir actions in debugging output.
   * Improvements to implementation of --dry-run and --damp-run.
   * More fixes to remote implementation.
   * Report chdir actions in debugging output.
+  * New --initiator-tempdir option.
 
  -- Ian Jackson <ijackson@chiark.greenend.org.uk>  Tue, 22 Oct 2013 15:11:19 +0100
 
 
  -- Ian Jackson <ijackson@chiark.greenend.org.uk>  Tue, 22 Oct 2013 15:11:19 +0100
 
diff --git a/dgit b/dgit
index d31b9b1db9d306338896fa6dfae01a4b719fd672..60020fc2fe8d09ede9d17bc7d08c8900706b8037 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -46,6 +46,7 @@ our $noquilt = 0;
 our $existing_package = 'dpkg';
 our $cleanmode = 'dpkg-source';
 our $we_are_responder;
 our $existing_package = 'dpkg';
 our $cleanmode = 'dpkg-source';
 our $we_are_responder;
+our $initiator_tempdir;
 
 our %format_ok = map { $_=>1 } ("1.0","3.0 (native)","3.0 (quilt)");
 
 
 our %format_ok = map { $_=>1 } ("1.0","3.0 (native)","3.0 (quilt)");
 
@@ -1429,6 +1430,7 @@ our $i_tmp;
 sub i_cleanup {
     local ($@);
     return unless defined $i_tmp;
 sub i_cleanup {
     local ($@);
     return unless defined $i_tmp;
+    return if defined $initiator_tempdir;
     changedir "/";
     eval { rmtree $i_tmp; };
 }
     changedir "/";
     eval { rmtree $i_tmp; };
 }
@@ -1458,7 +1460,13 @@ sub cmd_rpush {
     my @cmd = (@ssh, $host, shellquote @rdgit);
     printcmd \*DEBUG,$debugprefix."+",@cmd;
     eval {
     my @cmd = (@ssh, $host, shellquote @rdgit);
     printcmd \*DEBUG,$debugprefix."+",@cmd;
     eval {
-       $i_tmp = tempdir();
+       if (defined $initiator_tempdir) {
+           rmtree $initiator_tempdir;
+           mkdir $initiator_tempdir, 0700 or die "$initiator_tempdir: $!";
+           $i_tmp = $initiator_tempdir;
+       } else {
+           $i_tmp = tempdir();
+       }
        my $pid = open2(\*RO, \*RI, @cmd);
        changedir $i_tmp;
        initiator_expect { m/^dgit-remote-push-ready/ };
        my $pid = open2(\*RO, \*RI, @cmd);
        changedir $i_tmp;
        initiator_expect { m/^dgit-remote-push-ready/ };
@@ -1767,6 +1775,11 @@ sub parseopts () {
            } elsif (m/^--existing-package=(.*)/s) {
                push @ropts, $_;
                $existing_package = $1;
            } elsif (m/^--existing-package=(.*)/s) {
                push @ropts, $_;
                $existing_package = $1;
+           } elsif (m/^--initiator-tempdir=(.*)/s) {
+               $initiator_tempdir = $1;
+               $initiator_tempdir =~ m#^/# or
+                   badusage "--initiator-tempdir must be used specify an".
+                       " absolute, not relative, directory."
            } elsif (m/^--distro=(.*)/s) {
                push @ropts, $_;
                $idistro = $1;
            } elsif (m/^--distro=(.*)/s) {
                push @ropts, $_;
                $idistro = $1;
diff --git a/dgit.1 b/dgit.1
index a4b4b1a70eeba5e53686e584d27c107d7e73c6c1..931b8310823c4a3d9d13e7e821f629cfd96581af 100644 (file)
--- a/dgit.1
+++ b/dgit.1
@@ -356,6 +356,15 @@ or use the value of this option.
 .TP
 .BR -h | --help
 Print a usage summary.
 .TP
 .BR -h | --help
 Print a usage summary.
+.TP
+.BI --initiator-tempdir= directory
+dgit rpush uses a temporary directory on the invoking (signing) host.
+This option causes dgit to use
+.I directory
+instead.  Furthermore, the specified directory will be emptied,
+removed and recreated before dgit starts, rather than removed
+after dgit finishes.  The directory specified must be an absolute
+pathname.
 .SH WORKFLOW - SIMPLE
 It is always possible with dgit to clone or fetch a package, make
 changes in git (using git-commit) on the suite branch
 .SH WORKFLOW - SIMPLE
 It is always possible with dgit to clone or fetch a package, make
 changes in git (using git-commit) on the suite branch