From f7d222ee9782806cd05d7a82595c142096c3bd04 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 20 Jun 2015 16:12:12 +0100 Subject: [PATCH] Infra: Provide dgit clone-dgit-repos-server --- dgit | 9 +++++++++ dgit.1 | 4 ++++ infra/dgit-ssh-dispatch | 8 ++++++++ tests/tests/dsd-clone-drs | 17 +++++++++++++++++ 4 files changed, 38 insertions(+) create mode 100755 tests/tests/dsd-clone-drs diff --git a/dgit b/dgit index 863104bf..f314bdaa 100755 --- a/dgit +++ b/dgit @@ -2636,6 +2636,15 @@ sub cmd_archive_api_query { 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 { diff --git a/dgit.1 b/dgit.1 index ed4c6b18..72b16a05 100644 --- 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 +.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 diff --git a/infra/dgit-ssh-dispatch b/infra/dgit-ssh-dispatch index e1fc2412..377f8b81 100755 --- a/infra/dgit-ssh-dispatch +++ b/infra/dgit-ssh-dispatch @@ -139,6 +139,14 @@ sub dispatch () { } 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 ($_)"; } diff --git a/tests/tests/dsd-clone-drs b/tests/tests/dsd-clone-drs new file mode 100755 index 00000000..34741602 --- /dev/null +++ b/tests/tests/dsd-clone-drs @@ -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. -- 2.30.2