dcavalca / rpms / grub2

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