From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.88, mailfrom: liming.gao@intel.com) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by groups.io with SMTP; Thu, 27 Jun 2019 00:36:42 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Jun 2019 00:36:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,423,1557212400"; d="scan'208";a="167343109" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by orsmga006.jf.intel.com with ESMTP; 27 Jun 2019 00:36:41 -0700 Received: from fmsmsx602.amr.corp.intel.com (10.18.126.82) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 27 Jun 2019 00:36:40 -0700 Received: from fmsmsx602.amr.corp.intel.com (10.18.126.82) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Thu, 27 Jun 2019 00:36:40 -0700 Received: from shsmsx108.ccr.corp.intel.com (10.239.4.97) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1713.5 via Frontend Transport; Thu, 27 Jun 2019 00:36:40 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.185]) by SHSMSX108.ccr.corp.intel.com ([169.254.8.236]) with mapi id 14.03.0439.000; Thu, 27 Jun 2019 15:36:37 +0800 From: "Liming Gao" To: "Fan, ZhijuX" , "devel@edk2.groups.io" CC: "Feng, Bob C" Subject: Re: [PATCH] BaseTools:Updata the Judgment Method of "--exclude" Thread-Topic: [PATCH] BaseTools:Updata the Judgment Method of "--exclude" Thread-Index: AdUsk7JItFlsklTWQi2SOJVElPpinAAJ0Yjw Date: Thu, 27 Jun 2019 07:36:37 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E48E3BE@SHSMSX104.ccr.corp.intel.com> References: In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYWY1NjM5NGItMjU4Yy00MjJiLWI5ZGUtNWNhNzNhNGEyNzhkIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiNmF1R2grMUFPOEFBTlpIM1NrUWhiZnAyclg1dWVXMXhpOERjNnVMTXlpUGxHcEw5RlJwdnkyUENITUw5VjdHZCJ9 dlp-product: dlpe-windows dlp-version: 11.0.600.7 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: liming.gao@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Zhiju: Please keep original behavior on --exclude for the directory name or file= name.=20 > -----Original Message----- > From: Fan, ZhijuX > Sent: Thursday, June 27, 2019 10:55 AM > To: devel@edk2.groups.io > Cc: Gao, Liming ; Feng, Bob C > Subject: [PATCH] BaseTools:Updata the Judgment Method of "--exclude" >=20 > BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1944 >=20 > --exclude cannot be used under certain circumstances > 1.The value of the parameter USES an absolute path > 2.The value of Exclude parameters is based on the value > of the Path parameter > Neither of these approaches currently works >=20 > This patch is going to fix that issue. >=20 > Cc: Liming Gao > Cc: Bob Feng > Signed-off-by: Zhiju.Fan > --- > BaseTools/Scripts/FormatDosFiles.py | 18 +++++++++++++++--- > 1 file changed, 15 insertions(+), 3 deletions(-) >=20 > diff --git a/BaseTools/Scripts/FormatDosFiles.py b/BaseTools/Scripts/Form= atDosFiles.py > index d9a880f299..7a5af209f2 100644 > --- a/BaseTools/Scripts/FormatDosFiles.py > +++ b/BaseTools/Scripts/FormatDosFiles.py > @@ -20,7 +20,7 @@ import copy >=20 > __prog__ =3D 'FormatDosFiles' > __version__ =3D '%s Version %s' % (__prog__, '0.10 ') > -__copyright__ =3D 'Copyright (c) 2018, Intel Corporation. All rights r= eserved.' > +__copyright__ =3D 'Copyright (c) 2019, Intel Corporation. All rights r= eserved.' > __description__ =3D 'Convert source files to meet the EDKII C Coding Sta= ndards Specification.\n' > DEFAULT_EXT_LIST =3D ['.h', '.c', '.nasm', '.nasmb', '.asm', '.S', '.inf= ', '.dec', '.dsc', '.fdf', '.uni', '.asl', '.aslc', '.vfr', '.idf', '.txt',= '.bat', '.py'] >=20 > @@ -46,10 +46,22 @@ def FormatFile(FilePath, Args): > def FormatFilesInDir(DirPath, ExtList, Args): >=20 > FileList =3D [] > + ExcludeDir =3D DirPath > for DirPath, DirNames, FileNames in os.walk(DirPath): > if Args.Exclude: > - DirNames[:] =3D [d for d in DirNames if d not in Args.Exclud= e] > - FileNames[:] =3D [f for f in FileNames if f not in Args.Excl= ude] > + Continue =3D False > + for Path in Args.Exclude: > + if not os.path.isdir(Path) and not os.path.isfile(Path): > + Path =3D os.path.join(ExcludeDir, Path) > + if os.path.isdir(Path) and Path.endswith(DirPath): > + Continue =3D True > + elif os.path.isfile(Path): > + for ItemPath in FileNames[:]: > + FilePath =3D os.path.join(DirPath, ItemPath) > + if Path.endswith(FilePath): > + FileNames.remove(ItemPath) > + if Continue: > + continue > for FileName in [f for f in FileNames if any(f.endswith(ext) for= ext in ExtList)]: > FileList.append(os.path.join(DirPath, FileName)) > for File in FileList: > -- > 2.14.1.windows.1