chiark / gitweb /
Infra: Support not running out of working tree
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 20 Jun 2015 18:13:07 +0000 (19:13 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 20 Jun 2015 18:15:13 +0000 (19:15 +0100)
infra/dgit-repos-policy-debian
infra/dgit-repos-server
infra/dgit-ssh-dispatch
tests/lib

index a770c55ec07d40e5858c2c782c41934a6ecab8f1..339081e93987c569783665c10aef56c80dbcb663 100755 (executable)
@@ -86,7 +86,9 @@ our %deliberately;
 sub apiquery ($) {
     my ($subpath) = @_;
     local $/=undef;
 sub apiquery ($) {
     my ($subpath) = @_;
     local $/=undef;
-    my $cmd = "$dgitlive/dgit -d$distro \$DGIT_TEST_OPTS";
+    my $dgit = "$dgitlive/dgit";
+    $dgit = "dgit" if !stat_exists $dgit;
+    my $cmd = "$dgit -d$distro \$DGIT_TEST_OPTS";
     $cmd .= " -".("D" x $debuglevel) if $debuglevel;
     $cmd .= " archive-api-query $subpath";
     printdebug "apiquery $cmd\n";
     $cmd .= " -".("D" x $debuglevel) if $debuglevel;
     $cmd .= " archive-api-query $subpath";
     printdebug "apiquery $cmd\n";
index b43d5745bfe2d472e6422543083a169027ea9ada..50cba57082ddc385d22afd1f3fba23b8853eb27d 100755 (executable)
@@ -163,7 +163,8 @@ $SIG{__WARN__} = sub { die $_[0]; };
 # appropriate lock.
 #
 # If policy hook wants to run dgit (or something else in the dgit
 # appropriate lock.
 #
 # If policy hook wants to run dgit (or something else in the dgit
-# package), it should use DGIT-LIVE-DIR/dgit (etc.)
+# package), it should use DGIT-LIVE-DIR/dgit (etc.), or if that is
+# ENOENT, use the installed version.
 
 
 use POSIX;
 
 
 use POSIX;
index f5250555bb44ad3ce8cb1c8e5b00ef50ac4a28e3..6d4efbff655d61d0b746f96d00cb540266677ff0 100755 (executable)
@@ -22,7 +22,7 @@ our $lre = $package_re;
 our $qre = '["'."']?";
 
 # $dispatchdir/distro=DISTRO should contain
 our $qre = '["'."']?";
 
 # $dispatchdir/distro=DISTRO should contain
-#    dgit-live   a clone of dgit
+#    dgit-live          a clone of dgit (only if not using installed vsns)
 #    diverts
 #    repos/             }  by virtue of
 #    suites             }    dgit-repos-server's defaults relating to
 #    diverts
 #    repos/             }  by virtue of
 #    suites             }    dgit-repos-server's defaults relating to
@@ -134,6 +134,7 @@ sub dispatch () {
            $ENV{'PERLLIB'} =~ s#^(?=.)#:#;
            $ENV{'PERLLIB'} =~ s#^# $ENV{DGIT_TEST_INTREE} // $dgitlive #e;
            my $s = "$dgitlive/infra/dgit-repos-server";
            $ENV{'PERLLIB'} =~ s#^(?=.)#:#;
            $ENV{'PERLLIB'} =~ s#^# $ENV{DGIT_TEST_INTREE} // $dgitlive #e;
            my $s = "$dgitlive/infra/dgit-repos-server";
+           $s = "dgit-repos-server" if !stat_exists $s;
            exec $s, $distro, $d, $authrune, qw(--ssh);
            die "exec $s: $!";
        } elsif ($cmd eq 'upload-pack') {
            exec $s, $distro, $d, $authrune, qw(--ssh);
            die "exec $s: $!";
        } elsif ($cmd eq 'upload-pack') {
@@ -146,6 +147,8 @@ sub dispatch () {
  m#^${qre}git-upload-pack ${qre}/dgit/($lre)/(?:repos/)?_dgit-repos-server\.git${qre}$#
        ) {
        my $distro= $1;
  m#^${qre}git-upload-pack ${qre}/dgit/($lre)/(?:repos/)?_dgit-repos-server\.git${qre}$#
        ) {
        my $distro= $1;
+       # if running installed packages, source code should come
+       # some other way
        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 ".
        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 ".
index 70ad0b186d31ecc244717b355bd99ee02e160329..22ae0ff5052a9f349319fc22ffec6ea09b8f1eff 100644 (file)
--- a/tests/lib
+++ b/tests/lib
@@ -481,16 +481,10 @@ t-drs () {
        drs_dispatch=$tmp/distro=test-dummy
        mkdir $drs_dispatch
 
        drs_dispatch=$tmp/distro=test-dummy
        mkdir $drs_dispatch
 
-       if [ "x$DGIT_TEST_INTREE" = x ]; then
-               cat >&2 <<END
-dgit-repos-server is designed to run out of a git working tree
-cannot be tested in installed package (as DEP-8-intends)
-test skipped
-END
-               exit 0
+       if [ "x$DGIT_TEST_INTREE" != x ]; then
+               ln -sf "$DGIT_TEST_INTREE" $drs_dispatch/dgit-live
        fi
 
        fi
 
-       ln -sf $root $drs_dispatch/dgit-live
        ln -sf $tmp/git $drs_dispatch/repos
        ln -sf $tmp/suites $tmp/dm.txt $drs_dispatch/
        mkdir -p $drs_dispatch/keyrings
        ln -sf $tmp/git $drs_dispatch/repos
        ln -sf $tmp/suites $tmp/dm.txt $drs_dispatch/
        mkdir -p $drs_dispatch/keyrings