From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.120]) by mx.groups.io with SMTP id smtpd.web10.11649.1575562371924017229 for ; Thu, 05 Dec 2019 08:12:52 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=H9xmrKH4; spf=pass (domain: redhat.com, ip: 205.139.110.120, mailfrom: philmd@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575562370; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cLC+OqhjhK/l7pI+Wwm51/EyyzeBySn3hb2WzEBSb70=; b=H9xmrKH4iqlQhOePKgySRrEZ2zCP6pTROmyOLXk7tSV2oKkDhUOXTbtD5SJs7FbVBMnRm/ hcWeAUKF3aLPh2nHevb58lBYxR6NRjLSs391ew9Jhch6cntBUHcMh7ze4OUd2ZO3NxQcYH R9pc9vzbh7pBJ1LaO5yfbQ0xW3KcXKw= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-244-IetbzDLsPeOl-T5QkLAOVg-1; Thu, 05 Dec 2019 11:12:46 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6DA08801FA0; Thu, 5 Dec 2019 16:12:45 +0000 (UTC) Received: from x1w.redhat.com (ovpn-205-76.brq.redhat.com [10.40.205.76]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C41FE1001B28; Thu, 5 Dec 2019 16:12:43 +0000 (UTC) From: =?UTF-8?B?UGhpbGlwcGUgTWF0aGlldS1EYXVkw6k=?= To: devel@edk2.groups.io Cc: Philippe Mathieu-Daude , Bob Feng , Liming Gao Subject: [PATCH 2/6] BaseTools/PatchCheck: Add a --quiet option Date: Thu, 5 Dec 2019 17:12:30 +0100 Message-Id: <20191205161234.25071-3-philmd@redhat.com> In-Reply-To: <20191205161234.25071-1-philmd@redhat.com> References: <20191205161234.25071-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-MC-Unique: IetbzDLsPeOl-T5QkLAOVg-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Add a --quiet option to only display warnings. This will be useful when this script is called embedded. Cc: Bob Feng Cc: Liming Gao Signed-off-by: Philippe Mathieu-Daude --- BaseTools/Scripts/PatchCheck.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/BaseTools/Scripts/PatchCheck.py b/BaseTools/Scripts/PatchCheck= .py index 8bcf857a7d15..f907e96b9501 100755 --- a/BaseTools/Scripts/PatchCheck.py +++ b/BaseTools/Scripts/PatchCheck.py @@ -19,7 +19,7 @@ import subprocess import sys =20 class Verbose: - SILENT, ONELINE, NORMAL =3D range(3) + SILENT, QUIET, ONELINE, NORMAL =3D range(4) level =3D NORMAL =20 class CommitMessageCheck: @@ -56,10 +56,10 @@ class CommitMessageCheck: print(self.url) =20 def error(self, *err): - if self.ok and Verbose.level > Verbose.ONELINE: + if self.ok and Verbose.level >=3D Verbose.QUIET: print('The commit message format is not valid:') self.ok =3D False - if Verbose.level < Verbose.NORMAL: + if Verbose.level in [Verbose.SILENT, Verbose.ONELINE]: return count =3D 0 for line in err: @@ -404,10 +404,10 @@ class GitDiffCheck: self.error(err, err2) =20 def error(self, *err): - if self.ok and Verbose.level > Verbose.ONELINE: + if self.ok and Verbose.level >=3D Verbose.QUIET: print('Code format is not valid:') self.ok =3D False - if Verbose.level < Verbose.NORMAL: + if Verbose.level in [Verbose.SILENT, Verbose.ONELINE]: return count =3D 0 for line in err: @@ -530,7 +530,8 @@ class CheckGitCommits: print() else: blank_line =3D True - print('Checking git commit:', commit) + if Verbose.level > Verbose.QUIET: + print('Checking git commit:', commit) patch =3D self.read_patch_from_git(commit) self.ok &=3D CheckOnePatch(commit, patch).ok if not commits: @@ -634,12 +635,17 @@ class PatchCheckApp: group.add_argument("--oneline", action=3D"store_true", help=3D"Print one result per line") + group.add_argument("--quiet", + action=3D"store_true", + help=3D"Only print warnings and errors") group.add_argument("--silent", action=3D"store_true", help=3D"Print nothing") self.args =3D parser.parse_args() if self.args.oneline: Verbose.level =3D Verbose.ONELINE + if self.args.quiet: + Verbose.level =3D Verbose.QUIET if self.args.silent: Verbose.level =3D Verbose.SILENT =20 --=20 2.21.0