nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

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

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