From caa11936c6ac7059d0e6f46612cebaf44d5c9115 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Tue, 22 Oct 2013 16:25:40 +0100 Subject: [PATCH] New --initiator-tempdir option. --- debian/changelog | 1 + dgit | 15 ++++++++++++++- dgit.1 | 9 +++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 5b350d01..c9becc72 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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. + * New --initiator-tempdir option. -- Ian Jackson Tue, 22 Oct 2013 15:11:19 +0100 diff --git a/dgit b/dgit index d31b9b1d..60020fc2 100755 --- a/dgit +++ b/dgit @@ -46,6 +46,7 @@ our $noquilt = 0; 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)"); @@ -1429,6 +1430,7 @@ our $i_tmp; sub i_cleanup { local ($@); return unless defined $i_tmp; + return if defined $initiator_tempdir; changedir "/"; eval { rmtree $i_tmp; }; } @@ -1458,7 +1460,13 @@ sub cmd_rpush { 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/ }; @@ -1767,6 +1775,11 @@ sub parseopts () { } 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; diff --git a/dgit.1 b/dgit.1 index a4b4b1a7..931b8310 100644 --- 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 +.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 -- 2.30.2