From nobody Tue Apr 30 01:28:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+53457+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+53457+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1579821068; cv=none; d=zohomail.com; s=zohoarc; b=HWIwTuDbBpMfVTUBJRu2hXDF7i7TB4SfjQesxMmFezLr8u6EYjWXl4mTQULV049B7lghofAT7LCPSoJaFSxCrQnXkx4DEnqd9llG2PId418S+0LZDr4DK4vU9Q5MNp/fKU+0nc+RWjXDLsr0Npl1sCEbE7vLaOtkaozicOxNY50= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1579821068; h=Content-Transfer-Encoding:Cc:Date:From:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=zPg1nAZbAJiv6X292rRKytIEM6hpQol73bMvi8oH27o=; b=AnVlWoh1bEg2jhybwSXP+H5oPO8nbaXH1F7fAGTWY9npO6vX47gdaYRdQLmwI6kz2WR+Cr0UKIICq2UoSZ79K82ZCfYO0Cyt1pLzzTuF030T6CdZbPif3IFdHGS/mki+648+3q+HjisYQVVsun4Gn3iX4fRu5YAkHPGpWFENz9Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+53457+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1579821068682572.7445102476914; Thu, 23 Jan 2020 15:11:08 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id Jgq6YY1788612xOkT8Y7IHh0; Thu, 23 Jan 2020 15:11:07 -0800 X-Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mx.groups.io with SMTP id smtpd.web12.4585.1579821066152530976 for ; Thu, 23 Jan 2020 15:11:06 -0800 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Jan 2020 15:10:56 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,355,1574150400"; d="scan'208";a="290036900" X-Received: from unknown (HELO mdkinney-MOBL2.amr.corp.intel.com) ([10.241.98.74]) by fmsmga001.fm.intel.com with ESMTP; 23 Jan 2020 15:10:56 -0800 From: "Michael D Kinney" To: devel@edk2.groups.io Cc: Bob Feng , Liming Gao , Laszlo Ersek Subject: [edk2-devel] [Patch] BaseTools/Scripts/PatchCheck.py: Remove submodule false positives Date: Thu, 23 Jan 2020 15:10:55 -0800 Message-Id: <20200123231055.15988-1-michael.d.kinney@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,michael.d.kinney@intel.com X-Gm-Message-State: wIN4WedKccTnfL2AJglfm8VKx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1579821067; bh=mLOrhxoIGtywBj9lMvn4W/J/S/0QTzNduorbsybdZ2A=; h=Cc:Date:From:Reply-To:Subject:To; b=xFHLyUbIaSiyhSqYnFboxRpa/14nr+F8pp70zlBOSRsskLO+zssslZST3Cs1dPxn5JT FiiikaRNgaABjN9+aN55rMRoYGHA2jS0JeKUOEwIxRCa9QJPAAJkKCK40MSz7a4VvlcWF iQzWKt+VLvOun2RwfBtDDhSxBtt5Z4BNLnI= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" https://bugzilla.tianocore.org/show_bug.cgi?id=3D2484 https://bugzilla.tianocore.org/show_bug.cgi?id=3D2485 Update PatchCheck to not enforce no tabs and not enforce CR/LF line endings for .gitmodules files. These files are updated by git when a git submodule command is used and the updates by git use tab characters and LF line endings. Also update patch check to not enforce CR/LF line endings for patch lines that create a submodule directory. These patch lines use LF line endings. The git submodule directory is added as a new file with attributes 160000 that can be detected by looking for the pattern "new file mode 160000". Cc: Bob Feng Cc: Liming Gao Cc: Laszlo Ersek Signed-off-by: Michael D Kinney Reviewed-by: Laszlo Ersek --- BaseTools/Scripts/PatchCheck.py | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/BaseTools/Scripts/PatchCheck.py b/BaseTools/Scripts/PatchCheck= .py index 173d4517e0..6823cc69bb 100755 --- a/BaseTools/Scripts/PatchCheck.py +++ b/BaseTools/Scripts/PatchCheck.py @@ -341,7 +341,21 @@ class GitDiffCheck: self.state =3D PRE_PATCH self.filename =3D line[13:].split(' ', 1)[0] self.is_newfile =3D False - self.force_crlf =3D not self.filename.endswith('.sh') + self.force_crlf =3D True + self.force_notabs =3D True + if self.filename.endswith('.sh'): + # + # Do not enforce CR/LF line endings for linux shell sc= ripts. + # + self.force_crlf =3D False + if self.filename =3D=3D '.gitmodules': + # + # .gitmodules is updated by git and uses tabs and LF l= ine + # endings. Do not enforce no tabs and do not enforce + # CR/LF line endings. + # + self.force_crlf =3D False + self.force_notabs =3D False elif len(line.rstrip()) !=3D 0: self.format_error("didn't find diff command") self.line_num +=3D 1 @@ -355,6 +369,11 @@ class GitDiffCheck: self.binary =3D True if self.is_newfile: self.new_bin.append(self.filename) + elif line.startswith('new file mode 160000'): + # + # New submodule. Do not enforce CR/LF line endings + # + self.force_crlf =3D False else: ok =3D False self.is_newfile =3D self.newfile_prefix_re.match(line) @@ -429,7 +448,7 @@ class GitDiffCheck: if self.force_crlf and eol !=3D '\r\n': self.added_line_error('Line ending (%s) is not CRLF' % repr(eo= l), line) - if '\t' in line: + if self.force_notabs and '\t' in line: self.added_line_error('Tab character used', line) if len(stripped) < len(line): self.added_line_error('Trailing whitespace found', line) --=20 2.21.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#53457): https://edk2.groups.io/g/devel/message/53457 Mute This Topic: https://groups.io/mt/70058310/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-