From patchwork Thu Jul 7 15:23:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 1653669 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=BeiS4e5U; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Lf0dB00xtz9s0w for ; Fri, 8 Jul 2022 01:26:53 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6BF4384578; Thu, 7 Jul 2022 17:26:20 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="BeiS4e5U"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6091D8456B; Thu, 7 Jul 2022 17:26:10 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pf1-x433.google.com (mail-pf1-x433.google.com [IPv6:2607:f8b0:4864:20::433]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 7C7B084573 for ; Thu, 7 Jul 2022 17:26:07 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=dianders@chromium.org Received: by mail-pf1-x433.google.com with SMTP id g126so5654260pfb.3 for ; Thu, 07 Jul 2022 08:26:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Ryac+Xj+efBKFcrCFDK4Bh7+Br9hAVwHJXZxnfMueQQ=; b=BeiS4e5UI3xEYTD5ykTbSo2QWOwQBezVeUfTV2CqhpEJTCmLnOGCq5u3/hrODmI3/g fSNouX5cBeDQd3mi8lym3oIJ/x1eewYPgn/GpcvjTnjJI/Ou9BdD+CqbormtLe8PyV28 ia6LF5cq7zVWGJkCwxQSlqDOZs+WZT2KCghBw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Ryac+Xj+efBKFcrCFDK4Bh7+Br9hAVwHJXZxnfMueQQ=; b=jaXs6MX5aFMShf/ETQXjL1A5E7PrnqJU3ScVveGFnHzoGmgJIh/dcN/YQMPF4fYxFp vH9sNvyo393IbTgXo5mooRXhR46G/EoZuHqjMl0V9BqLH+5jrmhOQ5HxO/Gl4vSAhPts PioKVsz915ek+8mSsy8T++GcKuI8gYfdAVpN/lY+Sovyi99zrKrpAzUO34ZmmXxAUhlX 7UgTswEWBYLcTQSzyRPb7FUQg897Eo6iyXNC/vOKvywdWkip4yUAL3P07sbNdQog60TW YdGfefqF5Lj+VLvsu6G6EmczQyrqHqDOOENZU9l+Vkw+wUbIciWqKtiuTX+ZG4V5FZ6N NK9A== X-Gm-Message-State: AJIora+8OIGW99YtnLEIPZLuYB2dtDy0d+OfALKP5bVS1LeI6spw5m4G E0XNPFhE39KYhQ3T086X5fzJFw== X-Google-Smtp-Source: AGRyM1syolJI2GnK1ARYwJYaSyNgUGuRQn77miwM5ZV2to/VFnp4XGyj3XGeIHjk49F9zPhxOIAy5Q== X-Received: by 2002:a63:1e49:0:b0:3fd:cf48:3694 with SMTP id p9-20020a631e49000000b003fdcf483694mr40477560pgm.275.1657207565887; Thu, 07 Jul 2022 08:26:05 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:201:2c8:c510:a4e9:5da3]) by smtp.gmail.com with ESMTPSA id na7-20020a17090b4c0700b001ecb5a6385bsm17146055pjb.36.2022.07.07.08.26.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Jul 2022 08:26:05 -0700 (PDT) From: Douglas Anderson To: sjg@chromium.org Cc: amstan@chromium.org, mka@chromium.org, Sean Anderson , briannorris@chromium.org, Douglas Anderson , u-boot@lists.denx.de Subject: [PATCH v3 4/5] patman: By default don't pass "--no-tree" to checkpatch for linux Date: Thu, 7 Jul 2022 08:23:52 -0700 Message-Id: <20220707082245.v3.4.I49504c16c5fc1e32629ab7c3e2a4702c79f3da11@changeid> X-Mailer: git-send-email 2.37.0.rc0.161.g10f37bed90-goog In-Reply-To: <20220707152353.1854462-1-dianders@chromium.org> References: <20220707152353.1854462-1-dianders@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean When you pass "--no-tree" to checkpatch it disables some extra checks that are important for Linux. Specifically I want checks like: warning: DT compatible string "boogie,woogie" appears un-documented check ./Documentation/devicetree/bindings/ Let's make the default for Linux to _not_ pass --no-tree. We'll have a config option and command line flag to override. Signed-off-by: Douglas Anderson Tested-by: Brian Norris Reviewed-by: Brian Norris Reviewed-by: Simon Glass --- (no changes since v1) tools/patman/checkpatch.py | 11 +++++++---- tools/patman/control.py | 7 ++++--- tools/patman/main.py | 3 +++ tools/patman/settings.py | 3 ++- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/tools/patman/checkpatch.py b/tools/patman/checkpatch.py index 70ba561c2686..d1b902dd9627 100644 --- a/tools/patman/checkpatch.py +++ b/tools/patman/checkpatch.py @@ -186,7 +186,7 @@ def check_patch_parse(checkpatch_output, verbose=False): return result -def check_patch(fname, verbose=False, show_types=False): +def check_patch(fname, verbose=False, show_types=False, use_tree=False): """Run checkpatch.pl on a file and parse the results. Args: @@ -194,6 +194,7 @@ def check_patch(fname, verbose=False, show_types=False): verbose: True to print out every line of the checkpatch output as it is parsed show_types: Tell checkpatch to show the type (number) of each message + use_tree (bool): If False we'll pass '--no-tree' to checkpatch. Returns: namedtuple containing: @@ -210,7 +211,9 @@ def check_patch(fname, verbose=False, show_types=False): stdout: Full output of checkpatch """ chk = find_check_patch() - args = [chk, '--no-tree'] + args = [chk] + if not use_tree: + args.append('--no-tree') if show_types: args.append('--show-types') output = command.output(*args, fname, raise_on_error=False) @@ -236,13 +239,13 @@ def get_warning_msg(col, msg_type, fname, line, msg): line_str = '' if line is None else '%d' % line return '%s:%s: %s: %s\n' % (fname, line_str, msg_type, msg) -def check_patches(verbose, args): +def check_patches(verbose, args, use_tree): '''Run the checkpatch.pl script on each patch''' error_count, warning_count, check_count = 0, 0, 0 col = terminal.Color() for fname in args: - result = check_patch(fname, verbose) + result = check_patch(fname, verbose, use_tree=use_tree) if not result.ok: error_count += result.errors warning_count += result.warnings diff --git a/tools/patman/control.py b/tools/patman/control.py index b40382388e07..bf426cf7bcf4 100644 --- a/tools/patman/control.py +++ b/tools/patman/control.py @@ -64,7 +64,7 @@ def prepare_patches(col, branch, count, start, end, ignore_binary, signoff): patchstream.insert_cover_letter(cover_fname, series, to_do) return series, cover_fname, patch_files -def check_patches(series, patch_files, run_checkpatch, verbose): +def check_patches(series, patch_files, run_checkpatch, verbose, use_tree): """Run some checks on a set of patches This santiy-checks the patman tags like Series-version and runs the patches @@ -77,6 +77,7 @@ def check_patches(series, patch_files, run_checkpatch, verbose): run_checkpatch (bool): True to run checkpatch.pl verbose (bool): True to print out every line of the checkpatch output as it is parsed + use_tree (bool): If False we'll pass '--no-tree' to checkpatch. Returns: bool: True if the patches had no errors, False if they did @@ -86,7 +87,7 @@ def check_patches(series, patch_files, run_checkpatch, verbose): # Check the patches, and run them through 'git am' just to be sure if run_checkpatch: - ok = checkpatch.check_patches(verbose, patch_files) + ok = checkpatch.check_patches(verbose, patch_files, use_tree) else: ok = True return ok @@ -165,7 +166,7 @@ def send(args): col, args.branch, args.count, args.start, args.end, args.ignore_binary, args.add_signoff) ok = check_patches(series, patch_files, args.check_patch, - args.verbose) + args.verbose, args.check_patch_use_tree) ok = ok and gitutil.check_suppress_cc_config() diff --git a/tools/patman/main.py b/tools/patman/main.py index 56dcde1f9ef3..468ebf814fbc 100755 --- a/tools/patman/main.py +++ b/tools/patman/main.py @@ -82,6 +82,9 @@ send.add_argument('--binary', action=BooleanOptionalAction, send.add_argument('--check', action=BooleanOptionalAction, dest='check_patch', default=True, help="Check for patch compliance") +send.add_argument('--tree', action=BooleanOptionalAction, + dest='check_patch_use_tree', default=False, + help="If False, pass '--no-tree' to checkpatch") send.add_argument('--tags', action=BooleanOptionalAction, dest='process_tags', default=True, help="Process subject tags as aliases") send.add_argument('--signoff', action=BooleanOptionalAction, dest='add_signoff', diff --git a/tools/patman/settings.py b/tools/patman/settings.py index 6c5f6c8ed992..cee18bf01a65 100644 --- a/tools/patman/settings.py +++ b/tools/patman/settings.py @@ -23,6 +23,7 @@ _default_settings = { "u-boot": {}, "linux": { "process_tags": "False", + "check_patch_use_tree": "True", }, "gcc": { "process_tags": "False", @@ -71,7 +72,7 @@ class _ProjectConfigParser(ConfigParser.SafeConfigParser): >>> config = _ProjectConfigParser("linux") >>> config.readfp(StringIO(sample_config)) >>> sorted((str(a), str(b)) for (a, b) in config.items("settings")) - [('am_hero', 'True'), ('process_tags', 'False')] + [('am_hero', 'True'), ('check_patch_use_tree', 'True'), ('process_tags', 'False')] # Check to make sure that settings works with unknown project. >>> config = _ProjectConfigParser("unknown")