From 5dd559b5eaedf57a1081c03ab8602669c9e72e4a Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 6 Nov 2016 18:26:01 +0000 Subject: [PATCH] dgit: config: Allow dgit-suite.PATTERN.distro This is going to be useful for *-security. Signed-off-by: Ian Jackson --- debian/control | 2 +- dgit | 16 ++++++++++++++-- dgit.1 | 3 +++ 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/debian/control b/debian/control index 347caf72..8a2ad1aa 100644 --- a/debian/control +++ b/debian/control @@ -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 e6ab29ca..41b7ac84 100755 --- 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 9878c20e..07eb89c1 100644 --- 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. -- 2.30.2