nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

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

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