public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Bob Feng" <bob.c.feng@intel.com>
To: Andrew Fish <afish@apple.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: "Liang, MingyueX" <mingyuex.liang@intel.com>,
	Liming Gao <gaoliming@byosoft.com.cn>,
	"Chen, Christine" <yuwei.chen@intel.com>
Subject: Re: [edk2-devel] [PATCH] BaseTools: Normalize case of pathname when evaluating Macros.
Date: Wed, 23 Sep 2020 14:59:50 +0000	[thread overview]
Message-ID: <BY5PR11MB407088EB111551B8D16E4297C9380@BY5PR11MB4070.namprd11.prod.outlook.com> (raw)
In-Reply-To: <B48BC057-10C4-43AE-8FE5-55D8DFEF558E@apple.com>

Yes. we did test on Windows and Linux.

From the https://docs.python.org/3/library/os.path.html
os.path.normcase(path)
    Normalize the case of a pathname. On Windows, convert all characters in the pathname to lowercase, and also convert forward slashes to  backward slashes. On other operating systems, return the path unchanged.

Thanks,
Bob
-----Original Message-----
From: Andrew Fish <afish@apple.com> 
Sent: Wednesday, September 23, 2020 10:24 PM
To: devel@edk2.groups.io; Feng, Bob C <bob.c.feng@intel.com>
Cc: Liang, MingyueX <mingyuex.liang@intel.com>; Liming Gao <gaoliming@byosoft.com.cn>; Chen, Christine <yuwei.chen@intel.com>
Subject: Re: [edk2-devel] [PATCH] BaseTools: Normalize case of pathname when evaluating Macros.

Does this work on case sensitive file systems?
> On Sep 23, 2020, at 3:58 AM, Bob Feng <bob.c.feng@intel.com> wrote:
> 
> From: Mingyue Liang <mingyuex.liang@intel.com>
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2880
> 
> Currently, When doing the Incremental build, the directory macros 
> extended to absolute path in output Makefile, which is inconsistent 
> with the output of Clean build.
> 
> When we do macro replacement, we can't replace macro due to 
> inconsistent path case, which results in inconsistent display of 
> incremental build and clean build in makefile.Therefore, the path is 
> converted to achieve the correct macro replacement.
> 
> Signed-off-by: Mingyue Liang <mingyuex.liang@intel.com>
> Cc: Bob Feng <bob.c.feng@intel.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Yuwei Chen <yuwei.chen@intel.com>
> ---
> BaseTools/Source/Python/AutoGen/GenMake.py | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py 
> b/BaseTools/Source/Python/AutoGen/GenMake.py
> index 0314d0ea34..b04d3f5436 100755
> --- a/BaseTools/Source/Python/AutoGen/GenMake.py
> +++ b/BaseTools/Source/Python/AutoGen/GenMake.py
> @@ -786,8 +786,10 @@ cleanlib:
> 
>     def ReplaceMacro(self, str):
>         for Macro in self.MacroList:
> -            if self._AutoGenObject.Macros[Macro] and self._AutoGenObject.Macros[Macro] in str:
> -                str = str.replace(self._AutoGenObject.Macros[Macro], '$(' + Macro + ')')
> +            if self._AutoGenObject.Macros[Macro] and os.path.normcase(self._AutoGenObject.Macros[Macro]) in os.path.normcase(str):
> +                replace_dir = str[os.path.normcase(str).index(os.path.normcase(self._AutoGenObject.Macros[Macro])): os.path.normcase(str).index(
> +                    os.path.normcase(self._AutoGenObject.Macros[Macro])) + len(self._AutoGenObject.Macros[Macro])]
> +                str = str.replace(replace_dir, '$(' + Macro + ')')
>         return str
> 
>     def CommandExceedLimit(self):
> --
> 2.28.0.windows.1
> 
> 
> 
> 
> 
> 

  reply	other threads:[~2020-09-23 14:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-23 10:57 [PATCH] BaseTools: Normalize case of pathname when evaluating Macros Bob Feng
2020-09-23 14:23 ` [edk2-devel] " Andrew Fish
2020-09-23 14:59   ` Bob Feng [this message]
2020-09-23 15:31     ` Andrew Fish
2020-09-23 15:45       ` Bob Feng
2020-09-24  6:29 ` Yuwei Chen
     [not found] <1637647BAC077E32.15058@groups.io>
2020-09-24  5:27 ` [edk2-devel] " Bob Feng

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=BY5PR11MB407088EB111551B8D16E4297C9380@BY5PR11MB4070.namprd11.prod.outlook.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