public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Laszlo Ersek <lersek@redhat.com>
To: Jaben Carsey <jaben.carsey@intel.com>
Cc: edk2-devel@lists.01.org, Liming Gao <liming.gao@intel.com>
Subject: Re: [PATCH v1 17/27] BaseTools: DataType - cleanup list constants
Date: Fri, 4 May 2018 13:14:40 +0200	[thread overview]
Message-ID: <814bebab-3b06-ce21-4fbb-326cc0a49121@redhat.com> (raw)
In-Reply-To: <c8410b977666561b40e92e5ce4d1ffb088576c6b.1524239027.git.jaben.carsey@intel.com>

Hi,

On 04/20/18 17:51, Jaben Carsey wrote:
> remove unused ones
> convert lists used for membership testing to sets
> use shared ones not local ones
>
> Cc: Liming Gao <liming.gao@intel.com>
> Cc: Yonghong Zhu <yonghong.zhu@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
> ---
>  BaseTools/Source/Python/AutoGen/AutoGen.py           | 32 ++++++++---------
>  BaseTools/Source/Python/AutoGen/GenC.py              | 36 ++++++++------------
>  BaseTools/Source/Python/AutoGen/GenPcdDb.py          |  4 +--
>  BaseTools/Source/Python/Common/DataType.py           | 29 ++++++----------
>  BaseTools/Source/Python/Ecc/Configuration.py         |  2 +-
>  BaseTools/Source/Python/Ecc/c.py                     |  2 +-
>  BaseTools/Source/Python/GenFds/FdfParser.py          |  2 +-
>  BaseTools/Source/Python/GenFds/Ffs.py                | 20 +----------
>  BaseTools/Source/Python/GenFds/OptRomInfStatement.py |  1 -
>  BaseTools/Source/Python/Workspace/InfBuildData.py    |  2 +-
>  BaseTools/Source/Python/Workspace/MetaFileParser.py  |  4 +--
>  BaseTools/Source/Python/build/build.py               |  4 +--
>  12 files changed, 53 insertions(+), 85 deletions(-)

I think this patch (commit eece4292acc80) broke the Ecc tool:

> diff --git a/BaseTools/Source/Python/Ecc/Configuration.py b/BaseTools/Source/Python/Ecc/Configuration.py
> index b523858e1b1f..b5b583be8c4a 100644
> --- a/BaseTools/Source/Python/Ecc/Configuration.py
> +++ b/BaseTools/Source/Python/Ecc/Configuration.py
> @@ -53,7 +53,7 @@ class Configuration(object):
>
>          # List customized Modifer here, split with ','
>          # Defaultly use the definition in class DataType
> -        self.ModifierList = MODIFIER_LIST
> +        self.ModifierSet = MODIFIER_SET
>
>          ## General Checking
>          self.GeneralCheckAll = 0

When I run Ecc, it prints:

  BaseTools/Source/Python/Ecc/config.ini(44): error F004: Invalid
  configuration option 'ModifierList' was found

The error comes from "BaseTools/Source/Python/Ecc/Configuration.py":

        LineNo = 0
        for Line in open(Filepath, 'r'):
            LineNo = LineNo + 1
            Line = CleanString(Line)
            if Line != '':
                List = GetSplitValueList(Line, TAB_EQUAL_SPLIT)
                if List[0] not in self.__dict__:
                    ErrorMsg = "Invalid configuration option '%s' was found" % List[0]
                    EdkLogger.error("Ecc", EdkLogger.ECC_ERROR, ErrorMsg, File = Filepath, Line = LineNo)
                if List[0] == 'ModifierList':
                    List[1] = GetSplitValueList(List[1], TAB_COMMA_SPLIT)
                if List[0] == 'MetaDataFileCheckPathOfGenerateFileList' and List[1] == "":
                    continue
                if List[0] == 'SkipDirList':
                    List[1] = GetSplitValueList(List[1], TAB_COMMA_SPLIT)
                if List[0] == 'SkipFileList':
                    List[1] = GetSplitValueList(List[1], TAB_COMMA_SPLIT)
                if List[0] == 'BinaryExtList':
                    List[1] = GetSplitValueList(List[1], TAB_COMMA_SPLIT)
                if List[0] == 'Copyright':
                    List[1] = GetSplitValueList(List[1], TAB_COMMA_SPLIT)
                self.__dict__[List[0]] = List[1]

Basically, the condition

  List[0] not in self.__dict__

expects that option names in the "config.ini" file match the attributes
/ members of the Python object directly. Thus, if we rename a member,
such as from "ModifierList" to "ModifierSet", then all the config files
that used to contain "ModifierList" now have to rename their
"ModifierList" options to "ModifierSet" as well.

This looks brittle to me; option names in config files are public, while
object member names are an implementation detail. They shouldn't be
coupled.

Thanks
Laszlo


  reply	other threads:[~2018-05-04 11:14 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-20 15:51 [PATCH v1 00/27] BaseTools refactoring Jaben Carsey
2018-04-20 15:51 ` [PATCH v1 01/27] BaseTools: Misc - refactor RegEx to minimize multiple compiling Jaben Carsey
2018-04-25  8:49   ` Zhu, Yonghong
2018-04-20 15:51 ` [PATCH v1 02/27] BaseTools: GenPatchPcdTable " Jaben Carsey
2018-04-25  8:50   ` Zhu, Yonghong
2018-04-20 15:51 ` [PATCH v1 03/27] BaseTools: Share RegEx between files Jaben Carsey
2018-04-25  8:51   ` Zhu, Yonghong
2018-04-20 15:51 ` [PATCH v1 04/27] BaseTools: Workspace - refactor RegEx to minimize multiple compiling Jaben Carsey
2018-04-25  8:50   ` Zhu, Yonghong
2018-04-20 15:51 ` [PATCH v1 05/27] BaseTools: Autogen - replace string constants with those from DataType Jaben Carsey
2018-04-25  8:50   ` Zhu, Yonghong
2018-04-20 15:51 ` [PATCH v1 06/27] BaseTools: simplify if call Jaben Carsey
2018-04-25  8:50   ` Zhu, Yonghong
2018-04-20 15:51 ` [PATCH v1 07/27] BaseTools: Workspace - refactor GetStructurePcdInfo Jaben Carsey
2018-04-25  8:50   ` Zhu, Yonghong
2018-04-20 15:51 ` [PATCH v1 08/27] BaseTools: AutoGen - remove dictionary populated, but never accessed Jaben Carsey
2018-04-25  8:50   ` Zhu, Yonghong
2018-04-20 15:51 ` [PATCH v1 09/27] BaseTools: AutoGen - remove unused variables Jaben Carsey
2018-04-25  8:52   ` Zhu, Yonghong
2018-04-20 15:51 ` [PATCH v1 10/27] BaseTools: Remove extra .keys() Jaben Carsey
2018-04-25  8:51   ` Zhu, Yonghong
2018-04-20 15:51 ` [PATCH v1 11/27] BaseTools: Workspace/MetaFileParser - refactor dicts Jaben Carsey
2018-04-20 15:51 ` [PATCH v1 12/27] BaseTools: remove dict from DscBuildData Jaben Carsey
2018-04-25  8:50   ` Zhu, Yonghong
2018-04-20 15:51 ` [PATCH v1 13/27] BaseTools: replace string constants used for module types Jaben Carsey
2018-04-25  5:57   ` Zhu, Yonghong
2018-04-20 15:51 ` [PATCH v1 14/27] BaseTools: Define and use a set for common list Jaben Carsey
2018-05-02  6:48   ` Zhu, Yonghong
2018-04-20 15:51 ` [PATCH v1 15/27] BaseTools: Share a dictionary instead of keeping multiples Jaben Carsey
2018-04-20 15:51 ` [PATCH v1 16/27] BaseTools: Replace EDK Component strings with predefined constant Jaben Carsey
2018-04-24  7:42   ` Zhu, Yonghong
2018-04-24 14:13     ` Carsey, Jaben
2018-04-20 15:51 ` [PATCH v1 17/27] BaseTools: DataType - cleanup list constants Jaben Carsey
2018-05-04 11:14   ` Laszlo Ersek [this message]
2018-05-04 14:18     ` Carsey, Jaben
2018-05-04 15:03       ` Laszlo Ersek
2018-04-20 15:51 ` [PATCH v1 18/27] BaseTools: Replace PCD type strings with predefined constant Jaben Carsey
2018-04-25  6:00   ` Zhu, Yonghong
2018-04-20 15:51 ` [PATCH v1 19/27] BaseTools: Replace Binary File " Jaben Carsey
2018-04-24  7:38   ` Zhu, Yonghong
2018-04-24 14:12     ` Carsey, Jaben
2018-04-20 15:51 ` [PATCH v1 20/27] BaseTools: remove duplicate variable Jaben Carsey
2018-04-25  8:51   ` Zhu, Yonghong
2018-04-20 15:51 ` [PATCH v1 21/27] BaseTools: replace string with predefined constant Jaben Carsey
2018-04-25  6:04   ` Zhu, Yonghong
2018-04-20 15:51 ` [PATCH v1 22/27] BaseTools: remove redundant if comparison Jaben Carsey
2018-05-02  6:49   ` Zhu, Yonghong
2018-04-20 15:51 ` [PATCH v1 23/27] BaseTools: AutoGen - use dafultdict instead of dict Jaben Carsey
2018-04-20 15:51 ` [PATCH v1 24/27] BaseTools: GenFds - simplify testing for Hex number Jaben Carsey
2018-04-25  8:51   ` Zhu, Yonghong
2018-04-20 15:51 ` [PATCH v1 25/27] BaseTools: AutoGen - use defaultdict to auto initialize Jaben Carsey
2018-04-25  8:52   ` Zhu, Yonghong
2018-04-20 15:51 ` [PATCH v1 26/27] BaseTools: remove unused MigrationUtilities.py Jaben Carsey
2018-05-02  6:49   ` Zhu, Yonghong
2018-04-20 15:51 ` [PATCH v1 27/27] BaseTools: CommonClass - remove unused classes Jaben Carsey
2018-04-25  8:51   ` Zhu, Yonghong

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=814bebab-3b06-ce21-4fbb-326cc0a49121@redhat.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