From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id OOBuKLbE2GbsQwEAe85BDQ:P1 (envelope-from ) for ; Wed, 04 Sep 2024 20:36:06 +0000 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id OOBuKLbE2GbsQwEAe85BDQ (envelope-from ) for ; Wed, 04 Sep 2024 22:36:06 +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=SuByaMdq; dkim=fail ("headers rsa verify failed") header.d=rimm.ee header.s=herman header.b=gD9GmUXW; 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=1725482166; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=vrJ+37BkyyeUR0PVGNLav5TKtzlwQIHZ9Fm4yb6OMnw=; b=eCNVh/co4MDUfUhKRqtoZBmnFBXmq1etUa6YNByoMXveKM8kV7wst8xoZj10R3ZKN4U9uP rEJXNEvMz9g0n/9oUZHjOlNeqHdgmhDAG8oEWCH4hN5veCoeqTaAy7wlseNd63PmxQVsmU B3se1i8NEA8WlG+RQeZAIwaS8zjxYg5MUjmURj6gjRAJK6UQtLSej7o941YeO6OOvksMPT mJnLp7vQKpcgEIIEu9Ej/f9MS2SWa0bNMwSiJqrnKloE1+75dhI22ATsuF1pe6QhTxsqvI xJ2ceaa66jBLrrvxcuEuMJ+s3b5ChXUKlOD60kyh8orAuaANjtBxMWyE0gHPJA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1725482166; a=rsa-sha256; cv=none; b=PdpYxA7hsOZ3OAaQSqkN+ZVDmOPirGTK9lrgS27fHvqHTCLOwP/tbo8uhXzATQe9QutjP8 CtUvAc8PwGW6AY//Fg7BWGmWGoW6dGVBee/LQmRQRBbU3cDqSaTwUtZOOFzrXfSJkSN7ds nWun1RrN484VoHTghnPtqWJV9Vp6uOOIWf0PkN6JOlDynJA3bexJ63LIETgpZNZTUzwRCz dBGUYBVQtEba8cgMwnJ3HyAOVI43t4O9FGzG7+JqvU4z92WXGCk3nB3tIjEVLlth5XdGvI qWwhvqzchOm3BTwLfvnXAHxCkPJtF3YLFoYodEABZYlCqwsSPYUUGyqZsb013A== 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=SuByaMdq; dkim=fail ("headers rsa verify failed") header.d=rimm.ee header.s=herman header.b=gD9GmUXW; 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" 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 7B531EEBB for ; Wed, 04 Sep 2024 22:36:06 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1slwin-0003Du-Rc; Wed, 04 Sep 2024 16:35:21 -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 1slwiT-00038O-SK for guix-patches@gnu.org; Wed, 04 Sep 2024 16:35:02 -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 1slwiT-0002FK-JB for guix-patches@gnu.org; Wed, 04 Sep 2024 16:35:01 -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=vrJ+37BkyyeUR0PVGNLav5TKtzlwQIHZ9Fm4yb6OMnw=; b=SuByaMdq9GKIvyQgn9aEAYR8+nl44dI9W5NcqdK46aCS0svZ2PqApBTw0aHQ0u9jeUCXBZo19v36VJhe8GjUiV9zgp1aGxM3wKEvRPGZThRNZGuY/HzMqB6UZN34tNZ//CmYDxKnNob/5XZiVRFN0OVSGGFm6b3EKxTgbS1Kuj5277RSWQLCgPnwPLWH+qAxSHOvwJDQlVOhheK/KoxtR5P3YclcgZmPxUMneAqYElVm3ouYaKw2ddFxvsRkSUnU4vlftluz1oI3dNd3ndeAzHuJdiYR40KCrHk4t73LF5yxEGHQ0o8UPNmN2DIfQGaFpZHU/Ky2ik4T6izLSH1j7Q==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1slwjV-0005MW-KU for guix-patches@gnu.org; Wed, 04 Sep 2024 16:36:05 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#70923] [PATCH v2 09/12] import: cran: Refactor format-inputs and use maybe-list-field. Resent-From: Herman Rimm Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 04 Sep 2024 20:36:05 +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 Received: via spool by 70923-submit@debbugs.gnu.org id=B70923.172548211520445 (code B ref 70923); Wed, 04 Sep 2024 20:36:05 +0000 Received: (at 70923) by debbugs.gnu.org; 4 Sep 2024 20:35:15 +0000 Received: from localhost ([127.0.0.1]:35473 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1slwig-0005JZ-UD for submit@debbugs.gnu.org; Wed, 04 Sep 2024 16:35:15 -0400 Received: from 81-205-150-117.fixed.kpn.net ([81.205.150.117]:45431 helo=email.rimm.ee) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1slwib-0005HS-Q9 for 70923@debbugs.gnu.org; Wed, 04 Sep 2024 16:35:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rimm.ee; s=herman; t=1725482031; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vrJ+37BkyyeUR0PVGNLav5TKtzlwQIHZ9Fm4yb6OMnw=; b=gD9GmUXWkjR80u6PE57sH7zPxPM9aoezAjtEHwq/bJmrR5pWwXHvxwjwkox5mClTb8foTw DUn0U87A1DtJ0g87gMAfD67WIMoNqwjbrIWmYgh40qFZWCa4iR+zpF7LxVaeTco/PVebnN U2bp9QrXp9oQ3KzWg0/tRnusxlFk4Um/JiJn+NBTFXotOtTdMnQKXbq9vYydjU/ZDA2M4F Xf6H/dw4hIGchJnnUIkSTYO2M5fIMUYf4FvNgJyGY9XwzMY1w8UTUqCE/UmDAGBEo9YVMs MfHYbOAkF8ka9PxvVgcnpkVNEXj8bADDj12Bwa6yZ4Oz9+LPiYqfAYrwZjLcOg== Received: by 81-205-150-117.fixed.kpn.net (OpenSMTPD) with ESMTPSA id 4b6d1ba7 (TLSv1.3:TLS_CHACHA20_POLY1305_SHA256:256:NO) for <70923@debbugs.gnu.org>; Wed, 4 Sep 2024 20:33:51 +0000 (UTC) Date: Wed, 4 Sep 2024 22:33:03 +0200 Message-ID: <20240904203309.23715-9-herman@rimm.ee> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240904203309.23715-1-herman@rimm.ee> References: <20240904203309.23715-1-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: -3.98 X-Spam-Score: -3.98 X-Migadu-Queue-Id: 7B531EEBB X-Migadu-Scanner: mx11.migadu.com X-TUID: PubaZLFsBsa8 * guix/import/cran.scm (format-inputs): Split and move procedure ... (maybe-inputs): ... to here, and use maybe-list-field procedure. Change-Id: I5148afcebdac1f7fa0f8cce9e82e8cebb56c36c8 --- guix/import/cran.scm | 36 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/guix/import/cran.scm b/guix/import/cran.scm index 6ae00cae96..bdac059053 100644 --- a/guix/import/cran.scm +++ b/guix/import/cran.scm @@ -6,6 +6,7 @@ ;;; Copyright © 2021 Sarah Morgensen ;;; Copyright © 2021 Simon Tournier ;;; Copyright © 2022 Hartmut Goebel +;;; Copyright © 2024 Herman Rimm ;;; ;;; This file is part of GNU Guix. ;;; @@ -85,21 +86,6 @@ (define-module (guix import cran) (define %input-style (make-parameter 'variable)) ; or 'specification -(define (format-inputs inputs) - "Generate a sorted list of package inputs from a list of upstream inputs." - (map (lambda (input) - (case (%input-style) - ((specification) - `(specification->package ,(upstream-input-downstream-name input))) - (else - ((compose string->symbol - upstream-input-downstream-name) - input)))) - (sort inputs - (lambda (a b) - (string-cilicenses license-string license-prefix) (let ((licenses (map string-trim-both @@ -188,11 +174,21 @@ (define (description->alist description) (define* (maybe-inputs package-inputs #:optional (input-type 'inputs)) "Given a list of PACKAGE-INPUTS, tries to generate the TYPE field of a package definition." - (match package-inputs - (() - '()) - ((package-inputs ...) - `((,input-type (list ,@(format-inputs package-inputs))))))) + (define (format-input input) + (case (%input-style) + ((specification) + `(specification->package ,(upstream-input-downstream-name input))) + (else + ((compose string->symbol + upstream-input-downstream-name) + input)))) + + (define (upstream-input-name