From patchwork Thu May 18 15:16:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 50116 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 5A9B627BBE2; Thu, 18 May 2023 16:18:20 +0100 (BST) 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_H2,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 9C59717A72 for ; Thu, 18 May 2023 16:18:18 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pzfOG-0004f0-OP; Thu, 18 May 2023 11:18:04 -0400 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 1pzfOF-0004d6-9H for guix-patches@gnu.org; Thu, 18 May 2023 11:18:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pzfOF-0002A6-0p for guix-patches@gnu.org; Thu, 18 May 2023 11:18:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pzfOE-0005Xa-Ry for guix-patches@gnu.org; Thu, 18 May 2023 11:18:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#63571] [PATCH 13/14] import: cpan: Updater provides input list. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 18 May 2023 15:18:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63571 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 63571@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= Received: via spool by 63571-submit@debbugs.gnu.org id=B63571.168442303021173 (code B ref 63571); Thu, 18 May 2023 15:18:02 +0000 Received: (at 63571) by debbugs.gnu.org; 18 May 2023 15:17:10 +0000 Received: from localhost ([127.0.0.1]:54164 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pzfNO-0005VL-0k for submit@debbugs.gnu.org; Thu, 18 May 2023 11:17:10 -0400 Received: from eggs.gnu.org ([209.51.188.92]:55698) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pzfN3-0005R0-Ac for 63571@debbugs.gnu.org; Thu, 18 May 2023 11:16:49 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pzfMy-0001wR-4F; Thu, 18 May 2023 11:16:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=AJIRNvPuRGp7n+ouE86Sv0Ifra7WWFR8mKH0dXxOYa8=; b=nPwTIr08CLcaonJ136+j Y/6kwMDfPJM2a/y4B4xOK4gS7djesF7yvmulF6imv8OHj3uhqKmKUilsnxPbzdoLGAo7UpQPYG0lU Vj5NDom+Ym/sd7+7ydoW3YSTqXAkTTMz5+o7dSxrb9bfh2GL4u+31wtzXWqLBulmgrTJKnt8KS4A7 lkUOC2N6dypO15XHPCq3bf7Q0Xauvcjr6/eJ6Kjdt0OBhqdsTbGdmi29UzOyD7b3TVKZGWROx6zl+ Xee8H14/Ly0FK5crnmgjnGKkF9Sce1kCtv2ab//Z7vYPkxMdigGwuVWWfkEjDzFP11b5miTsJ13PW 0q6Gu7sgTl2b3A==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201] helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pzfMx-0007G6-Nr; Thu, 18 May 2023 11:16:43 -0400 From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Thu, 18 May 2023 17:16:21 +0200 Message-Id: X-Mailer: git-send-email 2.40.1 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: , 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/import/cpan.scm (latest-release): Add 'inputs' field. * tests/cpan.scm ("package-latest-release"): New test. --- guix/import/cpan.scm | 3 ++- tests/cpan.scm | 27 +++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/guix/import/cpan.scm b/guix/import/cpan.scm index b6587d6821..b87736eef6 100644 --- a/guix/import/cpan.scm +++ b/guix/import/cpan.scm @@ -354,7 +354,8 @@ (define* (latest-release package #:key (version #f)) (upstream-source (package (package-name package)) (version version) - (urls (list url))))))) + (urls (list url)) + (inputs (cpan-module-inputs release))))))) (define %cpan-updater (upstream-updater diff --git a/tests/cpan.scm b/tests/cpan.scm index c9dd6d36de..5fcce85d8d 100644 --- a/tests/cpan.scm +++ b/tests/cpan.scm @@ -21,7 +21,10 @@ (define-module (test-cpan) #:use-module (guix import cpan) #:use-module (guix base32) + #:use-module (guix upstream) + #:use-module ((guix download) #:select (url-fetch)) #:use-module (gcrypt hash) + #:use-module (guix tests) #:use-module (guix tests http) #:use-module ((guix store) #:select (%graft?)) #:use-module (srfi srfi-64) @@ -92,6 +95,30 @@ (define test-source (x (pk 'fail x #f)))))) +(test-equal "package-latest-release" + (list '("http://example.com/Foo-Bar-0.1.tar.gz") + #f + (list (upstream-input + (name "Test-Script") + (downstream-name "perl-test-script") + (type 'propagated)))) + (with-http-server `((200 ,test-json) + (200 ,test-source) + (200 "{ \"distribution\" : \"Test-Script\" }")) + (define source + (parameterize ((%metacpan-base-url (%local-url))) + (package-latest-release + (dummy-package "perl-test-script" + (version "0.0.0") + (source (dummy-origin + (method url-fetch) + (uri "mirror://cpan/Foo-Bar-0.0.0.tgz")))) + (list %cpan-updater)))) + + (list (upstream-source-urls source) + (upstream-source-signature-urls source) + (upstream-source-inputs source)))) + (test-equal "metacpan-url->mirror-url, http" "mirror://cpan/authors/id/T/TE/TEST/Foo-Bar-0.1.tar.gz" (metacpan-url->mirror-url