From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id AEXNEIuVx2XTaQAAe85BDQ:P1 (envelope-from ) for ; Sat, 10 Feb 2024 16:26:03 +0100 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id AEXNEIuVx2XTaQAAe85BDQ (envelope-from ) for ; Sat, 10 Feb 2024 16:26:03 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=rimm.ee header.s=herman header.b=r6S2c8QI; 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"; dmarc=pass (policy=none) header.from=gnu.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1707578763; h=from:from:sender:sender:reply-to: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: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=op7bF8F1b1OTwSeokEUg8hn+kRNWkcf7ZjC40gFNidI=; b=OuXyCkfAkzTtag1P1HEeRKyZUvX/239e+y106DKwA5wr4vNLBA24OSgvMtQrq/rIKwUvDn WPn6M1j7VK/vqpfU+L1zesA/d2UioOTIsLW7MAi4Bvkx+aO1/fcy+UDDkcM4CPn1qKaAXR wm/xMLl7283Szn9L2MCM7HSoWnRH+Uz4sqkyv9gQweKXRrP06lFFqinQ+2oG82CYSO2s5T Agf//3mRIdj7VOicGidW907bzzMt9cL5fOT3FIuJGwsj9+VNlIMgagGkn25tyGzsOHJeYQ D9bqJzkL8E43V5/YYZdFlYef7aTq7dTSS/OeuuJ0vwlqKJULq7p2th9kazw9bA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=rimm.ee header.s=herman header.b=r6S2c8QI; 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"; dmarc=pass (policy=none) header.from=gnu.org ARC-Seal: i=1; s=key1; d=yhetil.org; t=1707578763; a=rsa-sha256; cv=none; b=GgZqbCuRVafpxBmnlmIXhP9fWeyPdmp0KWL1XvzfmW6nNKf/VjV9Kl7MeeQAo4zRC+x7eR h0d+fdMehjBBYtf78be/ZcGxWKiWVHg1KB/i3u9BK7zquOhYA6O+yof1KFWHSllmj80hmo Acp3kCstwqGF6TqLN85+av7inqHXpK1p/17mNRNJ2rppWWQyNekLlJ64cpqkzsVAKXcCvi aFS1ByGTQ2Q+wZ2yrcqv+L4avyh1ztZQxey42BAKxqvfuUC8wWRTals2Z7r/cCizH0SV2s /KQzp1OXkajH17lAr6IBUauhmOEHjyv86NpqTsl1DZpKB2AnwfWRoXcmm9mpXg== 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 C26AA14349 for ; Sat, 10 Feb 2024 16:26:02 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rYpEj-0004Av-Vg; Sat, 10 Feb 2024 10:25:49 -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 1rYpEh-0004AR-AO for guix-patches@gnu.org; Sat, 10 Feb 2024 10:25:47 -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 1rYpEg-00019L-W3 for guix-patches@gnu.org; Sat, 10 Feb 2024 10:25:47 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rYpEw-0005Ha-8G for guix-patches@gnu.org; Sat, 10 Feb 2024 10:26:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#68935] [PATCH v2 5/6] import: Insert packages into modules alphabetically. Resent-From: Herman Rimm Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 10 Feb 2024 15:26: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: ludo@gnu.org Received: via spool by 68935-submit@debbugs.gnu.org id=B68935.170757871620202 (code B ref 68935); Sat, 10 Feb 2024 15:26:02 +0000 Received: (at 68935) by debbugs.gnu.org; 10 Feb 2024 15:25:16 +0000 Received: from localhost ([127.0.0.1]:48778 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rYpEA-0005Fj-ND for submit@debbugs.gnu.org; Sat, 10 Feb 2024 10:25:15 -0500 Received: from 81-205-150-117.fixed.kpn.net ([81.205.150.117]:51833 helo=email.rimm.ee) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rYowm-0004VC-1d for 68935@debbugs.gnu.org; Sat, 10 Feb 2024 10:07:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rimm.ee; s=herman; t=1707577613; 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=op7bF8F1b1OTwSeokEUg8hn+kRNWkcf7ZjC40gFNidI=; b=r6S2c8QIxEqgRHIhsMKmYJKA6MvC0bHuo8qZgI9eUAaz4rffCMftXXSv34ZKD9Jvgg988P LDe9e6pEcsMeu7sXnZy4ygJflBbmsEwZB+JE6YOYD9rOAjtRegi0K8S6+DvI97mVTtFxQZ NH8uEeFa/W818BTQCS9weTXYPHcPzuySRNnunTbTrgMkWbwTF+Yd2Pfs7cLemFapidZbIE Ev2gGedslUVkNkFJyRHrsF9rl8eidudIbYcyPLs9t8qr0mLzMHB6vgq6crcIwFaKF2khUi K5DO/BmrSruQ8vg64NmAa1blRW5FU1CBsdhDZ0ZvHYgZ6QFYp3IiLGjKtNT2Bw== Received: by 81-205-150-117.fixed.kpn.net (OpenSMTPD) with ESMTPSA id e67dc082 (TLSv1.3:TLS_CHACHA20_POLY1305_SHA256:256:NO); Sat, 10 Feb 2024 15:06:53 +0000 (UTC) Date: Sat, 10 Feb 2024 16:06:49 +0100 Message-ID: References: <3c0da641938e96a9f0c491abb74b30c75634df9a.1707505804.git.herman@rimm.ee> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: 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: -6.68 X-Migadu-Scanner: mx13.migadu.com X-Spam-Score: -6.68 X-Migadu-Queue-Id: C26AA14349 X-TUID: Hk3Djb4Wx7N6 Hi, On Fri, Feb 09, 2024 at 08:25:17PM +0100, Herman Rimm wrote: > diff --git a/guix/scripts/import.scm b/guix/scripts/import.scm > index 77fcfe3990..850887e720 100644 > --- a/guix/scripts/import.scm > +++ b/guix/scripts/import.scm > @@ -67,10 +67,39 @@ (define (show-help) > (display (G_ " > -h, --help display this help and exit")) > (display (G_ " > + -i, --insert insert into package module alphabetically")) > + (display (G_ " > -V, --version display version information and exit")) > (newline) > (show-bug-report-information)) > > +(define (define-import importer args proc) > + "Wrap package expressions from IMPORTER with 'define-public and invoke > +PROC callback." > + (if (member importer importers) > + (match (apply (resolve-importer importer) args) > + ((and expr (or ('package _ ...) > + ('let _ ...))) > + (proc (package->definition expr))) > + ((and expr ('define-public _ ...)) With doc/package-hello.json file: [ { "name": "myhello", "version": "2.10", "source": "mirror://gnu/hello/hello-2.10.tar.gz", "build-system": "gnu", "arguments": { "tests?": false }, "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"] } ] 'guix import json doc/package-hello.json' produces: Starting download of /tmp/guix-file.BLTipY From https://ftpmirror.gnu.org/gnu/hello/hello-2.10.tar.gz... following redirection to `https://mirrors.ibiblio.org/gnu/hello/hello-2.10.tar.gz'... …10.tar.gz 709KiB 1.6MiB/s 00:00 ▕██████████████████▏ 100.0% (define-public myhello (package (name "myhello") (version "2.10") (source (origin (method url-fetch) (uri (string-append "mirror://gnu/hello/hello-" version ".tar.gz")) (sha256 (base32 "0ssi1wpaf7plaswqqjwigppsg5fyh99vdlb9kzl7c9lng89ndq1i")))) (build-system (@ (guix build-system gnu) gnu-build-system)) (arguments `(#:tests? #f)) (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+))) Backtrace: 4 (primitive-load "/home/herman/.cache/guix/inferiors/umi…") In guix/ui.scm: 2324:7 3 (run-guix . _) 2287:10 2 (run-guix-command _ . _) In srfi/srfi-1.scm: 634:9 1 (for-each # …) In guix/scripts/import.scm: 88:21 0 (_ _) guix/scripts/import.scm:88:21: Throw to key `match-error' with args `("match" "no matching pattern" myhello)'. I think I can remove the (myhello) variable expression after definition from the JSON importer in a future revision. Just a heads up. Also I provided a reduced package-hello.json, because after fixing the comma syntax, importing the file gives: Starting download of /tmp/guix-file.dVsYSt From https://ftpmirror.gnu.org/gnu/hello/hello-2.10.tar.gz... following redirection to `https://mirrors.ibiblio.org/gnu/hello/hello-2.10.tar.gz'... …10.tar.gz 709KiB 1.5MiB/s 00:00 ▕██████████████████▏ 100.0% Starting download of /tmp/guix-file.B2wURN From https://example.com/greeter-1.0.tar.gz... download failed "https://example.com/greeter-1.0.tar.gz" 404 "Not Found" Starting download of /tmp/guix-file.B2wURN From https://web.archive.org/web/20240210155936/https://example.com/greeter-1.0.tar.gz... following redirection to `https://web.archive.org/web/20221219143408/http://example.com/greeter-1.0.tar.gz'... download failed "https://web.archive.org/web/20221219143408/http://example.com/greeter-1.0.tar.gz" 404 "Not Found" Trying to use Disarchive to assemble /tmp/guix-file.B2wURN... could not find its Disarchive specification failed to download "/tmp/guix-file.B2wURN" from "https://example.com/greeter-1.0.tar.gz" Backtrace: 13 (primitive-load "/home/herman/.cache/guix/inferiors/umi…") In guix/ui.scm: 2324:7 12 (run-guix . _) 2287:10 11 (run-guix-command _ . _) In guix/scripts/import.scm: 80:6 10 (guix-import . _) In ice-9/boot-9.scm: 1747:15 9 (with-exception-handler # …) In guix/scripts/import/json.scm: 91:16 8 (_) In ice-9/boot-9.scm: 1747:15 7 (with-exception-handler # …) In guix/import/json.scm: 72:19 6 (_) In srfi/srfi-1.scm: 460:18 5 (fold # …) In guix/import/json.scm: 81:55 4 (_ (("inputs" . #("myhello" "hello")) ("license" . #) …) …) In guix/import/utils.scm: 543:12 3 (alist->package (("inputs" . #("myhello" "hello")) # …) _) 162:33 2 (source-spec->object "https://example.com/greeter-1.0.t…") In ice-9/ports.scm: 450:11 1 (call-with-input-file #f # …) In unknown file: 0 (open-file #f "r" #:encoding #f #:guess-encoding #f) Can greeter have a real source? What should it be? Cheers, Herman Rimm