From patchwork Mon Feb 5 15:07:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Herman Rimm X-Patchwork-Id: 59798 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 2174127BBEB; Mon, 5 Feb 2024 15:09:21 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 5A5D127BBEA for ; Mon, 5 Feb 2024 15:09:20 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rX0ad-0000yv-Ib; Mon, 05 Feb 2024 10:08:55 -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 1rX0ab-0000xk-Pq for guix-patches@gnu.org; Mon, 05 Feb 2024 10:08:53 -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 1rX0aa-0006wF-Ve; Mon, 05 Feb 2024 10:08:52 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rX0ak-0004qU-9U; Mon, 05 Feb 2024 10:09:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#68935] [PATCH 2/3] guix: import: Wrap package expressions with define-public. Resent-From: Herman Rimm Original-Sender: "Debbugs-submit" Resent-CC: guix@cbaines.net, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, rekado@elephly.net, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Mon, 05 Feb 2024 15:09:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68935 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 68935@debbugs.gnu.org Cc: Herman Rimm , Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 68935-submit@debbugs.gnu.org id=B68935.170714569918554 (code B ref 68935); Mon, 05 Feb 2024 15:09:02 +0000 Received: (at 68935) by debbugs.gnu.org; 5 Feb 2024 15:08:19 +0000 Received: from localhost ([127.0.0.1]:52045 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rX0a2-0004pA-Ix for submit@debbugs.gnu.org; Mon, 05 Feb 2024 10:08:18 -0500 Received: from 81-205-150-117.fixed.kpn.net ([81.205.150.117]:43641 helo=email.rimm.ee) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rX0Zy-0004oD-Pq for 68935@debbugs.gnu.org; Mon, 05 Feb 2024 10:08:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rimm.ee; s=herman; t=1707145673; 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=/IPLwMx8HZP07Kwigd95/LUuPce0HMolgFR6mKhVN7w=; b=rc+HqMYWe8lBXNtF0yrXHkxg887bK7WbSmujKr0jJTcLjoVwO9uRbXtjnXbmXJHlKBxhHT u6TqqjF3TSOWFVe9mifTHkzWCJ/KdB75/mXOa8IVd4mljebt6HTBBnJHxfMFwDXwHU0voP xnM0qEWNM34h2Ee8TYrPETqcshhLyom7PQA2KegqEngTP5EAcxkB9QTouW4RYWueHLtJo1 8U9UnZnTg2HpYGji3F1QFUybGadRdc0v7daN0Ed5HhRVamfPAXvlTdj3JRpiPak62zX3NT Tu+O0laXcnwjvTfqFLw7JcsFkfeMoxShzuEWT22zINuODvbStCC069otTdDu0A== Received: by 81-205-150-117.fixed.kpn.net (OpenSMTPD) with ESMTPSA id 38f6fb90 (TLSv1.3:TLS_CHACHA20_POLY1305_SHA256:256:NO); Mon, 5 Feb 2024 15:07:53 +0000 (UTC) Date: Mon, 5 Feb 2024 16:07:13 +0100 Message-ID: X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 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 X-Patchwork-Original-From: Herman Rimm via Guix-patches via From: Herman Rimm Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * guix/scripts/import.scm (guix-import): Wrap package expressions. Change-Id: Ic4d986a4706a692b2fecd6fded8ac72ab6311687 --- guix/scripts/import.scm | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/guix/scripts/import.scm b/guix/scripts/import.scm index d2a1cee56e..80b1bec7fc 100644 --- a/guix/scripts/import.scm +++ b/guix/scripts/import.scm @@ -6,6 +6,7 @@ ;;; Copyright © 2021 Simon Tournier ;;; Copyright © 2021 Xinglu Chen ;;; Copyright © 2022 Philip McGrath +;;; Copyright © 2024 Herman Rimm ;;; ;;; This file is part of GNU Guix. ;;; @@ -23,6 +24,7 @@ ;;; along with GNU Guix. If not, see . (define-module (guix scripts import) + #:use-module (guix import utils) #:use-module (guix ui) #:use-module (guix scripts) #:use-module (guix read-print) @@ -88,17 +90,23 @@ (define-command (guix-import . args) (leave-on-EPIPE (pretty-print-with-comments (current-output-port) expr))))) (match (apply (resolve-importer importer) args) - ((and expr (or ('package _ ...) - ('let _ ...) + ((and expr ('package _ ...)) + (print (package->definition expr))) + ((and expr (or ('let _ ...) ('define-public _ ...))) (print expr)) ((? list? expressions) (for-each (lambda (expr) - (print expr) - ;; Two newlines: one after the closing paren, and - ;; one to leave a blank line. - (newline) (newline)) - expressions)) + (match expr + ((and expr ('package _ ...)) + (print (package->definition expr))) + ((and expr (or ('let _ ...) + ('define-public _ ...))) + (print expr))) + ;; Two newlines: one after the closing paren, and + ;; one to leave a blank line. + (newline) (newline)) + expressions)) (x (leave (G_ "'~a' import failed~%") importer)))) (let ((hint (string-closest importer importers #:threshold 3)))