summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Jackson <ijackson@chiark.greenend.org.uk>2013-10-09 08:37:12 +0100
committerIan Jackson <ijackson@chiark.greenend.org.uk>2013-10-09 08:37:12 +0100
commitd51d076759bf65a31b74829e9afce28353b2379b (patch)
tree23a084aac00bef9b5726d37897aca4370aba5932
parentc8a91e6973d6fc51c83eb200dfeee6aa762373de (diff)
finish support and docs for DGIT_SSH etc. config
-rw-r--r--TODO2
-rw-r--r--debian/changelog1
-rwxr-xr-xdgit35
-rw-r--r--dgit.134
4 files changed, 65 insertions, 7 deletions
diff --git a/TODO b/TODO
index a5999fe..bf48ebc 100644
--- a/TODO
+++ b/TODO
@@ -1,3 +1 @@
---ssh= etc. @ssh should be in manual
-support SSH and DGIT_SSH
--dgit= etc. @dgit should be in manual
diff --git a/debian/changelog b/debian/changelog
index 34f6cdb..b628809 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -5,6 +5,7 @@ dgit (0.16~experimental2) experimental; urgency=low
* push actually takes an optional suite, like it says in the synopsis.
* Command execution reports from --dry-run go to stderr.
* Support --gpg=... to provide a replacement command for gpg.
+ * Support --ssh=... and --ssh:... to affect how we run ssh.
--
diff --git a/dgit b/dgit
index 3c24c2c..6a3f7b7 100755
--- a/dgit
+++ b/dgit
@@ -55,7 +55,7 @@ our (@dput) = qw(dput);
our (@debsign) = qw(debsign);
our (@gpg) = qw(gpg);
our (@sbuild) = qw(sbuild -A);
-our (@ssh) = qw(ssh);
+our (@ssh) = 'ssh';
our (@dgit) = qw(dgit);
our (@dpkgbuildpackage) = qw(dpkg-buildpackage -i\.git/ -I.git);
our (@dpkgsource) = qw(dpkg-source -i\.git/ -I.git);
@@ -447,6 +447,24 @@ sub access_cfg (@) {
return $value;
}
+sub string_to_ssh ($) {
+ my ($spec) = @_;
+ if ($spec =~ m/\s/) {
+ return qw(sh -ec), 'exec '.$spec.' "$@"', 'x';
+ } else {
+ return ($spec);
+ }
+}
+
+sub access_cfg_ssh () {
+ my $gitssh = access_cfg('ssh', 'RETURN-UNDEF');
+ if (!defined $gitssh) {
+ return @ssh;
+ } else {
+ return string_to_ssh $gitssh;
+ }
+}
+
sub access_someuserhost ($) {
my ($some) = @_;
my $user = access_cfg("$some-user",'username');
@@ -538,7 +556,7 @@ sub archive_query_sshdakls ($$) {
my ($proto,$data) = @_;
$data =~ s/:.*// or badcfg "invalid sshdakls method string \`$data'";
my $dakls = cmdoutput
- access_cfg('ssh'), $data, qw(dak ls -asource),"-s$isuite",$package;
+ access_cfg_ssh, $data, qw(dak ls -asource),"-s$isuite",$package;
return madison_parse($dakls);
}
@@ -546,7 +564,7 @@ sub canonicalise_suite_sshdakls ($$) {
my ($proto,$data) = @_;
$data =~ m/:/ or badcfg "invalid sshdakls method string \`$data'";
my @cmd =
- (access_cfg('ssh'), $`,
+ (access_cfg_ssh, $`,
"set -e; cd $';".
" if test -h $isuite; then readlink $isuite; exit 0; fi;".
" if test -d $isuite; then echo $isuite; exit 0; fi;".
@@ -627,7 +645,7 @@ sub check_for_git () {
my $how = access_cfg('git-check');
if ($how eq 'ssh-cmd') {
my @cmd =
- (access_cfg('ssh'),access_gituserhost(),
+ (access_cfg_ssh, access_gituserhost(),
" set -e; cd ".access_cfg('git-path').";".
" if test -d $package.git; then echo 1; else echo 0; fi");
my $r= cmdoutput @cmd;
@@ -642,7 +660,7 @@ sub create_remote_git_repo () {
my $how = access_cfg('git-create');
if ($how eq 'ssh-cmd') {
runcmd_ordryrun
- (access_cfg('ssh'),access_gituserhost(),
+ (access_cfg_ssh, access_gituserhost(),
"set -e; cd ".access_cfg('git-path').";".
" cp -a _template $package.git");
} else {
@@ -1669,6 +1687,13 @@ sub cmd_version {
sub parseopts () {
my $om;
+
+ if (defined $ENV{'DGIT_SSH'}) {
+ @ssh = string_to_ssh $ENV{'DGIT_SSH'};
+ } elsif (defined $ENV{'GIT_SSH'}) {
+ @ssh = ($ENV{'GIT_SSH'});
+ }
+
while (@ARGV) {
last unless $ARGV[0] =~ m/^-/;
$_ = shift @ARGV;
diff --git a/dgit.1 b/dgit.1
index 2f7cecc..11e2a5d 100644
--- a/dgit.1
+++ b/dgit.1
@@ -237,11 +237,27 @@ Specifies alternative programs to use instead of
.BR dpkg-genchanges ,
.BR sbuild ,
.BR gpg ,
+.BR ssh ,
or
.BR mergechanges .
For dpkg-buildpackage, dpkg-genchanges, mergechanges and sbuild,
this applies only when the program is invoked directly by dgit.
+
+For ssh, the default value is taken from the
+.B DGIT_SSH
+or
+.B GIT_SSH
+environment variables, if set (see below). And, for ssh, when accessing the
+archive and dgit-repos, this command line setting is overridden by the
+git config variables
+.BI dgit-distro. distro .ssh
+and
+.B .dgit.default.ssh
+(which can in turn be overridden with -c). Also, when dgit is using
+git to access dgit-repos, only git's idea of what ssh to use (eg,
+.BR GIT_SSH )
+is relevant.
.TP
.RI \fB--dget:\fR option |\fB--dput:\fR option |...
Specifies a single additional option to pass to
@@ -252,6 +268,7 @@ Specifies a single additional option to pass to
.BR dpkg-buildpackage ,
.BR dpkg-genchanges ,
.BR sbuild ,
+.BR ssh ,
or
.BR mergechanges .
Can be repeated as necessary.
@@ -261,6 +278,8 @@ this applies only when the program is invoked directly by dgit.
Usually, for passing options to dpkg-genchanges, you should use
.BR --ch: \fIoption\fR.
+See note above regarding ssh.
+
NB that --gpg:option is not supported (because debsign does not
have that facility). But see -k.
.TP
@@ -547,6 +566,21 @@ on the dgit command line.
.BR dgit.default. *
for each
.BR dgit-distro. \fIdistro\fR . *
+.SH ENVIRONMENT VARIABLES
+.TP
+.BR DGIT_SSH ", " GIT_SSH
+specify an alternative default program (and perhaps arguments) to use
+instead of ssh. DGIT_SSH is consulted first and may contain arguments;
+if it contains any whitespace will be passed to the shell. GIT_SSH
+specifies just the program; no arguments can be specified, so dgit
+interprets it the same way as git does.
+See
+also the --ssh= and --ssh: options.
+.TP
+.BR gpg ", " dpkg- "..., " debsign ", " git ", " dget ", " dput ", " LWP::UserAgent
+and other subprograms and modules used by dgit are affected by various
+environment variables. Consult the documentaton for those programs
+for details.
.SH BUGS
We should be using some kind of vhost/vpath setup for the git repos on
alioth, so that they can be moved later if and when this turns out to