From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mx.groups.io with SMTP id smtpd.web12.10074.1598955804521786788 for ; Tue, 01 Sep 2020 03:23:24 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.43, mailfrom: bob.c.feng@intel.com) IronPort-SDR: ojqCWA4kv2TzPomfCI100Q8Me3bRCYlme0Zav2wOe7tRDGhwS74u7u7z4+vDdQj0hUe6/TdwTK bN02hemVsBVw== X-IronPort-AV: E=McAfee;i="6000,8403,9730"; a="241953393" X-IronPort-AV: E=Sophos;i="5.76,378,1592895600"; d="scan'208";a="241953393" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Sep 2020 03:23:23 -0700 IronPort-SDR: XmoaQhlWuS2hxGknt4z69Bso97pd0dpDUioScWAS+bPP9WGsiuZI8qcT765x2SHk7qzARcJbTW r4IGB3fPqgHg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,378,1592895600"; d="scan'208";a="301396066" Received: from shwdepsi1121.ccr.corp.intel.com ([10.239.158.66]) by orsmga006.jf.intel.com with ESMTP; 01 Sep 2020 03:23:21 -0700 From: "Bob Feng" To: devel@edk2.groups.io Cc: Liming Gao , Yuwei Chen , Shenglei Zhang Subject: [Patch V2] BaseTools/Ecc: Fix an issue of path separator compatibility Date: Tue, 1 Sep 2020 18:23:15 +0800 Message-Id: <20200901102315.38840-1-bob.c.feng@intel.com> X-Mailer: git-send-email 2.20.1.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Cc: Liming Gao Cc: Yuwei Chen Cc: Shenglei Zhang --- 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