Blame SOURCES/0084-gentpl-add-disable-support.patch

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