chiark / gitweb /
Infra: Provide dgit clone-dgit-repos-server
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 20 Jun 2015 15:12:12 +0000 (16:12 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 20 Jun 2015 15:12:38 +0000 (16:12 +0100)
dgit
dgit.1
infra/dgit-ssh-dispatch
tests/tests/dsd-clone-drs [new file with mode: 0755]

diff --git a/dgit b/dgit
index 863104bfd709bb32e601772cc1976c3bcc3ad5a9..f314bdaa05af30ca9814c0adbe850726ed23444d 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -2636,6 +2636,15 @@ sub cmd_archive_api_query {
     exec @cmd or fail "exec curl: $!\n";
 }
 
     exec @cmd or fail "exec curl: $!\n";
 }
 
+sub cmd_clone_dgit_repos_server {
+    badusage "need destination argument" unless @ARGV==1;
+    my ($destdir) = @ARGV;
+    $package = '_dgit-repos-server';
+    my @cmd = (@git, qw(clone), access_giturl(), $destdir);
+    debugcmd ">",@cmd;
+    exec @cmd or fail "exec git clone: $!\n";
+}
+
 #---------- argument parsing and main program ----------
 
 sub cmd_version {
 #---------- argument parsing and main program ----------
 
 sub cmd_version {
diff --git a/dgit.1 b/dgit.1
index ed4c6b18419372d7d3185cb10091eacb1a5f8585..72b16a05ba79dbfd528073ddc84a50bdeb54657f 100644 (file)
--- a/dgit.1
+++ b/dgit.1
@@ -202,6 +202,10 @@ ask it to generate a single squashed patch instead.
 .TP
 .B dgit version
 Prints version information and exits.
 .TP
 .B dgit version
 Prints version information and exits.
+.TP
+.BI "dgit clone-dgit-repos-server" " destdir"
+Tries to fetch a copy of the source code for the dgit-repos-server,
+as actually being used on the dgit git server, as a git tree.
 .SH OPTIONS
 .TP
 .BR --dry-run | -n
 .SH OPTIONS
 .TP
 .BR --dry-run | -n
index e1fc241250a997d04eed57b584454bd615c032c6..377f8b81d6786ba706ea73e75e0ac2aa6c3043d2 100755 (executable)
@@ -139,6 +139,14 @@ sub dispatch () {
        } else {
            die "unsupported git operation $cmd ($_)";
        }
        } else {
            die "unsupported git operation $cmd ($_)";
        }
+    } elsif (
+ m#^${qre}git-upload-pack ${qre}/dgit/($lre)/(?:repos/)?_dgit-repos-server\.git${qre}$#
+       ) {
+       my $distro= $1;
+       serve_up("$dispatchdir/distro=$1/dgit-live/.git");
+    } elsif (m#^${qre}git-upload-pack\s#) {
+       die "unknown repo to serve ($_).  use dgit, or for server source ".
+           "git clone here:/dgit/DISTRO/repos/_dgit-repos-server.git";
     } else {
        die "unsupported operation ($_)";
     }
     } else {
        die "unsupported operation ($_)";
     }
diff --git a/tests/tests/dsd-clone-drs b/tests/tests/dsd-clone-drs
new file mode 100755 (executable)
index 0000000..3474160
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/bash
+set -e
+. tests/lib
+if ! test -d $root/.git; then
+       echo >&2 'not running out of git clone, cannot test self-clone'
+       exit 0
+fi
+
+t-dsd
+
+cd $tmp
+t-dgit clone-dgit-repos-server drs-cloned
+
+cd drs-cloned
+ls -al infra/dgit-repos-server
+
+echo ok.