From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id AO0yOntMV2fDYgEAqHPOHw:P1 (envelope-from ) for ; Mon, 09 Dec 2024 20:01:00 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id AO0yOntMV2fDYgEAqHPOHw (envelope-from ) for ; Mon, 09 Dec 2024 21:01:00 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=OzEgRQob; dkim=fail ("headers rsa verify failed") header.d=rimm.ee header.s=herman header.b=pBX2LkES; dmarc=pass (policy=none) header.from=gnu.org; 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=1733774459; a=rsa-sha256; cv=none; b=KfCAdTBLoVO1LhZLnodMJ8CftpqSgHFZGrP4i0X80rsj/ZFM4xE+TQ9DhxQzQJOs65f31B lpUjKAayeC60kWdZMWRGBZU8z6x5LELv+Qa39B4QcDfMsoYY64C6CV0l4L+l0V25Enqk76 AY2PcRiYhhbU7kq2k82WEmMrFNHEJv0fhltdSKTcCSo/uksCONYP+LvV8xRlXsCUSH51BP JrYxX//CVzOdaX4ZYtyoFKQ1Mb4O695HB6al3uX3kbEOKNKKivxk7l1+IlDfD3pR7H09VX kcgfHgZ5wv58TSQWZhohErFiMdcvmxeB6U+2p4ftrTBinXuEMngEW0TVEwByHg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=OzEgRQob; dkim=fail ("headers rsa verify failed") header.d=rimm.ee header.s=herman header.b=pBX2LkES; dmarc=pass (policy=none) header.from=gnu.org; 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-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1733774459; h=from:from:sender:sender:reply-to: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=8tA04GO47F3PXiip0PSkXsaT7TUZa/1VHE/4svheeoI=; b=njYCAXCtEgA1y2K1Jz6rbIMD3352Y+kiLeJ7Dxg7W0OfRT9UehnWIWUNq3wwwpkndFEVes ir0siQCoE6C0jla3RoFMW8K2xAIVo7ipA/GqSozV5/w5kq6DtA+BL5/suMlCu3DsJJA+oL dEYWKlSorhR6/grHXnJiAPifUGBYV/9oQZIOzDoVl5x1biG6NJgIhCsXe0IhOKcdHyaDOj zRZY/qZsnmj0w3j7knR8f7nlK+TsXD0m7LrHk//zuTbgWMRyB8Z89+W1a/KqsXDDF2CoOY pShXSN48IqXQsoepQGuFiI4JFlpWnzXdzVFzKuDfUZRuG9MSau2Nlpd+dmtQuw== 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 A3206508B for ; Mon, 09 Dec 2024 21:00:59 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tKjvK-0005AF-IY; Mon, 09 Dec 2024 15:00:06 -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 1tKjvI-00059k-KG for guix-patches@gnu.org; Mon, 09 Dec 2024 15:00:04 -0500 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 1tKjvI-0007Vl-9v for guix-patches@gnu.org; Mon, 09 Dec 2024 15:00:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=8tA04GO47F3PXiip0PSkXsaT7TUZa/1VHE/4svheeoI=; b=OzEgRQobInXYNOjAviyBDH218be5DLOXGKYZD2C1qmMAmfhQqevSZPNygyL9IvC7YhbaPHrlawuxcW+xZ/J61QFpySm79jSnbJMGHDbChziO5JURarVA4a7JvYp49Q2j1ejIuSLnBB07ZFQHsOUp4CcX/+7WlSlK0EDMYkC9ljvGQG0p1Oi3XiDr8ETOGvjB/cVTVwQO7T0Q8Hjt2VEuS3VwrFIkchVRcFb15HL/4Tz0P7Ff6A+nH09wsqrL/SviEugDoOQZ4i/mB8nRgvLSIiPE5PqaUh0kgCffbpgK5dreAChfEgseaF5Afd5yF0b+/MHq7585cn7hOswwBYuaZg==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tKjvI-0002Ci-0t for guix-patches@gnu.org; Mon, 09 Dec 2024 15:00:04 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#70923] [PATCH v4 02/11] import: utils: Emit new-style package inputs. Resent-From: Herman Rimm Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 09 Dec 2024 20:00:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70923 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 70923@debbugs.gnu.org Cc: Sarah Morgensen Received: via spool by 70923-submit@debbugs.gnu.org id=B70923.17337743688221 (code B ref 70923); Mon, 09 Dec 2024 20:00:03 +0000 Received: (at 70923) by debbugs.gnu.org; 9 Dec 2024 19:59:28 +0000 Received: from localhost ([127.0.0.1]:55730 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tKjug-00028G-LU for submit@debbugs.gnu.org; Mon, 09 Dec 2024 14:59:28 -0500 Received: from 81-205-150-117.fixed.kpn.net ([81.205.150.117]:59135 helo=email.rimm.ee) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tKjub-00027N-TO for 70923@debbugs.gnu.org; Mon, 09 Dec 2024 14:59:23 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rimm.ee; s=herman; t=1733774349; h=from:from: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: in-reply-to:in-reply-to:references:references; bh=8tA04GO47F3PXiip0PSkXsaT7TUZa/1VHE/4svheeoI=; b=pBX2LkESErU5X8mYEfvmbLFXK1rYC21k7A6nCnsq2wjr2BROSDPyeRDNyRiSLg50jNvjUn Qao3H7nuywAoh9aohhsiJnQWrT7X50NtlBsackXgXP2IS/S7gPGjQ5xFt3vcIAMg5OJMV6 0C9KbeEV48//+sCKdw65j+49y/6tpcrd7aMKBkIO/2MvgRLprZ9MlwxY+/qahxxBr7BDJj 4cpcQmGxewpj4UVaVLLphVGn8X0TcNO428drih8t+2hXai/1RDO+h+Cqrw2m0DA80jY2qy fL/TNWRa0QEG75BtWZcseaRb0JxUsq+mJQBPbk1OE8FSfr+phdHbkdbI/Is+kg== Received: by 81-205-150-117.fixed.kpn.net (OpenSMTPD) with ESMTPSA id 20a99d11 (TLSv1.3:TLS_CHACHA20_POLY1305_SHA256:256:NO); Mon, 9 Dec 2024 19:59:08 +0000 (UTC) Date: Mon, 9 Dec 2024 20:58:06 +0100 Message-ID: <9e86317f85773cce9744113feb6f96fa5c462b4e.1733774143.git.herman@rimm.ee> X-Mailer: git-send-email 2.45.2 In-Reply-To: <4b8cde409e17e4b9ab7ef591eff605b88235fb0a.1733774143.git.herman@rimm.ee> References: <4b8cde409e17e4b9ab7ef591eff605b88235fb0a.1733774143.git.herman@rimm.ee> 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: , Reply-to: Herman Rimm X-ACL-Warn: , Herman Rimm via Guix-patches From: Herman Rimm via Guix-patches via 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-Migadu-Spam-Score: -2.66 X-Spam-Score: -2.66 X-Migadu-Queue-Id: A3206508B X-Migadu-Scanner: mx12.migadu.com X-TUID: qtUDARz/mPZv From: Sarah Morgensen * guix/import/utils.scm (package-names->package-inputs)[make-input]: Return new-style package inputs. (maybe-list-field): Add procedure, which wraps BODY in 'list' instead of 'quasiquote'. (maybe-packages-field): Add procedure. (maybe-inputs): Use maybe-packages-field. (maybe-native-inputs): Use maybe-packages-field. (maybe-propagated-inputs): Use maybe-packages-field. Change-Id: I66588f4c822d507ddbaf465a268bfb71af8a7ecd --- guix/import/utils.scm | 52 +++++++++++++++++++++++++------------------ 1 file changed, 30 insertions(+), 22 deletions(-) diff --git a/guix/import/utils.scm b/guix/import/utils.scm index ccf18a7bf9..4eab790645 100644 --- a/guix/import/utils.scm +++ b/guix/import/utils.scm @@ -13,6 +13,7 @@ ;;; Copyright © 2022 Alice Brenon ;;; Copyright © 2022 Kyle Meyer ;;; Copyright © 2022 Philip McGrath +;;; Copyright © 2024 Herman Rimm ;;; ;;; This file is part of GNU Guix. ;;; @@ -65,6 +66,8 @@ (define-module (guix import utils) guix-hash-url package-names->package-inputs + maybe-list-field + maybe-packages-field maybe-inputs maybe-native-inputs maybe-propagated-inputs @@ -425,39 +428,44 @@ (define* (package-names->package-inputs names #:optional (output #f)) optional OUTPUT, tries to generate a quoted list of inputs, as suitable to use in an 'inputs' field of a package definition." (define (make-input input version) - (let ((name (if version (string-append input "-" version) input))) + (let ((symbol (string->symbol + (if version + (string-append input "-" version) + input)))) (if output - (list (string->symbol name) output) - (string->symbol name)))) + (list symbol output) + symbol))) (map (match-lambda ((input version) (make-input input version)) (input (make-input input #f))) names)) -(define* (maybe-inputs package-names #:optional (output #f) - #:key (type #f)) - "Given a list of PACKAGE-NAMES, tries to generate the 'inputs' field of a -package definition. TYPE can be used to specify the type of the inputs; -either the 'native or 'propagated symbols are accepted. Left unspecified, the -snippet generated is for regular inputs." - (let ((field-name (match type - ('native 'native-inputs) - ('propagated 'propagated-inputs) - (_ 'inputs)))) - (match (package-names->package-inputs package-names output) - (() - '()) - ((package-inputs ...) - `((,field-name (list ,@package-inputs))))))) +(define* (maybe-list-field type body) + "Generates the TYPE field of a package definition if its value, BODY, +is a non-empty list." + (match body + (() '()) + ((? list?) (list (list type (cons 'list body)))))) + +(define* (maybe-packages-field type package-names + #:optional (output #f)) + "Given a list of PACKAGE-NAMES, tries to generate the TYPE field of a +package definition." + (maybe-list-field type + (package-names->package-inputs package-names output))) + +(define* (maybe-inputs package-names #:optional (output #f)) + "MAYBE-PACKAGES-FIELD for inputs." + (maybe-packages-field 'inputs package-names output)) (define* (maybe-native-inputs package-names #:optional (output #f)) - "Same as MAYBE-INPUTS, but for native inputs." - (maybe-inputs package-names output #:type 'native)) + "MAYBE-PACKAGES-FIELD for native inputs." + (maybe-packages-field 'native-inputs package-names output)) (define* (maybe-propagated-inputs package-names #:optional (output #f)) - "Same as MAYBE-INPUTS, but for propagated inputs." - (maybe-inputs package-names output #:type 'propagated)) + "MAYBE-PACKAGES-FIELD for propagated inputs." + (maybe-packages-field 'propagated-inputs package-names output)) (define* (package->definition guix-package #:optional append-version?/string) "If APPEND-VERSION?/STRING is #t, append the package's major+minor version. -- 2.45.2