From patchwork Thu Oct 10 13:37:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eelco Chaudron X-Patchwork-Id: 1995463 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=hSW1vSVa; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.136; helo=smtp3.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XPW7Z4cpWz1xsv for ; Fri, 11 Oct 2024 00:39:06 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id B2A6460B46; Thu, 10 Oct 2024 13:39:03 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 49i7-MK1FBR6; Thu, 10 Oct 2024 13:39:02 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=2605:bc80:3010:104::8cd3:938; helo=lists.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 8656260B21 Authentication-Results: smtp3.osuosl.org; dkim=fail reason="signature verification failed" (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=hSW1vSVa Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp3.osuosl.org (Postfix) with ESMTPS id 8656260B21; Thu, 10 Oct 2024 13:39:02 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 63860C08A6; Thu, 10 Oct 2024 13:39:02 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 86515C08A3 for ; Thu, 10 Oct 2024 13:39:01 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 6030040FE5 for ; Thu, 10 Oct 2024 13:39:01 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id Yzb8lW2aMuZa for ; Thu, 10 Oct 2024 13:39:00 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=170.10.129.124; helo=us-smtp-delivery-124.mimecast.com; envelope-from=echaudro@redhat.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp2.osuosl.org E1124402C6 Authentication-Results: smtp2.osuosl.org; dmarc=pass (p=none dis=none) header.from=redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org E1124402C6 Authentication-Results: smtp2.osuosl.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=hSW1vSVa Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by smtp2.osuosl.org (Postfix) with ESMTPS id E1124402C6 for ; Thu, 10 Oct 2024 13:38:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1728567538; 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; bh=ygRojsJ8sWvpK84+OdHLFc56SrC8TdxbPM8dQwDxxEE=; b=hSW1vSVa94X+xXbnIjlCBDt6RP9GXRZa066/JQdSuIK4v3Gx9MeucNsa62j/tjI2QKQwWn LylxmxAWv86kmi8IBcDjvjAk4RO7Meepu8ik1uKYs5JrRDj1d9JRP9LGbQM3tNA2g/WCbW h8vzBhTVebGS5c2P6Bb0RNiga9XYT3U= Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-297-22GCP5ySMgWuzBWMxMlRGA-1; Thu, 10 Oct 2024 09:38:54 -0400 X-MC-Unique: 22GCP5ySMgWuzBWMxMlRGA-1 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 117EC1955DBD; Thu, 10 Oct 2024 13:38:54 +0000 (UTC) Received: from localhost.localdomain (unknown [10.39.194.95]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id DA4FC300019F; Thu, 10 Oct 2024 13:38:52 +0000 (UTC) From: Eelco Chaudron To: dev@openvswitch.org Date: Thu, 10 Oct 2024 15:37:46 +0200 Message-ID: <9eed9d81d284231a515e88ecac6dac33c01a4bd1.1728567466.git.echaudro@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH] checkpatch: Fix checkpatch's check-authors-file option in CirrusCI. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: i.maximets@ovn.org Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" This patch makes sure that if git is missing it's not showing any errors on the standard output. Secondly the OVS_SRC_DIR environment variable is used to locate the OVS source directory. Fixes: a6ccd111552d ("checkpatch: Add new check-authors-file option to checkpatch.py.") Signed-off-by: Eelco Chaudron Acked-by: Mike Pattrick Acked-by: Kevin Traynor --- tests/checkpatch.at | 6 ++++-- utilities/checkpatch.py | 12 +++++++----- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/tests/checkpatch.at b/tests/checkpatch.at index fa179c707..2ed2ec878 100755 --- a/tests/checkpatch.at +++ b/tests/checkpatch.at @@ -29,11 +29,13 @@ Subject: Patch this is. fi if test -s expout; then - AT_CHECK([$PYTHON3 $top_srcdir/utilities/checkpatch.py $3 -q test.patch], + AT_CHECK([OVS_SRC_DIR=$top_srcdir $PYTHON3 \ + $top_srcdir/utilities/checkpatch.py $3 -q test.patch], [1], [stdout]) AT_CHECK([sed '/^Lines checked:/,$d' stdout], [0], [expout]) else - AT_CHECK([$PYTHON3 $top_srcdir/utilities/checkpatch.py $3 -q test.patch]) + AT_CHECK([OVS_SRC_DIR=$top_srcdir $PYTHON3 \ + $top_srcdir/utilities/checkpatch.py $3 -q test.patch]) fi } OVS_END_SHELL_HELPERS diff --git a/utilities/checkpatch.py b/utilities/checkpatch.py index 53b13bcf2..fe6aa79b0 100755 --- a/utilities/checkpatch.py +++ b/utilities/checkpatch.py @@ -18,6 +18,7 @@ import email import getopt import os import re +import subprocess import sys RETURN_CHECK_INITIAL_STATE = 0 @@ -867,13 +868,14 @@ def run_subject_checks(subject, spellcheck=False): def get_top_directory(): - with os.popen('git rev-parse --show-toplevel') as pipe: - path = pipe.read() + result = subprocess.run('git rev-parse --show-toplevel', + stdout=subprocess.PIPE, + stderr=subprocess.DEVNULL, shell=True) - if path: - return path.strip() + if result and result.returncode == 0: + return result.stdout.decode('utf-8').strip() - return "." + return os.getenv('OVS_SRC_DIR', '.') def update_missing_authors(diffed_line):