15a207
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
15a207
From: Peter Jones <pjones@redhat.com>
15a207
Date: Wed, 11 Jul 2018 13:43:15 -0400
15a207
Subject: [PATCH] gentpl: add 'disable = ' support
15a207
15a207
Signed-off-by: Peter Jones <pjones@redhat.com>
15a207
---
15a207
 gentpl.py | 14 +++++++++++++-
15a207
 1 file changed, 13 insertions(+), 1 deletion(-)
15a207
15a207
diff --git a/gentpl.py b/gentpl.py
e15314
index f05812eace3..3a0c04963aa 100644
15a207
--- a/gentpl.py
15a207
+++ b/gentpl.py
e15314
@@ -592,11 +592,21 @@ def platform_conditional(platform, closure):
15a207
 #  };
15a207
 #
15a207
 def foreach_enabled_platform(defn, closure):
15a207
+    enabled = False
15a207
+    disabled = False
15a207
     if 'enable' in defn:
15a207
+        enabled = True
15a207
         for platform in GRUB_PLATFORMS:
15a207
             if platform_tagged(defn, platform, "enable"):
15a207
                platform_conditional(platform, closure)
15a207
-    else:
15a207
+
15a207
+    if 'disable' in defn:
15a207
+        disabled = True
15a207
+        for platform in GRUB_PLATFORMS:
15a207
+            if not platform_tagged(defn, platform, "disable"):
15a207
+                platform_conditional(platform, closure)
15a207
+
15a207
+    if not enabled and not disabled:
15a207
         for platform in GRUB_PLATFORMS:
15a207
             platform_conditional(platform, closure)
15a207
 
e15314
@@ -655,6 +665,8 @@ def first_time(defn, snippet):
15a207
 def is_platform_independent(defn):
15a207
     if 'enable' in defn:
15a207
         return False
15a207
+    if 'disable' in defn:
15a207
+        return False
15a207
     for suffix in [ "", "_nodist" ]:
15a207
         template = platform_values(defn, GRUB_PLATFORMS[0], suffix)
15a207
         for platform in GRUB_PLATFORMS[1:]: