chiark / gitweb /
Bugfixes (now tests/tests/drs-clone-nogit works)
[dgit.git] / infra / dgit-repos-server
index acff1727541491ace4bfc45ba4e56a63a7e40c84..f391b08776ada836a2720a7c6b429141178bdd85 100755 (executable)
@@ -148,6 +148,7 @@ open DEBUG, ">/dev/null" or die $!;
 our $func;
 our $dgitrepos;
 our $package;
+our $distro;
 our $suitesfile;
 our $policyhook;
 our $realdestrepo;
@@ -253,9 +254,9 @@ sub policyhook {
     my ($policyallowbits, @polargs) = @_;
     # => ($exitstatuspolicybitmap);
     die if $policyallowbits & ~0x3e;
-    my @cmd = ($policyhook,$distro,$repos,@polargs);
-    debugcmd @_;
-    my $r = system @_;
+    my @cmd = ($policyhook,$distro,$dgitrepos,@polargs);
+    debugcmd @cmd;
+    my $r = system @cmd;
     die "system: $!" if $r < 0;
     die "hook (@cmd) failed ($?)" if $r & ~($policyallowbits << 8);
     return $r >> 8;
@@ -295,17 +296,6 @@ sub movetogarbage () {
        or die "$garbagerepo $!";
 }
 
-sub onwardpush () {
-    my @cmd = (qw(git send-pack), $destrepo);
-    push @cmd, qw(--force) if $policy & NOFFCHECK;
-    push @cmd, "$commit:refs/dgit/$suite",
-              "$tagval:refs/tags/$tagname");
-    debugcmd @cmd;
-    $!=0;
-    my $r = system @cmd;
-    !$r or die "onward push to $destrepo failed: $r $!";
-}
-
 #----- git-receive-pack -----
 
 sub fixmissing__git_receive_pack () {
@@ -463,12 +453,14 @@ sub parsetag () {
     $version = $2;
     die "$3 != $suite " unless $3 eq $suite;
 
+    my $copyl = $_;
     for (;;) {
-       print PT or die $!;
+       print PT $copyl or die $!;
        $!=0; $_=<T>; defined or die "missing signature? $!";
+       $copyl = $_;
        if (m/^\[dgit ([^"].*)\]$/) { # [dgit "something"] is for future
            $_ = $1." ";
-           for (;;) {
+           while (length) {
                if (s/^distro\=(\S+) //) {
                    die "$1 != $distro" unless $1 eq $distro;
                } elsif (s/^(--deliberately-$package_re) //) {
@@ -478,13 +470,14 @@ sub parsetag () {
                    $supersedes{$1} = $2;
                } elsif (s/^[-+.=0-9a-z]\S* //) {
                } else {
-                   die "unknown dgit info in tag";
+                   die "unknown dgit info in tag ($_)";
                }
            }
            next;
        }
        last if m/^-----BEGIN PGP/;
     }
+    $_ = $copyl;
     for (;;) {
        print DS or die $!;
        $!=0; $_=<T>;
@@ -650,7 +643,7 @@ sub checktagnoreplay () {
 
     my @problems;
 
-    git_for_each_tag_referring($objreferring, sub {
+    git_for_each_tag_referring($onlyreferring, sub {
        my ($objid,$fullrefname,$tagname) = @_;
        debug "checktagnoreplay - overwriting $fullrefname=$objid";
        my $supers = $supersedes{$fullrefname};
@@ -697,7 +690,7 @@ sub checks () {
     lockrealtree();
 
     my @policy_args = ($package,$version,$suite,$tagname,
-                      join(",",@delberatelies));
+                      join(",",@deliberatelies));
     $policy = policyhook(NOFFCHECK|FRESHREPO, 'push', @policy_args);
 
     checktagnoreplay();
@@ -731,6 +724,17 @@ sub checks () {
     policyhook(0, 'push-confirm', @policy_args);
 }
 
+sub onwardpush () {
+    my @cmd = (qw(git send-pack), $destrepo);
+    push @cmd, qw(--force) if $policy & NOFFCHECK;
+    push @cmd, "$commit:refs/dgit/$suite",
+              "$tagval:refs/tags/$tagname";
+    debugcmd @cmd;
+    $!=0;
+    my $r = system @cmd;
+    !$r or die "onward push to $destrepo failed: $r $!";
+}
+
 sub stunthook () {
     debug "stunthook";
     chdir $workrepo or die "chdir $workrepo: $!";
@@ -805,7 +809,7 @@ sub parseargsdispatch () {
        exit 0;
     }
 
-    $ENV{'DGIT_DRS_DISTRO'} = argval();
+    $ENV{'DGIT_DRS_DISTRO'} = $distro = argval();
     $ENV{'DGIT_DRS_SUITES'} = argval();
     $ENV{'DGIT_DRS_KEYRINGS'} = argval();
     $dgitrepos = argval();