chiark / gitweb /
dgit: Support distro aliases
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 8 Jan 2017 11:26:24 +0000 (11:26 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 9 Jan 2017 02:18:16 +0000 (02:18 +0000)
We are going to use this to spot when we accidentally look up "debian"
information in the test suite.

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

index d3d41b3956be1768139182ceb2d8608d08420d19..f404d5aa269e0d0eccd3584ccfd90fb17dd880a0 100644 (file)
@@ -10,6 +10,9 @@ dgit (3.0~) unstable; urgency=medium
   * dgit config handling: Honour command-line and context-provided
     suite and distro more reliably and consistently.
 
+  Minor new feature:
+  * distro alias facility in config space.  (Primarily for testing.)
+
   dgit-badcommit-fixup: 
   * Do not investigate symrefs.  Closes:#850547.
 
diff --git a/dgit b/dgit
index 3ffcf77a7198501037d8566ee8a96722b2ef2b58..02d0b9298e3c8d9d7f5acae491f39b6099d8fbc4 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -691,7 +691,7 @@ sub cfg {
        "$us: distro or suite appears not to be (properly) supported";
 }
 
-sub access_basedistro () {
+sub access_basedistro__noalias () {
     if (defined $idistro) {
        return $idistro;
     } else {   
@@ -711,6 +711,12 @@ sub access_basedistro () {
     }
 }
 
+sub access_basedistro () {
+    my $noalias = access_basedistro__noalias();
+    my $canon = cfg("dgit-distro.$noalias.alias-canon",'RETURN-UNDEF');
+    return $canon // $noalias;
+}
+
 sub access_nomdistro () {
     my $base = access_basedistro();
     my $r = cfg("dgit-distro.$base.nominal-distro",'RETURN-UNDEF') // $base;