]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools/Source/Python: Verify TAB_TOD_DEFINES_FAMILY key present
authorMichael D Kinney <michael.d.kinney@intel.com>
Tue, 20 Apr 2021 17:28:12 +0000 (10:28 -0700)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Fri, 23 Apr 2021 18:55:51 +0000 (18:55 +0000)
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3344

Veify that TAB_TOD_DEFINES_FAMILY key is present in ToolDef
dictionary before access.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Yuwei Chen <yuwei.chen@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
BaseTools/Source/Python/AutoGen/ModuleAutoGenHelper.py
BaseTools/Source/Python/AutoGen/PlatformAutoGen.py

index 8e60643d1fd9cc4b21c6d03682f476e4c1b93351..7477b1d77fb8d92a8a7fde037a33e2fac925bcd1 100644 (file)
@@ -1,7 +1,7 @@
 ## @file\r
 # Create makefile for MS nmake and GNU make\r
 #\r
-# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2019 - 2021, Intel Corporation. All rights reserved.<BR>\r
 # SPDX-License-Identifier: BSD-2-Clause-Patent\r
 #\r
 from __future__ import absolute_import\r
@@ -178,8 +178,11 @@ class AutoGenInfo(object):
                 if ToolDef[Tool].get(TAB_TOD_DEFINES_BUILDRULEFAMILY, "") != "":\r
                     if Family != ToolDef[Tool][TAB_TOD_DEFINES_BUILDRULEFAMILY]:\r
                         continue\r
-                elif Family != ToolDef[Tool][TAB_TOD_DEFINES_FAMILY]:\r
-                    continue\r
+                else:\r
+                    if ToolDef[Tool].get(TAB_TOD_DEFINES_FAMILY, "") == "":\r
+                        continue\r
+                    if Family != ToolDef[Tool][TAB_TOD_DEFINES_FAMILY]:\r
+                        continue\r
                 FamilyMatch = True\r
             # expand any wildcard\r
             if Target == TAB_STAR or Target == self.BuildTarget:\r
@@ -213,6 +216,8 @@ class AutoGenInfo(object):
             if Tool not in ToolDef or Family == "":\r
                 continue\r
             # option has been added before\r
+            if TAB_TOD_DEFINES_FAMILY not in ToolDef[Tool]:\r
+                continue\r
             if Family != ToolDef[Tool][TAB_TOD_DEFINES_FAMILY]:\r
                 continue\r
 \r
index c16f2e4cd8b7e9a98cf6a52a42e84e827bbec596..e2ef3256773e1eceb65393eaf8eb3f58ca9701c7 100644 (file)
@@ -1474,8 +1474,11 @@ class PlatformAutoGen(AutoGen):
                 if ToolDef[Tool].get(TAB_TOD_DEFINES_BUILDRULEFAMILY, "") != "":\r
                     if Family != ToolDef[Tool][TAB_TOD_DEFINES_BUILDRULEFAMILY]:\r
                         continue\r
-                elif Family != ToolDef[Tool][TAB_TOD_DEFINES_FAMILY]:\r
-                    continue\r
+                else:\r
+                    if ToolDef[Tool].get(TAB_TOD_DEFINES_FAMILY, "") == "":\r
+                        continue\r
+                    if Family != ToolDef[Tool][TAB_TOD_DEFINES_FAMILY]:\r
+                        continue\r
                 FamilyMatch = True\r
             # expand any wildcard\r
             if Target == TAB_STAR or Target == self.BuildTarget:\r
@@ -1509,6 +1512,8 @@ class PlatformAutoGen(AutoGen):
             if Tool not in ToolDef or Family == "":\r
                 continue\r
             # option has been added before\r
+            if TAB_TOD_DEFINES_FAMILY not in ToolDef[Tool]:\r
+                continue\r
             if Family != ToolDef[Tool][TAB_TOD_DEFINES_FAMILY]:\r
                 continue\r
 \r