From nobody Sun Jan 25 12:09:11 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1769180337; cv=none; d=zohomail.com; s=zohoarc; b=OVDBMWWc6fT7wRPk5FZaCdE8VkHkJBBl1v571ZO/D7mKG7ONmcqoGUx1iFDCM6l6hCoDk76UIHuf4nZCPbeR9a4WOvqVitFi2+qiipTEKLuZsTnPJZiUOjSbe0+dIUe9ZhSq4WGCVIF7CdpBx7MuxvbYa9zNjFba0JMEZMNzvTo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769180337; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Q1kjsB9PiIZhYgHWuhuM2nVSoa5jRfZPNm2SrsMSgiY=; b=EGtTjafbdT7IBqG7r3Yg6jk4sTISc+q+Vhvc6Vt8FdV5Gm0LTso7KwFi7vgjb140LVWH7ITwtIFw+MAGQjkijYQII91yuaPRaD8KgKco1byF0xE9vxrD49A6eSWGWDdRN1HLiaNhv7xdmBztuY5waMYRUKbtQlD0T12TUpC86ck= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1769180337689641.1556881147179; Fri, 23 Jan 2026 06:58:57 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vjIc9-0004OS-9I; Fri, 23 Jan 2026 09:58:21 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vjIby-0004I0-2f for qemu-devel@nongnu.org; Fri, 23 Jan 2026 09:58:11 -0500 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vjIbv-0007np-NG for qemu-devel@nongnu.org; Fri, 23 Jan 2026 09:58:09 -0500 Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-42fbc544b09so1781190f8f.1 for ; Fri, 23 Jan 2026 06:58:07 -0800 (PST) Received: from draig.lan ([185.126.160.19]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-435b1b6e2besm7470341f8f.0.2026.01.23.06.57.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Jan 2026 06:58:04 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 96B8C5FA43; Fri, 23 Jan 2026 14:57:51 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1769180286; x=1769785086; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Q1kjsB9PiIZhYgHWuhuM2nVSoa5jRfZPNm2SrsMSgiY=; b=N233cQQQh2ZJeDT8/h+RHxwQyitzcpBtoDuR5TQUFrF1Qkg/8ploAJReBnycZmcO/T NQ8OjNhwmnpEjzXke3BwoWOb5zsqq/DD5BvEEW+Gx1hU/xLkvrgNh1leAFnM7UEFZi1S +LVksxuoElbzZa3JlpHigNgQr+drjXX9CMpnXco4uMh5DU5HT5ymPmbk7k3vfEVcgwr3 NOdSneYbbdIx+qgXvrNz+ec0rzYM0YDU1NYoU4Q7/wM1s+o9w7nF+/XXEFzbQIqZMEXy d/4p66zHpuMihTueciQJsQQZUQsiP7vnB9l7MN1uBTEHIbTMxPvPFUcfDtRVZTnQECWr qskg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769180286; x=1769785086; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=Q1kjsB9PiIZhYgHWuhuM2nVSoa5jRfZPNm2SrsMSgiY=; b=oIk8uPZd7FY2/fBYDPVbvBEFo5RC5zkWUui506wPcuuuM5rz9EhXRT6xfmLi0FQi/M r1dhvQheoBrM0ukvHm9s/xnaOXFMzRsDOua2pfjk9+ypIHfJVtXxu9jt/8x7CRdGB+9E +Z3ByHabOm+AKisWUFYDyx/pgq4TRZzc9YvJGSRVxOTmgEuOTehNIxx91qzAT40HkAF7 pVNPUjkRHDLrnx+MpKUrZ3JGsSFRINA9k0Wz3aBweFmDrKozq/YAGkEn421jW+0zZffn YeW3clj8skrdpyV10qLci31kOvYLf2NEd17bU8925MPMnH+3YPjTMBt8qWp9iB9N4GIF mZ1w== X-Gm-Message-State: AOJu0Yy/JzlNDXivuYGCYyHosfGUsCwblDuUt/MCcmCHTkBbQ3atuMDb tdpbUmzFa8iLwu0IX/XX9oIZfX1k7fe1NwVkUBqAA7T3g//0N07MvSIGz/OGhz2+sh0= X-Gm-Gg: AZuq6aL7he3WIMxCSPQ0Tq/MSHZqeuKEYtFNDaaOw6JEzA8Ou/KN2LLgO0v3ecfBy5p wiJK52aSEoZKtvxO0hBk+PC9l6n9nPCrrIG148t2bZ7gQzjfV0gHJGiA8EIdftEGWgrzO1+md2P ONIq0ME/pDvmakIfH+/xDUVk8tcTKOsqy7xjt3HlWXfF+ZIdUSxfWyupdp6fv7wb6bzQmga18xD 6g3YEeAuQJVk+wM8+zxLG/BaKiGwlC7HAeaT9Sgzer843TKHnUPViC40D138u9kvWr9ER70GiHc Y3q24FzjM8WS7reklknxMNSGYLqPwSgDQYxaVE8IuYTbKjJ8z5OGdyRqrI6fmPXbNlyzx6OCl8b XvteS8Ixvx4woDJng8DaimXK3wLAcFBNP8S28dg6c2e/vhVPEXnolh8z7phzhHRWd36voHPjOTl Mp+pn29Z3Sl3MD X-Received: by 2002:a05:6000:4287:b0:431:35a:4a7d with SMTP id ffacd0b85a97d-435b161fd66mr6132122f8f.58.1769180286049; Fri, 23 Jan 2026 06:58:06 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Thomas Huth , Cleber Rosa , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Mauro Carvalho Chehab , Joe Perches , John Snow Subject: [RFC PATCH v2 13/16] scripts/get_maintainer.py: add support reading patch files Date: Fri, 23 Jan 2026 14:57:46 +0000 Message-ID: <20260123145750.1200879-14-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260123145750.1200879-1-alex.bennee@linaro.org> References: <20260123145750.1200879-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::431; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x431.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1769180339113154100 Not so different from individual files, we just need to parse the patch looking for the files and add them to the list. As we can parse multiple patches we also need to ensure the final list of sections is unique so we don't repeat ourselves. Signed-off-by: Alex Benn=C3=A9e --- scripts/get_maintainer.py | 47 ++++++++++++++++++++++++++++++++++----- 1 file changed, 42 insertions(+), 5 deletions(-) diff --git a/scripts/get_maintainer.py b/scripts/get_maintainer.py index 96875255b11..f46d8f6e073 100755 --- a/scripts/get_maintainer.py +++ b/scripts/get_maintainer.py @@ -15,6 +15,7 @@ from pathlib import Path from enum import StrEnum, auto from re import compile as re_compile +from re import sub as re_sub =20 # # Subsystem MAINTAINER entries @@ -190,6 +191,29 @@ def read_maintainers(src): =20 return entries =20 +# +# Helper functions for dealing with patch files +# +patchfile_re =3D re_compile(r"\+\+\+\s+(\S+)") + +#TODO: also return a list of keyword hits for K:? +def extract_filenames_from_patch(patchfile): + """ + Read a patchfile and return a list of files which are modified by + the patch. + """ + file_list =3D [] + + with open(patchfile, 'r', encoding=3D'utf-8') as f: + for line in f: + m =3D patchfile_re.match(line) + if m: + # strip leading [ab]/ + stripped =3D re_sub(r'^[^/]*/', '', m.group(1)) + as_path =3D Path(path.abspath(stripped)) + file_list.append(as_path) + + return file_list =20 # # Helper functions for dealing with the source path @@ -305,14 +329,27 @@ def main(): print(f"loaded {len(maint_sections)} from MAINTAINERS") exit(0) =20 - relevent_maintainers =3D None + # Build array of Path objects representing the files + files =3D [] =20 if args.file: - relevent_maintainers =3D [ms for ms in maint_sections if - ms.is_file_covered(args.file)] + files.append(args.file) + + if args.patch: + for p in args.patch: + pfiles =3D extract_filenames_from_patch(p) + files.extend(pfiles) + + # unique set of maintainer sections + maintained: set[MaintainerSection] =3D set() + + for f in files: + fmaint =3D [ms for ms in maint_sections if ms.is_file_covered(f)] + for m in fmaint: + maintained.add(m) =20 - for rm in relevent_maintainers: - print(rm) + for rm in maintained: + print(str(rm)) =20 =20 if __name__ =3D=3D '__main__': --=20 2.47.3