From patchwork Wed Jan 10 00:04:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felix Lechner X-Patchwork-Id: 58721 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 411DE27BBEA; Wed, 10 Jan 2024 00:06:09 +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=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham 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 1561827BBE9 for ; Wed, 10 Jan 2024 00:06:08 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rNM6Y-0001Mu-4J; Tue, 09 Jan 2024 19:05:58 -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 1rNM6V-0001KW-QR for guix-patches@gnu.org; Tue, 09 Jan 2024 19:05:55 -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 1rNM6V-0000p9-HY for guix-patches@gnu.org; Tue, 09 Jan 2024 19:05:55 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rNM6c-0001Sr-CO for guix-patches@gnu.org; Tue, 09 Jan 2024 19:06:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#68356] [PATCH] guix: import(cpan): Complete even when modules do not exist on CPAN. Resent-From: Felix Lechner Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 10 Jan 2024 00:06:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 68356 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 68356@debbugs.gnu.org Cc: Felix Lechner X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.17048451055552 (code B ref -1); Wed, 10 Jan 2024 00:06:02 +0000 Received: (at submit) by debbugs.gnu.org; 10 Jan 2024 00:05:05 +0000 Received: from localhost ([127.0.0.1]:41335 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rNM5g-0001RT-MY for submit@debbugs.gnu.org; Tue, 09 Jan 2024 19:05:05 -0500 Received: from lists.gnu.org ([2001:470:142::17]:43076) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rNM5e-0001Qt-Fc for submit@debbugs.gnu.org; Tue, 09 Jan 2024 19:05:03 -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 1rNM5Q-00083M-1J for guix-patches@gnu.org; Tue, 09 Jan 2024 19:04:48 -0500 Received: from sail-ipv4.us-core.com ([208.82.101.137]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_CHACHA20_POLY1305:256) (Exim 4.90_1) (envelope-from ) id 1rNM5C-0000AG-AR for guix-patches@gnu.org; Tue, 09 Jan 2024 19:04:47 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=2017; bh=KBhZBAyuKvhRJ8R 5nBkZxug658JZAHSH0JdYyao9c2s=; h=date:subject:cc:to:from; d=lease-up.com; b=ouI7feLYyhlfWUWoLufnQSQeL9UQcPdSV/weuIq3zTd7RGAeUIav DjSuTbGMfvFLzjNtR90fN3EYv6A0ioI5KWDXrT41TWqGXLUZmO99TfPVhUrFmk/zSbnF1I Mqm006NxlqttHnWuC5cvHt+vKxgaGbOiS4WTGB+KZ0gmGzUr4= Received: by sail-ipv4.us-core.com (OpenSMTPD) with ESMTPSA id 57a0c7df (TLSv1.3:TLS_CHACHA20_POLY1305_SHA256:256:NO); Wed, 10 Jan 2024 00:04:29 +0000 (UTC) Received: from localhost (localhost [local]) by localhost (OpenSMTPD) with ESMTPA id f760a4fd; Wed, 10 Jan 2024 00:04:28 +0000 (UTC) Date: Tue, 9 Jan 2024 16:04:13 -0800 Message-ID: <444f876473d530a973b2ca2309e593069ceb08c1.1704845053.git.felix.lechner@lease-up.com> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Received-SPF: pass client-ip=208.82.101.137; envelope-from=felix.lechner@us-core.com; helo=sail-ipv4.us-core.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.248, SPF_HELO_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_TEMPERROR=0.01, UNPARSEABLE_RELAY=0.001 autolearn=no 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: , Reply-to: Felix Lechner X-ACL-Warn: , Felix Lechner via Guix-patches X-Patchwork-Original-From: Felix Lechner via Guix-patches via From: Felix Lechner 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 Allows the following import command to complete: guix import cpan SOAP::Lite As a side note, the Perl module was needed to deploy Debbugs on GNU Guix. Change-Id: Ic184c3e95e18ec8385b181ab8c34035cbb0aa0f5 --- guix/import/cpan.scm | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) base-commit: b9fae146d6cc4a6968a8eb18beef29aa1414a31e diff --git a/guix/import/cpan.scm b/guix/import/cpan.scm index b87736eef6..de557bc024 100644 --- a/guix/import/cpan.scm +++ b/guix/import/cpan.scm @@ -138,11 +138,16 @@ (define (module->dist-name module) "Return the base distribution module for a given module. E.g. the 'ok' module is distributed with 'Test::Simple', so (module->dist-name \"ok\") would return \"Test-Simple\"" - (assoc-ref (json-fetch (string-append - (%metacpan-base-url) "/module/" - module - "?fields=distribution")) - "distribution")) + (let* ((url (string-append + (%metacpan-base-url) "/module/" module + "?fields=distribution")) + (json-alist (json-fetch url)) + (dist-name (assoc-ref json-alist "distribution"))) + (if (not dist-name) + (format (current-error-port) + "Cannot determine distribution name for module ~s from ~s~%" + module url)) + dist-name)) (define (package->upstream-name package) "Return the CPAN name of PACKAGE." @@ -249,10 +254,14 @@ (define (cran-dependency->upstream-input dependency) #f)))) (and type (not (core-module? module)) ;expensive call! - (upstream-input - (name (module->dist-name module)) - (downstream-name (cpan-name->downstream-name name)) - (type type))))))) + (let* ((cpan-name (module->dist-name module)) + (downstream-name (if cpan-name + (cpan-name->downstream-name cpan-name) + (format #f "Module ~a not found on CPAN" module)))) + (upstream-input + (name cpan-name) + (downstream-name downstream-name) + (type type)))))))) (define (cpan-module-inputs release) "Return the list of for dependencies of RELEASE, a