chiark
/
gitweb
/
~ianmdlvl
/
dgit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Infra: dgit-ssh-dispatch: Break out serve_up (nfc)
[dgit.git]
/
infra
/
dgit-ssh-dispatch
diff --git
a/infra/dgit-ssh-dispatch
b/infra/dgit-ssh-dispatch
index ed1e6ef9924e4f421d353388d97b552fbcd0cff5..e90687cb65d292f95e6279d444b397b0c2e6a8fb 100755
(executable)
--- a/
infra/dgit-ssh-dispatch
+++ b/
infra/dgit-ssh-dispatch
@@
-3,6
+3,8
@@
use strict;
use POSIX;
use strict;
use POSIX;
+use Debian::Dgit;
+
open DEBUG, '>/dev/null' or die $!;
if (@ARGV && $ARGV[0] eq '-D') {
shift @ARGV;
open DEBUG, '>/dev/null' or die $!;
if (@ARGV && $ARGV[0] eq '-D') {
shift @ARGV;
@@
-16,22
+18,22
@@
$authrune //= join ':',
'@/keyrings/debian-keyring.gpg,a',
'@/keyrings/debian-maintainers.gpg,m@/dm.txt';
'@/keyrings/debian-keyring.gpg,a',
'@/keyrings/debian-maintainers.gpg,m@/dm.txt';
-our $lre =
'[0-9a-z][-+.0-9a-z]*'
;
+our $lre =
$package_re
;
our $qre = '["'."']?";
our $qre = '["'."']?";
-# $dispatchdir should contain
+# $dispatchdir
/distro=DISTRO
should contain
# dgit-live a clone of dgit
# dgit-live a clone of dgit
-# repos/
-# suites
# diverts
# diverts
-# policy-hook
+# repos/ } by virtue of
+# suites } dgit-repos-server's defaults relating to
+# policy-hook } dispatch-dir
# plus files required by the authrune (by default, keyrings/ and dm.txt)
#
# diverts should be list of
# <pat> [<divert-to>]
# where <pat> is a package name pattern which may contain * or literals.
# plus files required by the authrune (by default, keyrings/ and dm.txt)
#
# diverts should be list of
# <pat> [<divert-to>]
# where <pat> is a package name pattern which may contain * or literals.
-our ($distro,$pkg);
+our ($distro,$pkg
, $d
);
our ($dgitlive,$repos,$suites,$diverts,$policyhook,$repo);
sub checkdivert ($) {
our ($dgitlive,$repos,$suites,$diverts,$policyhook,$repo);
sub checkdivert ($) {
@@
-71,7
+73,7
@@
sub selectpackage ($$;$) {
my $divertfn;
($distro,$pkg, $divertfn) = @_; # $distro,$pkg must have sane syntax
my $divertfn;
($distro,$pkg, $divertfn) = @_; # $distro,$pkg must have sane syntax
-
my
$d = "$dispatchdir/distro=$distro";
+ $d = "$dispatchdir/distro=$distro";
if (!stat $d) {
die $! unless $!==ENOENT;
if (!stat $d) {
die $! unless $!==ENOENT;
@@
-109,6
+111,12
@@
sub hasrepo () {
}
}
}
}
+sub serve_up ($) {
+ my ($repo) = @_;
+ exec qw(git upload-pack --strict --timeout=1000), $repo;
+ die "exec git: $!";
+}
+
sub dispatch () {
local ($_) = $ENV{'SSH_ORIGINAL_COMMAND'};
sub dispatch () {
local ($_) = $ENV{'SSH_ORIGINAL_COMMAND'};
@@
-123,13
+131,11
@@
sub dispatch () {
selectpackage $2,$3;
if ($cmd eq 'receive-pack') {
my $s = "$dgitlive/infra/dgit-repos-server";
selectpackage $2,$3;
if ($cmd eq 'receive-pack') {
my $s = "$dgitlive/infra/dgit-repos-server";
- exec $s, $distro, $suites, $authrune, $repos,
- $policyhook, qw(--ssh);
+ exec $s, $distro, $d, $authrune, qw(--ssh);
die "exec $s: $!";
} elsif ($cmd eq 'upload-pack') {
$repo='$repos/_empty' unless hasrepo;
die "exec $s: $!";
} elsif ($cmd eq 'upload-pack') {
$repo='$repos/_empty' unless hasrepo;
- exec qw(git upload-pack --strict --timeout=1000), $repo;
- die "exec git: $!";
+ serve_up $repo;
} else {
die "unsupported git operation $cmd ($_)";
}
} else {
die "unsupported git operation $cmd ($_)";
}