From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id 2CV5EIzEoWMK1AAAbAwnHQ (envelope-from ) for ; Tue, 20 Dec 2022 15:19:56 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id eHCEEIzEoWOCQQEA9RJhRA (envelope-from ) for ; Tue, 20 Dec 2022 15:19:56 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id DB2F347FAB for ; Tue, 20 Dec 2022 15:19:55 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p7dOz-0006Rl-AM; Tue, 20 Dec 2022 09:15:30 -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 1p7dOZ-0006DG-2p for guix-patches@gnu.org; Tue, 20 Dec 2022 09:15:04 -0500 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p7dOY-0004lf-Kg for guix-patches@gnu.org; Tue, 20 Dec 2022 09:15:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p7dOY-0002m1-0w for guix-patches@gnu.org; Tue, 20 Dec 2022 09:15:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#60218] [PATCH 1/2] teams: Add a "get-maintainer" command. References: <20221220135810.28175-1-maxim.cournoyer@gmail.com> In-Reply-To: <20221220135810.28175-1-maxim.cournoyer@gmail.com> Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 20 Dec 2022 14:15:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60218 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 60218@debbugs.gnu.org Cc: Josselin Poiret , Tobias Geerinckx-Rice , Maxim Cournoyer , Simon Tournier , Mathieu Othacehe , Ludovic =?UTF-8?Q?Court=C3=A8s?= , Christopher Baines , Ricardo Wurmus Received: via spool by 60218-submit@debbugs.gnu.org id=B60218.167154564710618 (code B ref 60218); Tue, 20 Dec 2022 14:15:01 +0000 Received: (at 60218) by debbugs.gnu.org; 20 Dec 2022 14:14:07 +0000 Received: from localhost ([127.0.0.1]:45137 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p7dNf-0002lC-5P for submit@debbugs.gnu.org; Tue, 20 Dec 2022 09:14:07 -0500 Received: from mail-qt1-f178.google.com ([209.85.160.178]:35496) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p7dNd-0002kh-IC for 60218@debbugs.gnu.org; Tue, 20 Dec 2022 09:14:06 -0500 Received: by mail-qt1-f178.google.com with SMTP id h26so7144302qtu.2 for <60218@debbugs.gnu.org>; Tue, 20 Dec 2022 06:14:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=0A+sSH/3E6+l4VR8tkaKg2fQCtA2zuiHriQyaH5Bo3Q=; b=YoNM/UPzV1MNoxr6sO83cdvdCJL4JNxdSPGIt69vhz9qjprLXq78QAqJiLW8dyUu4L sQepGzmDKDlCqi55Y2ktwuPxbsmpJUdnI+IGXxr5vpBaGYO6NPv7GTxdKi02rs7tTAK1 idq1suBtZDD0AiyhX/oFfBVE1DPaLdLC5YOt3A7aHQZ9ARB+5juVqDWPlF6EC9o3Ffva hUjHe8Apw3zFenW6AEJ/ihkr2WvK9tVIHBo6n4xYzUH0QEaXa+kHHvbVGUS5z/5XG1iB hgPqz2XVUsH+3+/3pYpSExQqNACZ5+qWI1f6RLiFUQiQQ8qBns9AjuVStH1RHIbRS2fr 3ibA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=0A+sSH/3E6+l4VR8tkaKg2fQCtA2zuiHriQyaH5Bo3Q=; b=50ZUkCTUcpOT/7qXCbY4mIwH8Kiy8x1GjVKGLnogDRTEo4l2V3ad50XPMdeXucJoMj tsfE6IXAZ3yDrzv680CF0efHRqzjN9qhzx1Z4KScHIrBiJRIwgFDXH5+Bq27m0t8pl/s smj6xOpq9J9CVggR5vq66RoTsXya/879g3TIK8aAnGOCSnnSaw+f+rdke0tFaVDmL5Oi SmqoIi5DgAA2d2M7KE195W3zd/RFntnfM5qSgzQReRN7co7eL8SbmQh7siiA1fLDwoqu 7WuY/fG0jH+fp/qj3d6E4HFs23NHT2JXJAZbi/zTd5tpwA34JkmW4RTTE4ZsYaDo+Scj 436w== X-Gm-Message-State: ANoB5plygsPJnvs4L8rInti77x/cNajaEgvWJMm3QSjz/2TdsJYFYrQd DyOGiNApNT40eNnPqzKnPb8LIn7TpQ3x5bky X-Google-Smtp-Source: AA0mqf67iF4Mt6uNgYG8pqP1nFqu8r6WmNbRSmHm6IRsNguARzFB2a9s/Z0rNbTVSZDhwXRnmQ/M0w== X-Received: by 2002:ac8:745:0:b0:3a8:325:47e with SMTP id k5-20020ac80745000000b003a80325047emr59543985qth.54.1671545639651; Tue, 20 Dec 2022 06:13:59 -0800 (PST) Received: from localhost.localdomain ([2607:fad8:4:3::1002]) by smtp.gmail.com with ESMTPSA id c3-20020ac80543000000b003a6a7a20575sm7691759qth.73.2022.12.20.06.13.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Dec 2022 06:13:59 -0800 (PST) From: Maxim Cournoyer Date: Tue, 20 Dec 2022 09:13:29 -0500 Message-Id: <20221220141330.30372-1-maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gmail.com header.s=20210112 header.b="YoNM/UPz"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1671545996; a=rsa-sha256; cv=none; b=Mzr8W8bv4aTYdA1XmtlpgMZMEr45drcPROjjJdczUUUEcpbywIHluQuUChDAtoy8r3u2dQ UEc70Va3WBDMWjB4QlRritEYJqNLhQK3e+25ERzq0Sq7gEQWE/0IPS/41yNp5ScZxm/yqP Xn0I0gR8mJ7IgB63wv6IIH+hopM77mlgw/p6sCD5XasZdrUuII6r6SKMHVcyd9ylb9PTvZ osT8GmCHLYvJ2F5qsApWN8GGNuEUM1P/Ww9j8LD1JRmxv7rjXaStDILt2Z3vafxJQIWKpC F2Pj02eqaHkWHzlxlU/UbKeV1AgDV690tW0ZEiB9BNvz093sr5gU6yhrc0AGwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1671545996; h=from:from:sender:sender: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:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=sELbSO1L+hPcbQ/WXuUG1mDYMuqAUN8sGR1LgBuO5hU=; b=WQGM4rnYiuurNslIq5MCjMjpQc+yR88CKUiWsj8ZNWP1B8rw6qUaSkvyAOlnbvb4nWzqKv wGliD5JSD7PyEVDgUkEmu4DRGh5Zn2o4BXMRpyPTFzcBXoNjGwYRPXxU59hCBR0lyzl2+6 RTXCRP2/xY6dYXw57sFIJMyOxYxw491HV5ojtbYeL6KrxfZHNKdpxmFVYI+0BtwBxStqPW 79h/GE3LXOb5Kzi6Yq/3Tr9Iy/qXacq3YwOL+6vysEElNctfdkefqOKx6lMWw5XutvZrGA KRW9Q40GY5UCEyKksz4QqUla+gdtTco3nRIoG3b0O9dZ6n1WoXolQCKF8+yqDw== Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gmail.com header.s=20210112 header.b="YoNM/UPz"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Scanner: scn1.migadu.com X-Migadu-Spam-Score: -0.39 X-Spam-Score: -0.39 X-Migadu-Queue-Id: DB2F347FAB X-TUID: lLZni3eJVPZ5 This can be used as a compatibility mode with the get_maintainer.pl Perl script included in the Linux (or U-Boot) source tree. * etc/teams.scm.in (git-patch->commit-id): New procedure. (main) : Register new command. Document it. --- etc/teams.scm.in | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/etc/teams.scm.in b/etc/teams.scm.in index aa38a3b798..4f02df79d5 100644 --- a/etc/teams.scm.in +++ b/etc/teams.scm.in @@ -5,6 +5,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2022 Ricardo Wurmus ;;; Copyright © 2022 Mathieu Othacehe +;;; Copyright © 2022 Maxim Cournoyer ;;; ;;; This file is part of GNU Guix. ;;; @@ -34,6 +35,7 @@ (ice-9 format) (ice-9 regex) (ice-9 match) + (ice-9 rdelim) (guix ui) (git)) @@ -608,6 +610,15 @@ (define (diff-revisions rev-start rev-end) (const 0)) files)) +(define (git-patch->commit-id file) + "Parse the commit ID from the first line of FILE, a patch produced with git." + (call-with-input-file file + (lambda (port) + (let ((m (string-match "^From ([0-9a-f]{40})" (read-line port)))) + (unless m + (error "invalid patch file:" file)) + (match:substring m 1))))) + (define (main . args) (match args @@ -616,6 +627,14 @@ (define (main . args) (("cc-members" rev-start rev-end) (apply cc (find-team-by-scope (diff-revisions rev-start rev-end)))) + (("get-maintainer" patch-file) + (let* ((rev-end (git-patch->commit-id patch-file)) + (rev-start (string-append rev-end "^"))) + (apply main "list-members" + (map symbol->string + (map team-id + (find-team-by-scope + (diff-revisions rev-start rev-end))))))) (("list-teams" . args) (list-teams)) (("list-members" . team-names) @@ -631,6 +650,7 @@ (define (main . args) cc get git send-email flags for cc-ing cc-members cc teams related to files changed between revisions list-teams list teams and their members - list-members list members belonging to ~%")))) + list-members list members belonging to ~% + get-maintainer compatibility mode with Linux get_maintainer.pl")))) (apply main (cdr (command-line))) base-commit: f28ca2447c5e2eef1ba6a3a11587380a665b0e26 -- 2.38.1