From patchwork Sat Aug 26 08:07:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guru Das Srinagesh X-Patchwork-Id: 13366530 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 579DEC83F11 for ; Sat, 26 Aug 2023 08:08:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:CC :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=qea4G0Czxj7EtpGjSzMQ3xcXTBAz1B1JtUCzWouu5GE=; b=gwd5oQ+JUdsUsr cu/5gOUmgIldl5VkEgcJ8GF36XiEIUA+vvAq2GWd5l26o+6K9ESMem8mSLHSN4t8O90Clo05yO2tK TgZfryVUI0lXGb0wF4BzbAf0nPec0nNdRUqKQO1FGOzkvZwJR4OLlwDg2+9rfzn4A8IrTKIWirIaQ woY8j6dl0Prx4uin1+qPfvCUTcL9CmdHHXkDK5LNs8HItGFxNIfnY3lX/4kAwusPxgW8vdgwxQgRi 7MW4jPY4I7DCbIfUgTvuIMcGmodoSIprXs2myUzj+yovIIYwBdnd9NmlVv91f1fWtBEo1EG0RtRmr 26i+4tOdEo8Krv9ey0eQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qZoLN-006a2h-21; Sat, 26 Aug 2023 08:08:29 +0000 Received: from mx0a-0031df01.pphosted.com ([205.220.168.131]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qZoLI-006a1b-33 for linux-arm-kernel@lists.infradead.org; Sat, 26 Aug 2023 08:08:26 +0000 Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 37Q87r7w003397; Sat, 26 Aug 2023 08:07:53 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=qcppdkim1; bh=RuSklkcagBLFU5of9raSa21FtXCQIuorKx7luzbnnl0=; b=aBxIdvzNoBAL37ndhKAZQv6z1J23K1ha9jUjsaQ3tOYGsM8KCjTFFSoflRRYp3tm928h lt3bzxKpOJ3CfGOm7juet6QnrKCfaVjcUuH7msLvQHiHgMaZEBHPeuQapqa9njA/Hx81 7Zti+bxb/T+TUW5U+BpLXa90Y8IRWOzFpJlVe9ouHKn6ctM+szV1soQtdSjaSvdXMXkx 6dXfXw/Vt563EL39b2lsbkYzlzQSvzOpmnNeY+ggJS1fCKU6ZwtfTrarlUYXo8gTCHb+ 0fR77TJMXFn1Sc6H7ckDrCEx+DrzCD5YasR/f2j5PWud8rfY8HgrcAcHC6N+megXsMe9 lw== Received: from nasanppmta03.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3sq8by8b4k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 26 Aug 2023 08:07:52 +0000 Received: from nasanex01b.na.qualcomm.com (nasanex01b.na.qualcomm.com [10.46.141.250]) by NASANPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 37Q87qQk000990 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 26 Aug 2023 08:07:52 GMT Received: from hu-gurus-sd.qualcomm.com (10.80.80.8) by nasanex01b.na.qualcomm.com (10.46.141.250) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.36; Sat, 26 Aug 2023 01:07:49 -0700 From: Guru Das Srinagesh To: Masahiro Yamada , Nick Desaulniers , Andrew Morton , "Nicolas Schier" , Konstantin Ryabitsev , Kees Cook , "Bjorn Andersson" , , , Will Deacon , "Greg Kroah-Hartman" , CC: , , , , , , , , "Guru Das Srinagesh" Subject: [PATCH v3 0/1] Add add-maintainer.py script Date: Sat, 26 Aug 2023 01:07:41 -0700 Message-ID: X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nasanex01b.na.qualcomm.com (10.46.141.250) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: 1CRp--2K1yfb6_mGSw-4Xgx5GqXzDMlf X-Proofpoint-ORIG-GUID: 1CRp--2K1yfb6_mGSw-4Xgx5GqXzDMlf X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-08-26_05,2023-08-25_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 mlxscore=0 lowpriorityscore=0 malwarescore=0 mlxlogscore=999 impostorscore=0 phishscore=0 spamscore=0 suspectscore=0 bulkscore=0 clxscore=1011 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2308260074 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230826_010825_000041_0CC7ACC7 X-CRM114-Status: GOOD ( 23.08 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org When pushing patches to upstream, the `get_maintainer.pl` script is used to determine whom to send the patches to. Instead of having to manually process the output of the script, add a wrapper script to do that for you. The add-maintainer.py script adds maintainers (and mailing lists) to a patch, editing it in-place. It also optionally undoes this operation if so desired. Please try out this script with `--verbosity debug` for verifying that it's doing "the right thing". I've tested this with a patch series from various subsystems to ensure variety of maintainers and lists output and found it to be behaving as expected. For an example output of this script, please see [1]. Thanks to Bjorn for being a sounding board to this idea and for his valuable suggestions. I referred to these links [2][3][4] during development of this script. Apropos workflow: Thanks to Krzysztof for sharing his workflow - I found his suggestion to use git branch description as cover letter [5] particularly useful. Incorporating that into the ideal workflow envisioned [6] for this script, we get: 1. Do `git config format.coverFromDescription subject` 2. Do `git branch --edit-description` and write cover letter 3. Generate patches using `git format-patch --cover-letter -n --thread -v` 4. Run `add-maintainer.py` on the above patches 5. `git send-email` the patches. b4 is an amazing tool whose `b4 prep --auto-to-cc` does part of what this script does, but with the above workflow, we have an in-tree solution to the basic problem of preparing patches to be sent to LKML. For multiple patchsets, all one will need to do is to increment `-v` while git-formatting patches and make corresponding changes to the cover letter via step #2 as necessary! Changelog: (v2 -> v3) - Change patches nargs * -> + (Nicolas) - Add entry in MAINTAINERS and add self as maintainer (Pavan) - Bail out early if file does not exist (Pavan) - Change From: line determination logic (Nicolas) - Look for From: line and stop at the first occurrence of it - don't search entire file - Wrap the get_maintainer.pl call with a try-except block. - Use a better (arguably so) email validation regex - Don't disallow multiple "From:" in patch: - When the change is authored by someone other than the person generating the patch, there will be two "From: " lines in the patch. This is very valid, so don't error out. - Reviewers also go in To: in addition to Maintainers. - Add new "--undo" flag to undo effects of this script on a patch (tested) (v1 -> v2) - Added set-union logic based on Pavan's comments [7] and Bjorn's early suggestion - Expanded audience and added more mailing lists to get more review comments and feedback [1] https://lore.kernel.org/lkml/20230824214436.GA22659@quicinc.com/ [2] https://stackoverflow.com/questions/4427542/how-to-do-sed-like-text-replace-with-python [3] https://stackoverflow.com/questions/4146009/python-get-list-indexes-using-regular-expression [4] https://stackoverflow.com/questions/10507230/insert-line-at-middle-of-file-with-python [5] https://lore.kernel.org/lkml/6f475c9b-dc0e-078e-9aa2-d876a1e02467@linaro.org/ [6] https://lore.kernel.org/lkml/20230816171538.GB26279@quicinc.com/ [7] https://lore.kernel.org/lkml/63764b84-3ebd-4081-836f-4863af196228@quicinc.com/ Guru Das Srinagesh (1): scripts: Add add-maintainer.py MAINTAINERS | 5 ++ scripts/add-maintainer.py | 164 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 169 insertions(+) create mode 100755 scripts/add-maintainer.py