chiark / gitweb /
Bring forward push of the version tag ref so it happens alongside the push of the...
[dgit.git] / dgit
diff --git a/dgit b/dgit
index bb1d217e962d238a23b5df5f8c51887708cf06dd..0a5de292378470888b334e3d5dd3cf9785a8112d 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -332,7 +332,7 @@ sub printcmd {
 }
 
 sub failedcmd {
-    { local ($!); printcmd \*STDERR, "$_[0]: failed command:", @_ or die $!; };
+    { local ($!); printcmd \*STDERR, "$us: failed command:", @_ or die $!; };
     if ($!) {
        fail "failed to fork/exec: $!";
     } elsif (!($? & 0xff)) {
@@ -457,6 +457,8 @@ our %defcfg = ('dgit.default.distro' => 'debian',
               'dgit-distro.debian.sshpsql-dbname' => 'service=projectb',
               'dgit-distro.debian.upload-host' => 'ftp-master', # for dput
               'dgit-distro.debian.mirror' => 'http://ftp.debian.org/debian/',
+ 'dgit-distro.debian.backports-quirk' => '%-backports*',
+ 'dgit-distro.debian-backports.mirror' => 'http://backports.debian.org/debian-backports/',
               'dgit-distro.test-dummy.ssh' => "$td/ssh",
               'dgit-distro.test-dummy.username' => "alice",
               'dgit-distro.test-dummy.git-check' => "ssh-cmd",
@@ -497,6 +499,17 @@ sub access_basedistro () {
 sub access_quirk () {
     # returns (quirk name, distro to use instead, quirk-specific info)
     my $basedistro = access_basedistro();
+    my $backports_quirk = cfg("dgit-distro.$basedistro.backports-quirk",
+                             'RETURN-UNDEF');
+    if (defined $backports_quirk) {
+       my $re = $backports_quirk;
+       $re =~ s/[^-0-9a-z_\%*]/\\$&/ig;
+       $re =~ s/\*/.*/g;
+       $re =~ s/\%/([-0-9a-z_]+)/ or badcfg "backports-quirk needs \%";
+       if ($isuite =~ m/^$re$/) {
+           return ('backports',"$basedistro-backports",$1);
+       }
+    }
     return ('none',$basedistro);
 }
 
@@ -614,7 +627,7 @@ sub archive_query ($) {
     my ($method) = @_;
     my $query = access_cfg('archive-query','RETURN-UNDEF');
     if (!defined $query) {
-       my $distro = access_distro();
+       my $distro = access_basedistro();
        if ($distro eq 'debian') {
            $query = "sshpsql:".
                access_someuserhost('sshpsql').':'.
@@ -824,6 +837,8 @@ sub check_for_git () {
        my $r= cmdoutput @cmd;
        failedcmd @cmd unless $r =~ m/^[01]$/;
        return $r+0;
+    } elsif ($how eq 'true') {
+       return 1;
     } else {
        badcfg "unknown git-check \`$how'";
     }
@@ -836,6 +851,8 @@ sub create_remote_git_repo () {
            (access_cfg_ssh, access_gituserhost(),
             "set -e; cd ".access_cfg('git-path').";".
             " cp -a _template $package.git");
+    } elsif ($how eq 'true') {
+       # nothing to do
     } else {
        badcfg "unknown git-create \`$how'";
     }
@@ -1418,6 +1435,7 @@ sub dopush () {
        create_remote_git_repo();
     }
     runcmd_ordryrun @git, qw(push),access_giturl(),"HEAD:".rrref();
+    runcmd_ordryrun @git, qw(push),access_giturl(),"refs/tags/$tag";
     runcmd_ordryrun @git, qw(update-ref -m), 'dgit push', lrref(), 'HEAD';
 
     if (!$we_are_responder) {
@@ -1437,7 +1455,6 @@ sub dopush () {
        sign_changes $changesfile;
     }
 
-    runcmd_ordryrun @git, qw(push),access_giturl(),"refs/tags/$tag";
     my $host = access_cfg('upload-host','RETURN-UNDEF');
     my @hostarg = defined($host) ? ($host,) : ();
     runcmd_ordryrun @dput, @hostarg, $changesfile;
@@ -1844,6 +1861,13 @@ sub changesopts () {
     my @opts =@changesopts[1..$#changesopts];
     if (!defined $changes_since_version) {
        my @vsns = archive_query('archive_query');
+       my @quirk = access_quirk();
+       if ($quirk[0] eq 'backports') {
+           local $isuite = $quirk[2];
+           local $csuite;
+           canonicalise_suite();
+           push @vsns, archive_query('archive_query');
+       }
        if (@vsns) {
            @vsns = map { $_->[0] } @vsns;
            @vsns = sort { -version_compare_string($a, $b) } @vsns;