From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id QESKIwhlLWOjTAEAbAwnHQ (envelope-from ) for ; Fri, 23 Sep 2022 09:49:28 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id eOyqIghlLWMqBAEAG6o9tA (envelope-from ) for ; Fri, 23 Sep 2022 09:49:28 +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 321E72E907 for ; Fri, 23 Sep 2022 09:49:28 +0200 (CEST) Received: from localhost ([::1]:44984 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1obdR7-0000cv-HI for larch@yhetil.org; Fri, 23 Sep 2022 03:49:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56968) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1obdLv-00075T-TX for guix-patches@gnu.org; Fri, 23 Sep 2022 03:44:09 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:40205) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1obdLu-0006Tf-Ff for guix-patches@gnu.org; Fri, 23 Sep 2022 03:44:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1obdLu-000391-0W for guix-patches@gnu.org; Fri, 23 Sep 2022 03:44:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#58020] [PATCH] import/utils: alist->package: Include properties. Resent-From: itd Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 23 Sep 2022 07:44:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 58020 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 58020@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.166391899712024 (code B ref -1); Fri, 23 Sep 2022 07:44:01 +0000 Received: (at submit) by debbugs.gnu.org; 23 Sep 2022 07:43:17 +0000 Received: from localhost ([127.0.0.1]:39283 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1obdLA-00037s-RT for submit@debbugs.gnu.org; Fri, 23 Sep 2022 03:43:17 -0400 Received: from lists.gnu.org ([209.51.188.17]:46002) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1obdL9-00037k-Aa for submit@debbugs.gnu.org; Fri, 23 Sep 2022 03:43:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41970) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1obdL8-0006dK-TD for guix-patches@gnu.org; Fri, 23 Sep 2022 03:43:15 -0400 Received: from mailout3.rbg.tum.de ([131.159.0.8]:33707) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1obdL6-0006IN-Gd for guix-patches@gnu.org; Fri, 23 Sep 2022 03:43:14 -0400 Received: from mailrelay1.rbg.tum.de (mailrelay1.in.tum.de [131.159.254.14]) by mailout3.rbg.tum.de (Postfix) with ESMTPS id 6C73E1003CA for ; Fri, 23 Sep 2022 09:42:56 +0200 (CEST) Received: by mailrelay1.rbg.tum.de (Postfix, from userid 112) id 691FA1A8; Fri, 23 Sep 2022 09:42:56 +0200 (CEST) Received: from mailrelay1.rbg.tum.de (localhost [127.0.0.1]) by mailrelay1.rbg.tum.de (Postfix) with ESMTP id D042B1A1 for ; Fri, 23 Sep 2022 09:42:54 +0200 (CEST) Received: from mail.net.in.tum.de (mail.net.in.tum.de [IPv6:2001:4ca0:2001:14:216:3eff:fe52:ed14]) by mailrelay1.rbg.tum.de (Postfix) with ESMTP id CE84BCD for ; Fri, 23 Sep 2022 09:42:54 +0200 (CEST) Received: from amnesix.net.in.tum.de (amnesix.net.in.tum.de [IPv6:2001:4ca0:2001:11:e2d5:5eff:fea9:55ca]) by mail.net.in.tum.de (Postfix) with ESMTP id 8A0AC28C100B; Fri, 23 Sep 2022 09:42:54 +0200 (CEST) From: itd Date: Fri, 23 Sep 2022 09:42:53 +0200 Message-ID: <87mtaqilj6.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=131.159.0.8; envelope-from=itd@net.in.tum.de; helo=mailout3.rbg.tum.de X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1663919368; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:resent-cc:resent-from:resent-sender: resent-message-id:list-id:list-help:list-unsubscribe:list-subscribe: list-post; bh=EuO0CM9aZv5+DqAOxZwuuHRFyecRLmKAWKfDqX80/Uw=; b=rv9ZRd4lPAkkOO34BnDUfAXkLGbdA3P0bzRPBbfyStVingCjpv52cCwscai1+YCnckeexE MuGnxkwrxT6FgZrxiowjbfakUBK6NhucvPJS5no9D3OFDZoZecTAxCwd2iyWxwnTFQ46+B FwOZVKHrV/Al3fjbPaZG/2OAT0vmz8TUlCze/vVO/B0fL9h4RfQMAt47pDWhimORYQgBl+ zYWkLn1FwUUisMd+NoKw9U9AhchJb6hpMlI26mbiqmCQpr2veZpsJEhhDuLTYyqJKjCe1s Qm7CT0KpMRYZkt22kebvFsHQqx2apbdytbgYKSt3Cf5+V6J6IZ9vTph7h+nwVw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1663919368; a=rsa-sha256; cv=none; b=FCcLZNjzdeUgw48xTuZGFpufeKhLsr28HHYvfGMmfjFTbV5Gpc2Q48njaGx52TuhIScuzH tn6PQpYoX6nQd3TVjLGLQaQH+9bmkD1YdnVEmA3yMD8kEJ83tCk0xahVZqoleih6NUjXTk jk4prYJKvS767IOptFc9fus3cPRwDqU0k65cuV09IY8QkvM9RSAQv7vPwyOsBt6CTvfpJU duQicf0UJgx32HQvlUNlt8H9mCTx7pnwhWyy5335T0bMQSHGeCOzgcqgYQtE3Ni+XovJFV 6aktkOMHKq5a3ptbcAqn/Sly9+mgsDVIZ1S9G/L3jMMFXoceQ8kEdba5wC3ZbQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=tum.de (policy=none); 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" X-Migadu-Spam-Score: 2.25 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=tum.de (policy=none); 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" X-Migadu-Queue-Id: 321E72E907 X-Spam-Score: 2.25 X-Migadu-Scanner: scn0.migadu.com X-TUID: eRRb9SrT88rw * guix/import/utils.scm (alist->package): Process properties field in input data and include it in the generated package. * tests/import-utils.scm ("alist->package with properties"): New test. --- Hi, this patch enables the JSON importer to include package properties in its output and a test to check that the modified function's result is consumable by functions that use these properties. Please consider applying it. Thanks! Regards itd guix/import/utils.scm | 9 +++++++++ tests/import-utils.scm | 19 +++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/guix/import/utils.scm b/guix/import/utils.scm index 7e7d116d1d..8ae04e3cfb 100644 --- a/guix/import/utils.scm +++ b/guix/import/utils.scm @@ -428,10 +428,19 @@ (define* (alist->package meta #:optional (known-inputs '())) ((key . value) (list (symbol->keyword (string->symbol key)) value))) arguments)) + (define (process-properties properties) + (append-map (match-lambda + ((key . value) + (acons (string->symbol key) value '()))) + properties)) (package (name (assoc-ref meta "name")) (version (assoc-ref meta "version")) (source (source-spec->object (assoc-ref meta "source"))) + (properties + (or (and=> (assoc-ref meta "properties") + process-properties) + '())) (build-system (lookup-build-system-by-name (string->symbol (assoc-ref meta "build-system")))) diff --git a/tests/import-utils.scm b/tests/import-utils.scm index 7c6c782917..c47348fc60 100644 --- a/tests/import-utils.scm +++ b/tests/import-utils.scm @@ -203,4 +203,23 @@ (define-module (test-import-utils) ("license" . #f)))) (package-native-inputs (alist->package meta)))) +(test-assert "alist->package with properties" + (let* ((meta '(("name" . "hello") + ("version" . "2.10") + ("source" . + ;; Use a 'file://' URI so that we don't cause a download. + ,(string-append "file://" + (search-path %load-path "guix.scm"))) + ("build-system" . "gnu") + ("properties" . (("hidden?" . #t) + ("upstream-name" . "hello-upstream"))) + ("home-page" . "https://gnu.org") + ("synopsis" . "Say hi") + ("description" . "This package says hi.") + ("license" . "GPL-3.0+"))) + (pkg (alist->package meta))) + (and (package? pkg) + (equal? (package-upstream-name pkg) "hello-upstream") + (hidden-package? pkg)))) + (test-end "import-utils") base-commit: 04cad8e29ed85be838921c7fa05f7c5bce94b6d1 -- 2.37.3