chiark / gitweb /
dgit: config: Allow dgit-suite.PATTERN.distro
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 6 Nov 2016 18:26:01 +0000 (18:26 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 6 Nov 2016 18:27:30 +0000 (18:27 +0000)
This is going to be useful for *-security.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
debian/control
dgit
dgit.1

index 347caf723138b39e8afc9abfcc53a9a3f3226f1f..8a2ad1aa23005d317249feab281dbdf277d8ed22 100644 (file)
@@ -14,7 +14,7 @@ Depends: perl, libwww-perl, libdpkg-perl, git-core, devscripts, dpkg-dev,
          coreutils (>= 8.23-1~) | realpath,
          libdigest-sha-perl, dput, curl,
          libjson-perl, ca-certificates,
-         libtext-iconv-perl
+         libtext-iconv-perl, libtext-glob-perl
 Recommends: ssh-client, libtext-iconv-perl
 Suggests: sbuild
 Architecture: all
diff --git a/dgit b/dgit
index e6ab29caa60241ffffd499cad1eb530144350f0d..41b7ac845808bf554f56057b62ce2a86f533ff4e 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -36,6 +36,7 @@ use Digest::SHA;
 use Digest::MD5;
 use List::Util qw(any);
 use List::MoreUtils qw(pairwise);
+use Text::Glob qw(match_glob);
 use Carp;
 
 use Debian::Dgit;
@@ -694,8 +695,19 @@ sub access_basedistro () {
     if (defined $idistro) {
        return $idistro;
     } else {   
-       return cfg("dgit-suite.$isuite.distro",
-                  "dgit.default.distro");
+       my $def = cfg("dgit-suite.$isuite.distro", 'RETURN-UNDEF');
+       return $def if defined $def;
+       foreach my $src (@gitcfgsources, 'internal') {
+           my $kl = $src eq 'internal' ? \%defcfg : $gitcfgs{$src};
+           next unless $kl;
+           foreach my $k (keys %$kl) {
+               next unless $k =~ m#^dgit-suite\.(.*)\.distro$#;
+               my $dpat = $1;
+               next unless match_glob $dpat, $isuite;
+               return $kl->{$k};
+           }
+       }
+       return cfg("dgit.default.distro");
     }
 }
 
diff --git a/dgit.1 b/dgit.1
index 9878c20e258492d247a749ede48473d0ab1013f9..07eb89c16e651da9582e9c503140f74dd47c0dd0 100644 (file)
--- a/dgit.1
+++ b/dgit.1
@@ -879,6 +879,9 @@ Settings likely to be useful for an end user include:
 Specifies the distro for a suite.  dgit keys off the suite name (which
 appears in changelogs etc.), and uses that to determine the distro
 which is involved.  The config used is thereafter that for the distro.
+
+.I suite
+may be a glob pattern.
 .TP
 .BI dgit.default.distro " distro"
 The default distro for an unknown suite.