From patchwork Mon May 29 14:45:25 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: 50431 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 341B627BBEA; Mon, 29 May 2023 15:47:48 +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=-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 A3D8A27BBE2 for ; Mon, 29 May 2023 15:47:47 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q3e9c-0002Ej-37; Mon, 29 May 2023 10:47:24 -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 1q3e9L-00023p-KV for guix-patches@gnu.org; Mon, 29 May 2023 10:47:07 -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 1q3e9L-00034X-CQ for guix-patches@gnu.org; Mon, 29 May 2023 10:47:07 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1q3e9L-0001QA-94 for guix-patches@gnu.org; Mon, 29 May 2023 10:47:07 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#63571] [PATCH v2 14/19] 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: Mon, 29 May 2023 14:47:07 +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.16853716155310 (code B ref 63571); Mon, 29 May 2023 14:47:07 +0000 Received: (at 63571) by debbugs.gnu.org; 29 May 2023 14:46:55 +0000 Received: from localhost ([127.0.0.1]:58789 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q3e99-0001NT-3s for submit@debbugs.gnu.org; Mon, 29 May 2023 10:46:55 -0400 Received: from eggs.gnu.org ([209.51.188.92]:45764) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q3e8G-0001JG-9D for 63571@debbugs.gnu.org; Mon, 29 May 2023 10:46:00 -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 1q3e8B-0002fr-2K; Mon, 29 May 2023 10:45:55 -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=XFfOEecD3EWBftHvE06x Kq+j957qapBmBXFWvktdK6D9l5E5J6VHIYLTtOimZ3luhgS5yNDC4/u9IyrRHClL9DSYxKorPWk9q qtCs+Fz4GuZMD5eaEoFtdzgt5X3R9jkMv70f1pcZJ7gIz6zrPO93jwiP0Q1txtZixdZ8uK8bYFQtz 3GI7Iu4lntkxLBDxNn+8dqlXd8KN+BdNuXlbi5rR519qPJgkyuHQu9ASXhyHwccFptfR/sp3aQyp+ z1v6WlhL5+d7vOUYGGxK0ZLNuhmhHwp9tM48eh8XCO6ib1t48HDngUsmA/UNFdFmGgOeNuFIdVoLV 7XzoX5b6zAc5JA==; 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 1q3e8A-00044B-L4; Mon, 29 May 2023 10:45:54 -0400 From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Mon, 29 May 2023 16:45:25 +0200 Message-Id: X-Mailer: git-send-email 2.40.1 In-Reply-To: <87y1l7fb9j.fsf@gnu.org> References: <87y1l7fb9j.fsf@gnu.org> 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