From patchwork Tue Dec 27 15:32:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Maxim Cournoyer X-Patchwork-Id: 45599 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 6134727BBE9; Tue, 27 Dec 2022 15:34:36 +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 A1B2E27BBED for ; Tue, 27 Dec 2022 15:34:31 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pABxv-0004iO-5A; Tue, 27 Dec 2022 10:34:07 -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 1pABxq-0004hj-T9 for guix-patches@gnu.org; Tue, 27 Dec 2022 10:34:05 -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 1pABxq-0003xF-0j for guix-patches@gnu.org; Tue, 27 Dec 2022 10:34:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pABxp-0004nb-SU for guix-patches@gnu.org; Tue, 27 Dec 2022 10:34:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#60218] [PATCH v2 1/3] 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, 27 Dec 2022 15:34: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: rekado@elephly.net, othacehe@gnu.org, Maxim Cournoyer Received: via spool by 60218-submit@debbugs.gnu.org id=B60218.167215518818351 (code B ref 60218); Tue, 27 Dec 2022 15:34:01 +0000 Received: (at 60218) by debbugs.gnu.org; 27 Dec 2022 15:33:08 +0000 Received: from localhost ([127.0.0.1]:56322 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pABwy-0004lv-3y for submit@debbugs.gnu.org; Tue, 27 Dec 2022 10:33:08 -0500 Received: from mail-yw1-f175.google.com ([209.85.128.175]:40577) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pABww-0004lO-6C for 60218@debbugs.gnu.org; Tue, 27 Dec 2022 10:33:07 -0500 Received: by mail-yw1-f175.google.com with SMTP id 00721157ae682-381662c78a9so187990947b3.7 for <60218@debbugs.gnu.org>; Tue, 27 Dec 2022 07:33:06 -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=s57eGhr74kAsANfbP2lLgpfygKdXVKHuxDI4py3egv8=; b=aLQvYGAz0jZ4vmdpwbXde/h+36D8+cck3SLNgPo20RWWi6PNYkmxFjgetK88aTAJWo AS46P7+EWX1wH8HTNXYE7tQfsuFRy4G9sQXcRa9BFJ4cakp1P/GpqddrptYtH9w3JQo1 4kztN64XuC5XIULYTDOG8QBkUNoP/F2SxHoyggdBOkRMoZyRKjGUE4EPrEhrQI/bWCTN 9X0UV/lGf4uEPL9cC25suoVGzGuovcsYY3TLUNfUp8klUeriTkKdMURNZhRC2zt9gz5e tamteOD0pSeAkh07btiVHY99po+XlUt+VY1mQWhUzrkf1UF1Rw1chJyvgJ3HXxdNqFET RykA== 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=s57eGhr74kAsANfbP2lLgpfygKdXVKHuxDI4py3egv8=; b=tqr/orKvWZVK/coBPtWyfzGsvfDDYktMbWULtUwt2x/qiQYDm8BBwAdLYkgZrKmPjh eGHm7EchoNvoQiNhlrwh2VG5RU913Ze9Plakj78K3G3L5sgkQUUP10ZG/CSHaDGJQhkf 2gbgbKRmvRbFcbzcsN2V8pRmRN6s/1g/XHyr71FQ16LdWochMYiKPnP1Q+iT06rAmb15 XOjfMCp7jP0hukIHOnV7Ea663yYnEMFfUZ/iAjawbYjIJ/5Kx/e+Di1GsvhwUh8DYnf0 dfbBW4r7iqEwYRrmfqhdrG3IUIhp/3+S4I23xILEQCsDDXyE57LhZ38s7WpmFGFr5/2A lp8w== X-Gm-Message-State: AFqh2kpkuBUllsWADLTbLugjSFBjEVYXVfL6bgvGShLkIetC+Fy/LFmi o1dRzLbHvlJHjWIj60cFUt+s/ab5Z4N4Xg== X-Google-Smtp-Source: AMrXdXsy0O7HDcsAvVTgtjHz4zhOBYQOTce2JHk4XK1QPMK66NDxM1KeD/71x1+ozNq+8n2NWMZArg== X-Received: by 2002:a05:7508:1318:b0:47:1cbf:91e0 with SMTP id cr24-20020a057508131800b000471cbf91e0mr1340182gbb.6.1672155180360; Tue, 27 Dec 2022 07:33:00 -0800 (PST) Received: from localhost.localdomain (dsl-10-129-132.b2b2c.ca. [72.10.129.132]) by smtp.gmail.com with ESMTPSA id bp13-20020a05620a458d00b006fefa5f7fc9sm9505322qkb.134.2022.12.27.07.32.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Dec 2022 07:32:59 -0800 (PST) From: Maxim Cournoyer Date: Tue, 27 Dec 2022 10:32:46 -0500 Message-Id: <20221227153249.16793-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. --- Changes in v2: - Move newline character (~%) in usage output to the bottom etc/teams.scm.in | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) base-commit: 8f93a1e01a879ae026678dd92c18e2a2a49be540 diff --git a/etc/teams.scm.in b/etc/teams.scm.in index f42a7f6f28..e50efea786 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)) @@ -623,6 +625,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 @@ -631,6 +642,12 @@ (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 (compose symbol->string team-id) + (find-team-by-scope (diff-revisions rev-start rev-end)))))) (("list-teams" . args) (list-teams)) (("list-members" . team-names) @@ -646,6 +663,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)))