[edk2] [Patch V2] BaseTools: Enhance error handling for unsupported toolchain Flags/Path

Yonghong Zhu posted 1 patch 6 years, 2 months ago
Failed in applying to current master (apply log)
BaseTools/Source/Python/AutoGen/GenMake.py | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
[edk2] [Patch V2] BaseTools: Enhance error handling for unsupported toolchain Flags/Path
Posted by Yonghong Zhu 6 years, 2 months ago
Case1: Cover the Tool PATH is not exist, eg: build MdeModule under GCC5
toolchain and IPF arch.
Case2: Cover the Tool FLAGS is not exist, eg: build OvmfPkg under
CLANG35 toolchain and X64 arch.

fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=595
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
---
 BaseTools/Source/Python/AutoGen/GenMake.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py b/BaseTools/Source/Python/AutoGen/GenMake.py
index 9df5d8e..afe6f2f 100644
--- a/BaseTools/Source/Python/AutoGen/GenMake.py
+++ b/BaseTools/Source/Python/AutoGen/GenMake.py
@@ -1,9 +1,9 @@
 ## @file
 # Create makefile for MS nmake and GNU make
 #
-# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
 # This program and the accompanying materials
 # are licensed and made available under the terms and conditions of the BSD License
 # which accompanies this distribution.  The full text of the license may be found at
 # http://opensource.org/licenses/bsd-license.php
 #
@@ -796,13 +796,17 @@ cleanlib:
                             for Flag in FlagDict.keys():
                                 if '$('+ Flag +')' in SingleCommandList[0]:
                                     Tool = Flag
                                     break
                         if Tool:
+                            if 'PATH' not in self._AutoGenObject._BuildOption[Tool]:
+                                EdkLogger.error("build", AUTOGEN_ERROR, "%s_PATH doesn't exist in %s ToolChain and %s Arch." %(Tool, self._AutoGenObject.ToolChain, self._AutoGenObject.Arch), ExtraData="[%s]" % str(self._AutoGenObject))
                             SingleCommandLength += len(self._AutoGenObject._BuildOption[Tool]['PATH'])
                             for item in SingleCommandList[1:]:
                                 if FlagDict[Tool]['Macro'] in item:
+                                    if 'FLAGS' not in self._AutoGenObject._BuildOption[Tool]:
+                                        EdkLogger.error("build", AUTOGEN_ERROR, "%s_FLAGS doesn't exist in %s ToolChain and %s Arch." %(Tool, self._AutoGenObject.ToolChain, self._AutoGenObject.Arch), ExtraData="[%s]" % str(self._AutoGenObject))
                                     Str = self._AutoGenObject._BuildOption[Tool]['FLAGS']
                                     for Option in self._AutoGenObject.BuildOption.keys():
                                         for Attr in self._AutoGenObject.BuildOption[Option]:
                                             if Str.find(Option + '_' + Attr) != -1:
                                                 Str = Str.replace('$(' + Option + '_' + Attr + ')', self._AutoGenObject.BuildOption[Option][Attr])
-- 
2.6.1.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [Patch V2] BaseTools: Enhance error handling for unsupported toolchain Flags/Path
Posted by Gao, Liming 6 years, 2 months ago
Reviewed-by: Liming Gao <liming.gao@intel.com>

>-----Original Message-----
>From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
>Yonghong Zhu
>Sent: Wednesday, February 07, 2018 9:55 AM
>To: edk2-devel@lists.01.org
>Subject: [edk2] [Patch V2] BaseTools: Enhance error handling for unsupported
>toolchain Flags/Path
>
>Case1: Cover the Tool PATH is not exist, eg: build MdeModule under GCC5
>toolchain and IPF arch.
>Case2: Cover the Tool FLAGS is not exist, eg: build OvmfPkg under
>CLANG35 toolchain and X64 arch.
>
>fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=595
>Contributed-under: TianoCore Contribution Agreement 1.1
>Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
>---
> BaseTools/Source/Python/AutoGen/GenMake.py | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
>diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py
>b/BaseTools/Source/Python/AutoGen/GenMake.py
>index 9df5d8e..afe6f2f 100644
>--- a/BaseTools/Source/Python/AutoGen/GenMake.py
>+++ b/BaseTools/Source/Python/AutoGen/GenMake.py
>@@ -1,9 +1,9 @@
> ## @file
> # Create makefile for MS nmake and GNU make
> #
>-# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>
>+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
> # This program and the accompanying materials
> # are licensed and made available under the terms and conditions of the BSD
>License
> # which accompanies this distribution.  The full text of the license may be
>found at
> # http://opensource.org/licenses/bsd-license.php
> #
>@@ -796,13 +796,17 @@ cleanlib:
>                             for Flag in FlagDict.keys():
>                                 if '$('+ Flag +')' in SingleCommandList[0]:
>                                     Tool = Flag
>                                     break
>                         if Tool:
>+                            if 'PATH' not in self._AutoGenObject._BuildOption[Tool]:
>+                                EdkLogger.error("build", AUTOGEN_ERROR, "%s_PATH
>doesn't exist in %s ToolChain and %s Arch." %(Tool,
>self._AutoGenObject.ToolChain, self._AutoGenObject.Arch),
>ExtraData="[%s]" % str(self._AutoGenObject))
>                             SingleCommandLength +=
>len(self._AutoGenObject._BuildOption[Tool]['PATH'])
>                             for item in SingleCommandList[1:]:
>                                 if FlagDict[Tool]['Macro'] in item:
>+                                    if 'FLAGS' not in self._AutoGenObject._BuildOption[Tool]:
>+                                        EdkLogger.error("build", AUTOGEN_ERROR, "%s_FLAGS
>doesn't exist in %s ToolChain and %s Arch." %(Tool,
>self._AutoGenObject.ToolChain, self._AutoGenObject.Arch),
>ExtraData="[%s]" % str(self._AutoGenObject))
>                                     Str = self._AutoGenObject._BuildOption[Tool]['FLAGS']
>                                     for Option in self._AutoGenObject.BuildOption.keys():
>                                         for Attr in self._AutoGenObject.BuildOption[Option]:
>                                             if Str.find(Option + '_' + Attr) != -1:
>                                                 Str = Str.replace('$(' + Option + '_' + Attr + ')',
>self._AutoGenObject.BuildOption[Option][Attr])
>--
>2.6.1.windows.1
>
>_______________________________________________
>edk2-devel mailing list
>edk2-devel@lists.01.org
>https://lists.01.org/mailman/listinfo/edk2-devel
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel