From patchwork Wed Sep 25 14:07:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eelco Chaudron X-Patchwork-Id: 1989422 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=i6vd1A4B; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::137; helo=smtp4.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) (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 4XDJVH17kYz1xst for ; Thu, 26 Sep 2024 00:08:23 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 486A6424F8; Wed, 25 Sep 2024 14:08:21 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id vGj9pQtqGNm5; Wed, 25 Sep 2024 14:08:20 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.9.56; helo=lists.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org D43BF40D1F Authentication-Results: smtp4.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=i6vd1A4B Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp4.osuosl.org (Postfix) with ESMTPS id D43BF40D1F; Wed, 25 Sep 2024 14:08:19 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 7DD46C0012; Wed, 25 Sep 2024 14:08:19 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 44958C0011 for ; Wed, 25 Sep 2024 14:08:18 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 4132F607E3 for ; Wed, 25 Sep 2024 14:08:18 +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 vre56SLPwLDT for ; Wed, 25 Sep 2024 14:08:17 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=170.10.133.124; helo=us-smtp-delivery-124.mimecast.com; envelope-from=echaudro@redhat.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp3.osuosl.org 6BADD60DF0 Authentication-Results: smtp3.osuosl.org; dmarc=pass (p=none dis=none) header.from=redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 6BADD60DF0 Authentication-Results: smtp3.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=i6vd1A4B Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by smtp3.osuosl.org (Postfix) with ESMTPS id 6BADD60DF0 for ; Wed, 25 Sep 2024 14:08:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1727273295; 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=YC2KkUwTUdRLG51b/YpG77GSUe+de0KLndrzkQt1nL8=; b=i6vd1A4BiLZD418vfWtg8eXvBYr1/5DKoQYCsoOv5lE8Lkyvdjwtyjyy3dVLhFhc22jV7Y OLWetf/Rv7/lMsbms1F6htVwyAElMaSbmvsoMfNnjgvzb+ZlvzwOqOZOx95x+Wam9kWeSv AA7MHpUCXp4eFqE+ZcXSs7zHktHJbDE= 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-204-_m2JTOkuOt-i93PntBj19Q-1; Wed, 25 Sep 2024 10:08:13 -0400 X-MC-Unique: _m2JTOkuOt-i93PntBj19Q-1 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (unknown [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 1B0F51902F75; Wed, 25 Sep 2024 14:08:12 +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 A667B30023C1; Wed, 25 Sep 2024 14:08:05 +0000 (UTC) From: Eelco Chaudron To: dev@openvswitch.org Date: Wed, 25 Sep 2024 16:07:21 +0200 Message-ID: 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 v2] checkpatch: Add new check-authors-file option to checkpatch.py. 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: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" This patch adds a new option, --check-authors-file, to the checkpatch tool to help OVS maintainers check for missing authors in the AUTHORS.rst file. Signed-off-by: Eelco Chaudron --- v2: Fixed partial match, and long argument check. --- utilities/checkpatch.py | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/utilities/checkpatch.py b/utilities/checkpatch.py index 742a0bc47..636634472 100755 --- a/utilities/checkpatch.py +++ b/utilities/checkpatch.py @@ -28,6 +28,7 @@ __errors = 0 __warnings = 0 empty_return_check_state = 0 print_file_name = None +check_authors_file = False checking_file = False total_line = 0 colors = False @@ -977,6 +978,21 @@ def ovs_checkpatch_parse(text, filename, author=None, committer=None): "who are not authors or co-authors or " "committers: %s" % ", ".join(extra_sigs)) + + if check_authors_file or author: + m = re.search(r'<(.*?)>', author) + if m: + try: + with open("AUTHORS.rst", "r") as file: + file_content = file.read() + pattern = r'\b' + re.escape(m.group(1)) + r'\b' + if re.search(pattern, file_content) is None: + print_error("Author '%s' is not in the " + "AUTHORS.rst file!" % author) + except FileNotFoundError: + print_error("Can't open AUTHORS.rst file in " + "current path!") + elif is_committer.match(line): committer = is_committer.match(line).group(2) elif is_author.match(line): @@ -1067,6 +1083,7 @@ Input options: Check options: -h|--help This help message +-a|--check-authors-file Check AUTHORS file for existense of author -b|--skip-block-whitespace Skips the if/while/for whitespace tests -l|--skip-leading-whitespace Skips the leading whitespace test -q|--quiet Only print error and warning information @@ -1138,9 +1155,10 @@ if __name__ == '__main__': sys.argv[1:]) n_patches = int(numeric_options[-1][1:]) if numeric_options else 0 - optlist, args = getopt.getopt(args, 'bhlstfSq', + optlist, args = getopt.getopt(args, 'abhlstfSq', ["check-file", "help", + "check-authors-file", "skip-block-whitespace", "skip-leading-whitespace", "skip-signoff-lines", @@ -1157,6 +1175,8 @@ if __name__ == '__main__': if o in ("-h", "--help"): usage() sys.exit(0) + elif o in ("-a", "--check-authors-file"): + check_authors_file = True elif o in ("-b", "--skip-block-whitespace"): skip_block_whitespace_check = True elif o in ("-l", "--skip-leading-whitespace"):