From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:403:478a::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id INSuAuOSMWXmYgAA9RJhRA:P1 (envelope-from ) for ; Thu, 19 Oct 2023 22:34:43 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:478a::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id INSuAuOSMWXmYgAA9RJhRA (envelope-from ) for ; Thu, 19 Oct 2023 22:34:43 +0200 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 8F582639D9 for ; Thu, 19 Oct 2023 22:34:42 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gmail.com header.s=20230601 header.b=ZN3ZytrO; 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"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1697747682; 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=vIOuWKIqWAZlGZDo3fAU1yB6rq5LqJPxtD/eZkbHzlM=; b=JWtHTTGHTk5utnFnI6TVp5BZ9vdnojC0Y9AeFqhGhsq4ul2onKQrygP+74Dx0M2qQfAtdW 1Dqr0RAIJy+Hy3SzfDGpKAEwZJT+cbkm6hgFznPWOXxhGAnURmBvG5UjKsPOCgWtuY6Y9Y 4ALR2sK/VH43+HTuMi10qwzmdfq5zCtXT9ebl3E9yHzok8/inrawERudziUUbpFWbBkFBL fwvNcznrExCnaj7Jn85s/h9WBdrBE7DvjmHVw1XiMSnK3mFDWlWWUAIAcCXeEsg8nU8ArW O6Pss/8RIeX7H/16dniaM3h7VdhTr8yEF/Hp/6Sq3HAlDa+fl+H4USnQzpCoBQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1697747682; a=rsa-sha256; cv=none; b=D8FvdWnx3px6AQLuND/RgkHOhlRJJbH9ni6tMR+0Xzqi3d4+vWJG4t5Yqz5a6SmbWubqKB tVyyVYJ2aFJd1+uAv26Bxr9WlDMJRUKS8/m5WWYKP8J3WzFWsqrzgmWbyxRF4MJ4M41U7i ZyfxgEOx+rfCwjHnv/KQWkygRZLzXfRK0fp8b6+Ezqosjkim/aPsiJd2OFBDqbKmjMD+Ap E78aBjE+gOGPkYyPomv/0hZw/pMpqsE45+pccWk/2JnlNU2D3mDTCgIh5c5kmRZFxBr5Ut ZaJg/NpTjrTAsRQP/PTqg+A8EekzX72APihLSyl+alM/RBu5s38JUFB3huHgGg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gmail.com header.s=20230601 header.b=ZN3ZytrO; 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"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qtZj2-0006JI-Cp; Thu, 19 Oct 2023 16:34:36 -0400 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 1qtZj1-0006Im-JM for guix-patches@gnu.org; Thu, 19 Oct 2023 16:34:35 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qtZj1-0006zs-Bj for guix-patches@gnu.org; Thu, 19 Oct 2023 16:34:35 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qtZjR-0000wC-M2; Thu, 19 Oct 2023 16:35:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#42146] [PATCH 1/3] build: Relocate record and associated procedures here. References: <20200630220913.14665-1-kuba@kadziolka.net> In-Reply-To: <20200630220913.14665-1-kuba@kadziolka.net> Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: kuba@kadziolka.net, maxim.cournoyer@gmail.com, guix-patches@gnu.org Resent-Date: Thu, 19 Oct 2023 20:35:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 42146 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 42146@debbugs.gnu.org Cc: Maxim Cournoyer , Jakub =?UTF-8?Q?K=C4=85dzio=C5=82ka?= , Maxim Cournoyer X-Debbugs-Original-Xcc: Jakub =?UTF-8?Q?K=C4=85dzio=C5=82ka?= , Maxim Cournoyer Received: via spool by 42146-submit@debbugs.gnu.org id=B42146.16977476873567 (code B ref 42146); Thu, 19 Oct 2023 20:35:01 +0000 Received: (at 42146) by debbugs.gnu.org; 19 Oct 2023 20:34:47 +0000 Received: from localhost ([127.0.0.1]:37942 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qtZj9-0000vI-AK for submit@debbugs.gnu.org; Thu, 19 Oct 2023 16:34:47 -0400 Received: from mail-qk1-x72c.google.com ([2607:f8b0:4864:20::72c]:53679) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qtZj3-0000uv-P6 for 42146@debbugs.gnu.org; Thu, 19 Oct 2023 16:34:41 -0400 Received: by mail-qk1-x72c.google.com with SMTP id af79cd13be357-7789cb322deso3477585a.3 for <42146@debbugs.gnu.org>; Thu, 19 Oct 2023 13:34:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697747645; x=1698352445; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=b8visCM1R1nOmFaZmfOgo/UFjx68QHhn/qnzsKsQeAg=; b=ZN3ZytrOSkoPV3PTQaE1mAar2RlNnWmqgMs1eUJnLtPW5QYVB8f3z+ETfhqDnFw1DS XyavybpqF03vu1wUn37gRq17HNTkbrOjgAw4oyHai8tgBky7hY6NGNRQaA/QxtH0hIAW Pb0u8CKyr2zoBfMzP4MnLVK05A79UctLns1v85Ta/8/wkalN6l36ICOFAi7ESSKQon4+ 1Ae8JJTz3BU8D0tV1gLHkHWCJ1HetFbnWCCw56TCEjuCuy7/Hbdtjw62LL5lqX1PJ2Em T5U0x3yELnvQ1o/Z7GAqvIOeIP4v7BWHxMdrbd2lt6sY9z6JIlAoh3YHe0WyIL4bC4oO eWBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697747645; x=1698352445; 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=b8visCM1R1nOmFaZmfOgo/UFjx68QHhn/qnzsKsQeAg=; b=ZxcAquP9GiFSEo55HE/e7UF9MDsvAS9ZPWpca4BgE2OTuZn++bxCM8Vz4pWkIgiu8n SCyNxBgNdbpxrkHJyZivfM2vWBjhk42Cg6BOvpQ5VcbK7Lv6DbTDMTCXwJu7JWjhcWPd Lr/9mdtMdzqjth6e+o4LJtDKp1QVlwkrZs8MPGYzSd1XrF/uqqcfE4iVMcbhD1y3Lrjb 6Y9/YmGl0na0+4auI/al8y10TAzAOSvDKRcwLda6EB77r3PZ7ACOvRn0WcU6borfd1XS JwfcqC9PBFfIF5slrnZEnMm5GbbtnYtoS9tYFfWLUFgG1dtJM2rc5Kdk1RSRPuV7zzIh I87A== X-Gm-Message-State: AOJu0Yy4UcYO5QrjiSDMvsyioUbWrb8JzRF4JdfVrpGJwbDOvFyxRhSO zG+bBTapLnbVAlTYyTfp3ccFG1eoEnfN8Q== X-Google-Smtp-Source: AGHT+IFA9mzRE/o856F/91XgvZa7sQElpq+DUlYXjrLLxGzsRTInleEEv8Plk+fACFYJFEpXs4lzng== X-Received: by 2002:a05:620a:4548:b0:76f:2899:3a96 with SMTP id u8-20020a05620a454800b0076f28993a96mr3923889qkp.0.1697747644695; Thu, 19 Oct 2023 13:34:04 -0700 (PDT) Received: from localhost.localdomain (dsl-156-111.b2b2c.ca. [66.158.156.111]) by smtp.gmail.com with ESMTPSA id 2-20020a05620a070200b0077413b342e9sm76591qkc.128.2023.10.19.13.34.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 13:34:03 -0700 (PDT) From: Maxim Cournoyer Date: Thu, 19 Oct 2023 16:33:32 -0400 Message-ID: X-Mailer: git-send-email 2.41.0 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-Flow: FLOW_IN X-Migadu-Country: US X-Spam-Score: 4.35 X-Migadu-Queue-Id: 8F582639D9 X-Migadu-Scanner: mx0.migadu.com X-Migadu-Spam-Score: 4.35 X-TUID: S2emHlgvU0dX * etc/teams.scm.in (, make-regexp*, regexp*-exec): Move to... * guix/build/utils.scm: ... here. (list-matches*): New procedure. Change-Id: I566ac372f7d8ba08de94e19b54dcc68da2106a23 --- etc/teams.scm.in | 19 +------------------ guix/build/utils.scm | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 18 deletions(-) diff --git a/etc/teams.scm.in b/etc/teams.scm.in index 55242caad1..8af25b9802 100644 --- a/etc/teams.scm.in +++ b/etc/teams.scm.in @@ -34,29 +34,12 @@ (srfi srfi-9) (srfi srfi-26) (ice-9 format) - (ice-9 regex) (ice-9 match) (ice-9 rdelim) + (guix build utils) (guix ui) (git)) -(define-record-type - (%make-regexp* pat flag rx) - regexp*? - (pat regexp*-pattern) - (flag regexp*-flag) - (rx regexp*-rx)) - -;;; Work around regexp implementation. -;;; This record allows to track the regexp pattern and then display it. -(define* (make-regexp* pat #:optional (flag regexp/extended)) - "Alternative to `make-regexp' producing annotated objects." - (%make-regexp* pat flag (make-regexp pat flag))) - -(define (regexp*-exec rx* str) - "Execute the RX* regexp, a object." - (regexp-exec (regexp*-rx rx*) str)) - (define-record-type (make-team id name description members scope) team? diff --git a/guix/build/utils.scm b/guix/build/utils.scm index 8e630ad586..2b3a8e278b 100644 --- a/guix/build/utils.scm +++ b/guix/build/utils.scm @@ -9,6 +9,7 @@ ;;; Copyright © 2020, 2021 Maxim Cournoyer ;;; Copyright © 2021, 2022 Maxime Devos ;;; Copyright © 2021 Brendan Tildesley +;;; Copyright © 2022 Simon Tournier ;;; Copyright © 2023 Carlo Zancanaro ;;; ;;; This file is part of GNU Guix. @@ -28,6 +29,7 @@ (define-module (guix build utils) #:use-module (srfi srfi-1) + #:use-module (srfi srfi-9) #:use-module (srfi srfi-11) #:use-module (srfi srfi-26) #:use-module (srfi srfi-34) @@ -55,6 +57,14 @@ (define-module (guix build utils) package-name->name+version parallel-job-count + make-regexp* + regexp*-exec + regexp*? + regexp*-pattern + regexp*-flag + regexp*-rx + list-matches* + compressor tarball? %xz-parallel-args @@ -163,6 +173,35 @@ (define-syntax-rule (define-constant name val) (module-replace! (current-module) '(setvbuf))) (else #f)) + +;;; +;;; Extend regexp objects with a pattern field. +;;; +(define-record-type + (%make-regexp* pat flag rx) + regexp*? + (pat regexp*-pattern) ;the regexp pattern, a string + (flag regexp*-flag) ;regexp flags + (rx regexp*-rx)) ;the compiled regexp object + +;;; Work around regexp implementation. +;;; This record allows to track the regexp pattern and then display it. +(define* (make-regexp* pat #:optional (flag regexp/extended)) + "Alternative to `make-regexp' producing annotated objects." + (%make-regexp* pat flag (make-regexp pat flag))) + +(define (regexp*-exec rx* str) + "Execute the RX* regexp, a object." + (regexp-exec (regexp*-rx rx*) str)) + +(define* (list-matches* regexp str #:optional (flags regexp/extended)) + "Like 'list-matches', but also accepting a regexp* as REGEXP." + (match regexp + ((or (? string?) (? regexp?)) + (list-matches regexp str flags)) + ((? regexp*?) + (list-matches (regexp*-rx regexp) str flags)))) + ;;; ;;; Compression helpers. base-commit: d59653b7c9e43ebdbba20e2ca071429507f94c67 -- 2.41.0