public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Bob Feng" <bob.c.feng@intel.com>
To: devel@edk2.groups.io
Cc: Liming Gao <gaoliming@byosoft.com.cn>,
	Yuwei Chen <yuwei.chen@intel.com>,
	Shenglei Zhang <shenglei.zhang@intel.com>
Subject: [Patch V2] BaseTools/Ecc: Fix an issue of path separator compatibility
Date: Tue,  1 Sep 2020 18:23:15 +0800	[thread overview]
Message-ID: <20200901102315.38840-1-bob.c.feng@intel.com> (raw)

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2904

The path separator is different in Windows and Linux, the
original code does not handle this difference. This patch
is to fix this issue.

Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Yuwei Chen <yuwei.chen@intel.com>
Cc: Shenglei Zhang <shenglei.zhang@intel.com>
---
V2
Change to a better method to get path separator.

 BaseTools/Source/Python/Ecc/Check.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/BaseTools/Source/Python/Ecc/Check.py b/BaseTools/Source/Python/Ecc/Check.py
index 0fdc7e35c1..6087abfa4d 100644
--- a/BaseTools/Source/Python/Ecc/Check.py
+++ b/BaseTools/Source/Python/Ecc/Check.py
@@ -1101,15 +1101,15 @@ class Check(object):
             for Item in InfPathSet:
                 if Item[0] not in InfPathList:
                     InfPathList.append(Item[0])
             SqlCommand = """
                          select ID, Path, FullPath from File where upper(FullPath) not in
-                            (select upper(A.Path) || '\\' || upper(B.Value1) from File as A, INF as B
+                            (select upper(A.Path) || '%s' || upper(B.Value1) from File as A, INF as B
                             where A.ID in (select BelongsToFile from INF where Model = %s group by BelongsToFile) and
                             B.BelongsToFile = A.ID and B.Model = %s)
                             and (Model = %s or Model = %s)
-                        """ % (MODEL_EFI_SOURCE_FILE, MODEL_EFI_SOURCE_FILE, MODEL_FILE_C, MODEL_FILE_H)
+                        """ % (os.sep, MODEL_EFI_SOURCE_FILE, MODEL_EFI_SOURCE_FILE, MODEL_FILE_C, MODEL_FILE_H)
             RecordSet = EccGlobalData.gDb.TblInf.Exec(SqlCommand)
             for Record in RecordSet:
                 Path = Record[1]
                 Path = Path.upper().replace('\X64', '').replace('\IA32', '').replace('\EBC', '').replace('\IPF', '').replace('\ARM', '')
                 if Path in InfPathList:
@@ -1130,13 +1130,13 @@ class Check(object):
                 if Pcd[3]:
                     PcdName = Pcd[3]
                 BelongsToFile = Pcd[4]
                 SqlCommand = """
                              select ID from File where FullPath in
-                            (select B.Path || '\\' || A.Value1 from INF as A, File as B where A.Model = %s and A.BelongsToFile = %s
+                            (select B.Path || '%s' || A.Value1 from INF as A, File as B where A.Model = %s and A.BelongsToFile = %s
                              and B.ID = %s and (B.Model = %s or B.Model = %s))
-                             """ % (MODEL_EFI_SOURCE_FILE, BelongsToFile, BelongsToFile, MODEL_FILE_C, MODEL_FILE_H)
+                             """ % (os.sep, MODEL_EFI_SOURCE_FILE, BelongsToFile, BelongsToFile, MODEL_FILE_C, MODEL_FILE_H)
                 TableSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand)
                 for Tbl in TableSet:
                     TblName = 'Identifier' + str(Tbl[0])
                     SqlCommand = """
                                  select Name, ID from %s where value like '%s' and Model = %s
-- 
2.20.1.windows.1


             reply	other threads:[~2020-09-01 10:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-01 10:23 Bob Feng [this message]
2020-09-01 14:42 ` 回复: [edk2-devel] [Patch V2] BaseTools/Ecc: Fix an issue of path separator compatibility gaoliming
2020-09-01 18:03   ` Laszlo Ersek
2020-09-02  0:39     ` 回复: " gaoliming
2020-09-02  0:44     ` 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=20200901102315.38840-1-bob.c.feng@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