From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id WIGZN3Ef82bCHwEAqHPOHw:P1 (envelope-from ) for ; Tue, 24 Sep 2024 20:22:10 +0000 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id WIGZN3Ef82bCHwEAqHPOHw (envelope-from ) for ; Tue, 24 Sep 2024 22:22:10 +0200 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=C2nQWvPd; dkim=fail ("headers rsa verify failed") header.d=rimm.ee header.s=herman header.b=guk9BEfR; 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=pass (policy=none) header.from=gnu.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1727209329; 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=afbMubt9LidZxOOyGfUEUMlVliWU5sOoy7FfjG+uatQ=; b=a1Z5j0E25K30guT22b8uGAMNFoEnPGxiPGbYqythWITsFFWhDlLjT6Tn/E0UDcqQHDR2gF zCDqHvnpYsx90sV1m5zOQ+zwf005/fOmky46tIA4RJue/16fHJG9+z+HAp6cKHRiUoSZEb e9p18/qQfVOdrkNpqOACnoYWw6g7qqchrxKK0Ce1u/l13JiAaEu+WSVTBs3xgSAHJECh44 Ryjat0gxW8gATbwv5rjQ18x/HhUF9S3H5mojYvPti9e+5ByAYB+uCLrs42vYY9sLflGC7v PEekgoTgPKPeobsZtZUP8r3/H23adsU+1FwNnKZTV40W8KxD3dFnRwIIrfHpFg== 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=C2nQWvPd; dkim=fail ("headers rsa verify failed") header.d=rimm.ee header.s=herman header.b=guk9BEfR; 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=pass (policy=none) header.from=gnu.org ARC-Seal: i=1; s=key1; d=yhetil.org; t=1727209329; a=rsa-sha256; cv=none; b=H/yQ53JcoZ7UVwBPIF/Kx9s/48ytjBkVZrYNQB/y4fdQCRE9uiH0eUrBOy2iupT2NlidPW S3rgVPrVowC0XbkQyaDAeTRQNQZYsC1k1CPJwIx1p8wGhCGViOWmdRNfW9Rt4G5INEEbJd e4fZO9NDJ5nqkaRAexJqbxIyhw0Yc2rsU5+cD5ekBkhYG5IuU8r7coTvafmAWGe6dXWzSf ES+ss7omwTAple2nZlBhBMr9aZJ20IbRlq5JEH6rUeqdDszO7oxPFnUnFh5bUUJ+hxECaY ndfM5pJQeDyWI1Cu05m5PbSMsrrciJuEiP7fA1NBpjZpjZQbKqhyWZti8P9QbA== 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 9F7607B8AC for ; Tue, 24 Sep 2024 22:22:09 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1stC2w-0000g5-T0; Tue, 24 Sep 2024 16:22:06 -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 1stC2X-0000JK-E6 for guix-patches@gnu.org; Tue, 24 Sep 2024 16:21:41 -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 1stC2V-0003Or-Ho for guix-patches@gnu.org; Tue, 24 Sep 2024 16:21:39 -0400 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=afbMubt9LidZxOOyGfUEUMlVliWU5sOoy7FfjG+uatQ=; b=C2nQWvPdMhZ1DdIU7+XyVRYt/ZA92KIRR8JL2RaW7hfLG4KHY/wNj0LkJMI5zDiJcErZSXOhRs7NfV65ITktNelpYgXwGVPZ3cauIKRpD+82s9S7uWx6AnHI3pIL/JXrHDV0981pQLImpf8fz20bT+KH3g3pbru/TeG4CgT29of2LEkMSfhypeVxzvtnjfxGRC4DNRt/l9ixZHBFGzcg6cVyvfOxxA0e72YBS0rmCBh2NQL5uhkv4E/nEae6aj7437fYPSoI+b9y+fu7YxItaguHkMRdXERn+vNlcthvowMb+Zn8AD0N7PvVLhS8E1QcjonnXBtJWN9duO8FbQRJzA==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1stC2u-00054X-8y for guix-patches@gnu.org; Tue, 24 Sep 2024 16:22:04 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#70923] [PATCH v3 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: Tue, 24 Sep 2024 20:22:04 +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.172720928719339 (code B ref 70923); Tue, 24 Sep 2024 20:22:04 +0000 Received: (at 70923) by debbugs.gnu.org; 24 Sep 2024 20:21:27 +0000 Received: from localhost ([127.0.0.1]:38501 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1stC2H-00051Z-Et for submit@debbugs.gnu.org; Tue, 24 Sep 2024 16:21:26 -0400 Received: from 81-205-150-117.fixed.kpn.net ([81.205.150.117]:37373 helo=email.rimm.ee) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1stC2C-00050F-VG for 70923@debbugs.gnu.org; Tue, 24 Sep 2024 16:21:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rimm.ee; s=herman; t=1727208845; 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=afbMubt9LidZxOOyGfUEUMlVliWU5sOoy7FfjG+uatQ=; b=guk9BEfRXSpGOrERsi/0lOAyRmXyc2lbs915ZyAZ2vqsLgEIGWspN/3HAPgSTx92GuE2+G R6OOS3UxI7RW7o4nBbtbCoRTALZ0m/amPSakCO5xHRx5NO1fiazpw5ZOqVMxqHEt88WDQT I3r2c94mOqexkHe4LQ7xxvkpA1q7waRTSsc2z7+mjkgGHf/tOUcid95szT5sqDu6ehhHYR c2t4t73a+ajhRMSqjguce7Gph5NDOSof6iVngkWLvYUhZR9lc+x/9xcMFE0BTv1AWw4S1z yU8HazauPHj9PCHbNtGF9fokiklfg8RUmLVAvjNymdlqBugn/iRyb7eXTVOhew== Received: by 81-205-150-117.fixed.kpn.net (OpenSMTPD) with ESMTPSA id b16b5ee3 (TLSv1.3:TLS_CHACHA20_POLY1305_SHA256:256:NO); Tue, 24 Sep 2024 20:14:05 +0000 (UTC) Date: Tue, 24 Sep 2024 22:13:08 +0200 Message-ID: <3776de27f3b8917f8d3272ba167ebfe5ce707a5c.1727207512.git.herman@rimm.ee> X-Mailer: git-send-email 2.45.2 In-Reply-To: References: 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: -4.91 X-Spam-Score: -4.91 X-Migadu-Queue-Id: 9F7607B8AC X-Migadu-Scanner: mx10.migadu.com X-TUID: L2PDSQrqC28Q 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 b7756fcc40..88a1db4a88 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 @@ -418,39 +421,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