public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [Patch] BaseTools: Support QuotedString for PREBUILD/POSTBUILD in DSC file
@ 2016-11-30  8:23 Yonghong Zhu
  2016-12-02  2:50 ` Gao, Liming
  0 siblings, 1 reply; 2+ messages in thread
From: Yonghong Zhu @ 2016-11-30  8:23 UTC (permalink / raw)
  To: edk2-devel; +Cc: Liming Gao

If the prebuild/postbuild script statement start with double quotations,
current tool report error, while DSC spec allow this usage. so update
tool to support it.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
---
 BaseTools/Source/Python/Workspace/WorkspaceDatabase.py | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py b/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
index 46179a3..e7bc87d 100644
--- a/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
+++ b/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
@@ -229,13 +229,25 @@ class DscBuildData(PlatformBuildClassObject):
                 ErrorCode, ErrorInfo = self._FlashDefinition.Validate('.fdf')
                 if ErrorCode != 0:
                     EdkLogger.error('build', ErrorCode, File=self.MetaFile, Line=Record[-1],
                                     ExtraData=ErrorInfo)
             elif Name == TAB_DSC_PREBUILD:
-                self._Prebuild = PathClass(NormPath(Record[2], self._Macros), GlobalData.gWorkspace)
+                PrebuildValue = Record[2]
+                if Record[2][0] == '"':
+                    if Record[2][-1] != '"':
+                        EdkLogger.error('build', FORMAT_INVALID, 'Missing double quotes in the end of %s statement.' % TAB_DSC_PREBUILD,
+                                    File=self.MetaFile, Line=Record[-1])
+                    PrebuildValue = Record[2][1:-1]
+                self._Prebuild = PathClass(NormPath(PrebuildValue, self._Macros), GlobalData.gWorkspace)
             elif Name == TAB_DSC_POSTBUILD:
-                self._Postbuild = PathClass(NormPath(Record[2], self._Macros), GlobalData.gWorkspace)
+                PostbuildValue = Record[2]
+                if Record[2][0] == '"':
+                    if Record[2][-1] != '"':
+                        EdkLogger.error('build', FORMAT_INVALID, 'Missing double quotes in the end of %s statement.' % TAB_DSC_POSTBUILD,
+                                    File=self.MetaFile, Line=Record[-1])
+                    PostbuildValue = Record[2][1:-1]
+                self._Postbuild = PathClass(NormPath(PostbuildValue, self._Macros), GlobalData.gWorkspace)
             elif Name == TAB_DSC_DEFINES_SUPPORTED_ARCHITECTURES:
                 self._SupArchList = GetSplitValueList(Record[2], TAB_VALUE_SPLIT)
             elif Name == TAB_DSC_DEFINES_BUILD_TARGETS:
                 self._BuildTargets = GetSplitValueList(Record[2])
             elif Name == TAB_DSC_DEFINES_SKUID_IDENTIFIER:
-- 
2.6.1.windows.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Patch] BaseTools: Support QuotedString for PREBUILD/POSTBUILD in DSC file
  2016-11-30  8:23 [Patch] BaseTools: Support QuotedString for PREBUILD/POSTBUILD in DSC file Yonghong Zhu
@ 2016-12-02  2:50 ` Gao, Liming
  0 siblings, 0 replies; 2+ messages in thread
From: Gao, Liming @ 2016-12-02  2:50 UTC (permalink / raw)
  To: Zhu, Yonghong, edk2-devel@lists.01.org

Reviewed-by: Liming Gao <liming.gao@intel.com>

-----Original Message-----
From: Zhu, Yonghong 
Sent: Wednesday, November 30, 2016 4:24 PM
To: edk2-devel@lists.01.org
Cc: Gao, Liming <liming.gao@intel.com>
Subject: [Patch] BaseTools: Support QuotedString for PREBUILD/POSTBUILD in DSC file

If the prebuild/postbuild script statement start with double quotations, current tool report error, while DSC spec allow this usage. so update tool to support it.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
---
 BaseTools/Source/Python/Workspace/WorkspaceDatabase.py | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py b/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
index 46179a3..e7bc87d 100644
--- a/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
+++ b/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
@@ -229,13 +229,25 @@ class DscBuildData(PlatformBuildClassObject):
                 ErrorCode, ErrorInfo = self._FlashDefinition.Validate('.fdf')
                 if ErrorCode != 0:
                     EdkLogger.error('build', ErrorCode, File=self.MetaFile, Line=Record[-1],
                                     ExtraData=ErrorInfo)
             elif Name == TAB_DSC_PREBUILD:
-                self._Prebuild = PathClass(NormPath(Record[2], self._Macros), GlobalData.gWorkspace)
+                PrebuildValue = Record[2]
+                if Record[2][0] == '"':
+                    if Record[2][-1] != '"':
+                        EdkLogger.error('build', FORMAT_INVALID, 'Missing double quotes in the end of %s statement.' % TAB_DSC_PREBUILD,
+                                    File=self.MetaFile, Line=Record[-1])
+                    PrebuildValue = Record[2][1:-1]
+                self._Prebuild = PathClass(NormPath(PrebuildValue, 
+ self._Macros), GlobalData.gWorkspace)
             elif Name == TAB_DSC_POSTBUILD:
-                self._Postbuild = PathClass(NormPath(Record[2], self._Macros), GlobalData.gWorkspace)
+                PostbuildValue = Record[2]
+                if Record[2][0] == '"':
+                    if Record[2][-1] != '"':
+                        EdkLogger.error('build', FORMAT_INVALID, 'Missing double quotes in the end of %s statement.' % TAB_DSC_POSTBUILD,
+                                    File=self.MetaFile, Line=Record[-1])
+                    PostbuildValue = Record[2][1:-1]
+                self._Postbuild = PathClass(NormPath(PostbuildValue, 
+ self._Macros), GlobalData.gWorkspace)
             elif Name == TAB_DSC_DEFINES_SUPPORTED_ARCHITECTURES:
                 self._SupArchList = GetSplitValueList(Record[2], TAB_VALUE_SPLIT)
             elif Name == TAB_DSC_DEFINES_BUILD_TARGETS:
                 self._BuildTargets = GetSplitValueList(Record[2])
             elif Name == TAB_DSC_DEFINES_SKUID_IDENTIFIER:
--
2.6.1.windows.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-12-02  2:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-30  8:23 [Patch] BaseTools: Support QuotedString for PREBUILD/POSTBUILD in DSC file Yonghong Zhu
2016-12-02  2:50 ` Gao, Liming

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox