summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/Python/Workspace
diff options
context:
space:
mode:
authorZhaozh1x <zhiqiangx.zhao@intel.com>2018-08-27 09:29:37 +0800
committerLiming Gao <liming.gao@intel.com>2018-09-03 10:14:44 +0800
commit24bd035c904fae1868bb15dc00cfa2e197cc5809 (patch)
tree313a7211e390215eb922f12d7776d742d50338b4 /BaseTools/Source/Python/Workspace
parentb8bcaafb39e8860a1fb672d75bb6f7bbdceb28bd (diff)
downloadedk2-24bd035c904fae1868bb15dc00cfa2e197cc5809.tar.gz
edk2-24bd035c904fae1868bb15dc00cfa2e197cc5809.tar.bz2
edk2-24bd035c904fae1868bb15dc00cfa2e197cc5809.zip
BaseTools: Check pcd DefaultValue and SkuId EBNF.
1. When assign dynamic hii pcd value in dsc file, missed the DefaultValue, build should be fail. 2. Check the EBNF of SkuId. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: ZhiqiangX Zhao <zhiqiangx.zhao@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Cc: Bob Feng <bob.c.feng@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
Diffstat (limited to 'BaseTools/Source/Python/Workspace')
-rw-r--r--BaseTools/Source/Python/Workspace/DscBuildData.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/Source/Python/Workspace/DscBuildData.py
index 7d6536c4b6..9055b257bd 100644
--- a/BaseTools/Source/Python/Workspace/DscBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
@@ -92,7 +92,7 @@ LIBS = -lCommon
'''
variablePattern = re.compile(r'[\t\s]*0[xX][a-fA-F0-9]+$')
-
+SkuIdPattern = re.compile(r'^[a-zA-Z_][a-zA-Z0-9_]*$')
## regular expressions for finding decimal and hex numbers
Pattern = re.compile('^[1-9]\d*|0$')
HexPattern = re.compile(r'0[xX][0-9a-fA-F]+$')
@@ -631,8 +631,8 @@ class DscBuildData(PlatformBuildClassObject):
if not Pattern.match(Record[0]) and not HexPattern.match(Record[0]):
EdkLogger.error('build', FORMAT_INVALID, "The format of the Sku ID number is invalid. It only support Integer and HexNumber",
File=self.MetaFile, Line=Record[-1])
- if not IsValidWord(Record[1]):
- EdkLogger.error('build', FORMAT_INVALID, "The format of the Sku ID name is invalid. The correct format is '(a-zA-Z0-9_)(a-zA-Z0-9_-.)*'",
+ if not SkuIdPattern.match(Record[1]) or (Record[2] and not SkuIdPattern.match(Record[2])):
+ EdkLogger.error('build', FORMAT_INVALID, "The format of the Sku ID name is invalid. The correct format is '(a-zA-Z_)(a-zA-Z0-9_)*'",
File=self.MetaFile, Line=Record[-1])
self._SkuIds[Record[1].upper()] = (str(DscBuildData.ToInt(Record[0])), Record[1].upper(), Record[2].upper())
if TAB_DEFAULT not in self._SkuIds: