public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Gao, Liming" <liming.gao@intel.com>
To: "Zhu, Yonghong" <yonghong.zhu@intel.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Subject: Re: [Patch] BaseTools: Add DefaultStore section format Check
Date: Tue, 23 Jan 2018 02:01:08 +0000	[thread overview]
Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E1AA96B@SHSMSX104.ccr.corp.intel.com> (raw)
In-Reply-To: <1516600077-8784-1-git-send-email-yonghong.zhu@intel.com>

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: Monday, January 22, 2018 1:48 PM
> To: edk2-devel@lists.01.org
> Subject: [edk2] [Patch] BaseTools: Add DefaultStore section format Check
> 
> This patch add DefaultStore section format Check and it use same logic
> with SKUID section.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
> ---
>  BaseTools/Source/Python/Workspace/DscBuildData.py   | 8 ++++++++
>  BaseTools/Source/Python/Workspace/MetaFileParser.py | 2 +-
>  2 files changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/Source/Python/Workspace/DscBuildData.py
> index 752fe05..16fe608 100644
> --- a/BaseTools/Source/Python/Workspace/DscBuildData.py
> +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
> @@ -606,10 +606,18 @@ class DscBuildData(PlatformBuildClassObject):
>                      EdkLogger.error('build', FORMAT_INVALID, 'No DefaultStores ID number',
>                                      File=self.MetaFile, Line=Record[-1])
>                  if Record[1] in [None, '']:
>                      EdkLogger.error('build', FORMAT_INVALID, 'No DefaultStores ID name',
>                                      File=self.MetaFile, Line=Record[-1])
> +                Pattern = re.compile('^[1-9]\d*|0$')
> +                HexPattern = re.compile(r'0[xX][0-9a-fA-F]+$')
> +                if Pattern.match(Record[0]) == None and HexPattern.match(Record[0]) == None:
> +                    EdkLogger.error('build', FORMAT_INVALID, "The format of the DefaultStores 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 DefaultStores ID name is invalid. The correct
> format is '(a-zA-Z0-9_)(a-zA-Z0-9_-.)*'",
> +                                    File=self.MetaFile, Line=Record[-1])
>                  self.DefaultStores[Record[1].upper()] = (self.ToInt(Record[0]),Record[1].upper())
>              if TAB_DEFAULT_STORES_DEFAULT not in self.DefaultStores:
>                  self.DefaultStores[TAB_DEFAULT_STORES_DEFAULT] = (0,TAB_DEFAULT_STORES_DEFAULT)
>              GlobalData.gDefaultStores = self.DefaultStores.keys()
>              if GlobalData.gDefaultStores:
> diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py b/BaseTools/Source/Python/Workspace/MetaFileParser.py
> index e236732..202093a 100644
> --- a/BaseTools/Source/Python/Workspace/MetaFileParser.py
> +++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py
> @@ -1103,11 +1103,11 @@ class DscParser(MetaFileParser):
>          self._ValueList[0:len(TokenList)] = TokenList
>      @ParseMacro
>      def _DefaultStoresParser(self):
>          TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT)
>          if len(TokenList) != 2:
> -            EdkLogger.error('Parser', FORMAT_INVALID, "Correct format is '<Integer>|<UiName>'",
> +            EdkLogger.error('Parser', FORMAT_INVALID, "Correct format is '<Number>|<UiName>'",
>                              ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1)
>          self._ValueList[0:len(TokenList)] = TokenList
> 
>      ## Parse Edk style of library modules
>      @ParseMacro
> --
> 2.6.1.windows.1
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel


      reply	other threads:[~2018-01-23  1:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-22  5:47 [Patch] BaseTools: Add DefaultStore section format Check Yonghong Zhu
2018-01-23  2:01 ` Gao, Liming [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A89E2EF3DFEDB4C8BFDE51014F606A14E1AA96B@SHSMSX104.ccr.corp.intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox