From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:470:142:3::10]:48085) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jOPFC-0005j5-1D for guix-patches@gnu.org; Tue, 14 Apr 2020 13:21:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jOPF9-0007Lh-TW for guix-patches@gnu.org; Tue, 14 Apr 2020 13:21:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:51405) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jOPF9-0007Lc-PY for guix-patches@gnu.org; Tue, 14 Apr 2020 13:21:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jOPF9-0006bp-MJ for guix-patches@gnu.org; Tue, 14 Apr 2020 13:21:03 -0400 Subject: [bug#40629] [PATCH 5/5] scripts/package: Handle JSON files. Resent-Message-ID: From: Ricardo Wurmus Message-ID: <20200414171959.3428-5-rekado@elephly.net> Date: Tue, 14 Apr 2020 19:19:59 +0200 In-Reply-To: <20200414171959.3428-1-rekado@elephly.net> References: <20200414171959.3428-1-rekado@elephly.net> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 40629@debbugs.gnu.org Cc: Ricardo Wurmus * guix/scripts/package.scm (%options): Support loading from JSON files when "install-from-file" is used. --- guix/scripts/package.scm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm index badb1dcd38..40445832aa 100644 --- a/guix/scripts/package.scm +++ b/guix/scripts/package.scm @@ -7,6 +7,7 @@ ;;; Copyright =C2=A9 2016 Benz Schenk ;;; Copyright =C2=A9 2016 Chris Marusich ;;; Copyright =C2=A9 2019 Tobias Geerinckx-Rice +;;; Copyright =C2=A9 2020 Ricardo Wurmus ;;; ;;; This file is part of GNU Guix. ;;; @@ -33,6 +34,7 @@ #:use-module (guix packages) #:use-module (guix profiles) #:use-module (guix search-paths) + #:use-module (guix import json) #:use-module (guix monads) #:use-module (guix utils) #:use-module (guix config) @@ -418,7 +420,10 @@ Install, remove, or upgrade packages in a single trans= action.\n")) (option '(#\f "install-from-file") #t #f (lambda (opt name arg result arg-handler) (values (alist-cons 'install - (load* arg (make-user-module '())) + (let ((file (or (and (string-suffix= ? ".json" arg) + (json->scheme-= file arg)) + arg))) + (load* file (make-user-module '()= ))) result) #f))) (option '(#\r "remove") #f #t --=20 2.25.1