chiark / gitweb /
Quirks mechanism
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 19 Jan 2014 01:57:22 +0000 (01:57 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 19 Jan 2014 01:57:22 +0000 (01:57 +0000)
dgit

diff --git a/dgit b/dgit
index 5c0ea82..bb1d217 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -489,16 +489,30 @@ sub cfg {
     badcfg "need value for one of: @_";
 }
 
-sub access_distro () {
+sub access_basedistro () {
     return cfg("dgit-suite.$isuite.distro",
               "dgit.default.distro");
 }
 
+sub access_quirk () {
+    # returns (quirk name, distro to use instead, quirk-specific info)
+    my $basedistro = access_basedistro();
+    return ('none',$basedistro);
+}
+
+sub access_distro () {
+    return (access_quirk())[1];
+}
+
 sub access_cfg (@) {
     my (@keys) = @_;
+    my $basedistro = access_basedistro();
     my $distro = $idistro || access_distro();
-    my $value = cfg(map { ("dgit-distro.$distro.$_",
-                          "dgit.default.$_") } @keys);
+    my $value = cfg(map {
+       ("dgit-distro.$distro.$_",
+        "dgit-distro.$basedistro.$_",
+        "dgit.default.$_")
+                   } @keys);
     return $value;
 }