From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id 2DadDTS/LWNsSQEAbAwnHQ (envelope-from ) for ; Fri, 23 Sep 2022 16:14:12 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id CJ7PDDS/LWMY1gAAG6o9tA (envelope-from ) for ; Fri, 23 Sep 2022 16:14:12 +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 E295D138D2 for ; Fri, 23 Sep 2022 16:14:11 +0200 (CEST) Received: from localhost ([::1]:36668 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1objRS-0004wY-Un for larch@yhetil.org; Fri, 23 Sep 2022 10:14:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46260) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1objRL-0004su-0b for guix-patches@gnu.org; Fri, 23 Sep 2022 10:14:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:42267) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1objRK-0008HR-HS for guix-patches@gnu.org; Fri, 23 Sep 2022 10:14:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1objRK-0007Qq-54 for guix-patches@gnu.org; Fri, 23 Sep 2022 10:14:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#58020] [PATCH] import: print: Quasiquote properties Resent-From: itd Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 23 Sep 2022 14:14:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 58020 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 58020@debbugs.gnu.org Received: via spool by 58020-submit@debbugs.gnu.org id=B58020.166394240628517 (code B ref 58020); Fri, 23 Sep 2022 14:14:02 +0000 Received: (at 58020) by debbugs.gnu.org; 23 Sep 2022 14:13:26 +0000 Received: from localhost ([127.0.0.1]:41344 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1objQk-0007Pt-5q for submit@debbugs.gnu.org; Fri, 23 Sep 2022 10:13:26 -0400 Received: from mailout3.rbg.tum.de ([131.159.0.8]:37263) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1objQg-0007Pf-Qt for 58020@debbugs.gnu.org; Fri, 23 Sep 2022 10:13:24 -0400 Received: from mailrelay1.rbg.tum.de (mailrelay1.in.tum.de [131.159.254.14]) by mailout3.rbg.tum.de (Postfix) with ESMTPS id 79F5C1003CA for <58020@debbugs.gnu.org>; Fri, 23 Sep 2022 16:13:16 +0200 (CEST) Received: by mailrelay1.rbg.tum.de (Postfix, from userid 112) id 760151AB; Fri, 23 Sep 2022 16:13:16 +0200 (CEST) Received: from mailrelay1.rbg.tum.de (localhost [127.0.0.1]) by mailrelay1.rbg.tum.de (Postfix) with ESMTP id 8C16D1A1 for <58020@debbugs.gnu.org>; Fri, 23 Sep 2022 16:13:12 +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 8A136CD for <58020@debbugs.gnu.org>; Fri, 23 Sep 2022 16:13:12 +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 744BB28C100B; Fri, 23 Sep 2022 16:13:12 +0200 (CEST) From: itd In-Reply-To: <87mtaqilj6.fsf@localhost> References: <87mtaqilj6.fsf@localhost> Date: Fri, 23 Sep 2022 16:11:52 +0200 Message-ID: <874jwyi3iv.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain 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=1663942452; 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:in-reply-to:in-reply-to:references:references: list-id:list-help:list-unsubscribe:list-subscribe:list-post; bh=VxHnN5Fw7oQJ2w3PWvbaXkHEsxPKcOXTnK/RwH5wmCA=; b=SqQd/FNcsFjHOWZrgJGnofIp4uPGV7r32oeNCuwho0md4h+nIegpBaY6dOHc3q8jig97IV DhnXAXjvqk+Dqq6Ja08d0UKCcJtZLQa9J2qMCzari85BZr+cEYqq0Gnm6d7Qhde/PBkZB/ lOh0uATJh8jCNjkj8Hvqyyi0cShigXqBrSkeklRPjx70ewyxfbkP0cGMql69OIbvGzDOkT sRpeYtiG/YEc+ILPlPC5/bNVUwhLPBrq8xNpUk6ufSMUVQAIAxQC7Nh/PSOYyGEwCDFrH7 lVeWo4wCA4xgE0B+toh1bb2oG0E4FulIye+utG9cwNr/+t7InXyi8ARBNUHZUA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1663942452; a=rsa-sha256; cv=none; b=hpzXtEa+c/kq/g/ryoz8bgiF5+g1Bv4p9AN0unulY1rohNFdDgzjBrDeLbb8aqi4Uu7IfM sa7gqmggh5cwNOP58YkLiGk4RJpFM7yQ97K3KGBY8ZeqQ1GZVc7Uha7HeRW8TsT2pugB3k CONhpaTY0Ku4blfhWWpfLDb1sWfzDa482XP45oWrtDm20LNs+CqCkxZcjCmo9tp8oTQiga rR97GfHdcnVS6YXAY7p008I6MxCs6eGEccdSTUwf2FmarYRK+E8aER0jq4r2eN1JW8ABXM uykzLr7YNwURLqsvsVNy1pdswbwGDCT4XLZ4/L2DlU4AwMgTM/o81gT3Z0on/g== 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: 3.15 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: E295D138D2 X-Spam-Score: 3.15 X-Migadu-Scanner: scn0.migadu.com X-TUID: Mp2SW/JC5EYu * guix/import/print.scm (package->code): Quasiquote properties. * tests/print.scm (pkg-with-properties, pkg-with-properties-source): New variables. ("package with properties"): New test --- Hi again, if I'm not mistaken, it is also required to (quasi)quote the value of properties. This patch updates package->code to achieve this. Afterward, the following command: > $ guix import json /dev/stdin < { > "name": "hello", > "version": "2.10", > "source": "mirror://gnu/hello/hello-2.10.tar.gz", > "build-system": "gnu", > "home-page": "https://www.gnu.org/software/hello/", > "synopsis": "Hello, GNU world: An example GNU package", > "description": "GNU Hello prints a greeting.", > "license": "GPL-3.0+", > "native-inputs": ["gettext"], > "properties": { > "hidden?": true, > "upstream-name": "hello-upstream" > } > } > EOF should produce the following package definition: > (define-public hello > (package > (name "hello") > (version "2.10") > (source (origin > (method url-fetch) > (uri (string-append "mirror://gnu/hello/hello-" version > ".tar.gz")) > (sha256 > (base32 > "0ssi1wpaf7plaswqqjwigppsg5fyh99vdlb9kzl7c9lng89ndq1i")))) > (properties `((upstream-name . "hello-upstream") (hidden? . #t))) > (build-system (@ (guix build-system gnu) gnu-build-system)) > (native-inputs (list (@ (gnu packages gettext) gnu-gettext))) > (home-page "https://www.gnu.org/software/hello/") > (synopsis "Hello, GNU world: An example GNU package") > (description "GNU Hello prints a greeting.") > (license license:gpl3+))) > hello Regards itd guix/import/print.scm | 3 ++- tests/print.scm | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/guix/import/print.scm b/guix/import/print.scm index 66016145cb..2f54adbd8c 100644 --- a/guix/import/print.scm +++ b/guix/import/print.scm @@ -200,7 +200,8 @@ (define (package->code package) (source ,(source->code source version)) ,@(match properties (() '()) - (_ `((properties ,properties)))) + (_ `((properties + ,(list 'quasiquote (object->code properties #t)))))) ,@(if replacement `((replacement ,replacement)) '()) diff --git a/tests/print.scm b/tests/print.scm index d9710d1ed3..b4f193b905 100644 --- a/tests/print.scm +++ b/tests/print.scm @@ -139,6 +139,25 @@ (define-with-source pkg-with-arguments pkg-with-arguments-source (description "This is a dummy package.") (license license:gpl3+))) +(define-with-source pkg-with-properties pkg-with-properties-source + (package + (name "test") + (version "1.2.3") + (source (origin + (method url-fetch) + (uri (string-append "file:///tmp/test-" + version ".tar.gz")) + (sha256 + (base32 + "070pwb7brdcn1mfvplkd56vjc7lbz4iznzkqvfsakvgbv68k71ah")))) + (properties + `((hidden? . #t) (upstream-name "test-upstream"))) + (build-system (@ (guix build-system gnu) gnu-build-system)) + (home-page "http://gnu.org") + (synopsis "Dummy") + (description "This is a dummy package.") + (license license:gpl3+))) + (test-equal "simple package" `(define-public test ,pkg-source) (package->code pkg)) @@ -159,4 +178,8 @@ (define-with-source pkg-with-arguments pkg-with-arguments-source `(define-public test ,pkg-with-arguments-source) (package->code pkg-with-arguments)) +(test-equal "package with properties" + `(define-public test ,pkg-with-properties-source) + (package->code pkg-with-properties)) + (test-end "print") -- 2.37.3