From patchwork Tue Dec 20 14:13:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Maxim Cournoyer X-Patchwork-Id: 45462 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 4A87927BBEB; Tue, 20 Dec 2022 14:19:57 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id F272327BBE9 for ; Tue, 20 Dec 2022 14:19:55 +0000 (GMT) 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 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+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches 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(-) base-commit: f28ca2447c5e2eef1ba6a3a11587380a665b0e26 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)))