nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone
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
b71686
index bf8439fa7..a8cd54055 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:]: