From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id EDPyAQi7dGRo/QAASxT56A (envelope-from ) for ; Mon, 29 May 2023 16:47:36 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id eDEnAgi7dGRd3gAA9RJhRA (envelope-from ) for ; Mon, 29 May 2023 16:47:36 +0200 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 845152CF58 for ; Mon, 29 May 2023 16:47:35 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q3e9S-00028n-5M; Mon, 29 May 2023 10:47:14 -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 1q3e9M-00024N-V9 for guix-patches@gnu.org; Mon, 29 May 2023 10:47:09 -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 1q3e9M-00035A-NV for guix-patches@gnu.org; Mon, 29 May 2023 10:47:08 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1q3e9M-0001Qc-JF; Mon, 29 May 2023 10:47:08 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#63571] [PATCH v2 17/19] import: gem: Updater provides input list. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: mail@cbaines.net, guix-patches@gnu.org Resent-Date: Mon, 29 May 2023 14:47:08 +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?= , Christopher Baines X-Debbugs-Original-Xcc: Christopher Baines Received: via spool by 63571-submit@debbugs.gnu.org id=B63571.16853716175333 (code B ref 63571); Mon, 29 May 2023 14:47:08 +0000 Received: (at 63571) by debbugs.gnu.org; 29 May 2023 14:46:57 +0000 Received: from localhost ([127.0.0.1]:58795 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q3e9A-0001Nq-OP for submit@debbugs.gnu.org; Mon, 29 May 2023 10:46:57 -0400 Received: from eggs.gnu.org ([209.51.188.92]:44092) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q3e8I-0001JY-TN for 63571@debbugs.gnu.org; Mon, 29 May 2023 10:46:03 -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 1q3e8D-0002gZ-MQ; Mon, 29 May 2023 10:45:57 -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=VuED8ok7eyfVWIWkDh5geyD8bwN3CMbMYtGfNUwCbaM=; b=mzgXr7u4wzrqLfNGWruW HnaiGSyVa/UKoQkYuedDbFddjN9/oTlTtbKJ7zdZIJz4qaxpdKF+ieyOr7GMh6rg5R/yiS1P7e0JZ MzDt1PrEl/CUSqx3QyH6wbF4bAU1RfpigU+n9Wmu00JgOlJwj4Wx5cI/m620ug4khAuG7IqIYavKv 0PRqkNPdiBeuGvhFxIYadHEyiD+uyzS9b46xbGzzKEzyzbwNh3eFvLZ0VDesBR2Ab+rulooScrG5N QFXKeuRY7NNvPF4O35cVT1Q+51rFFes0EsyHw+7tH3vhq4HPMUW2j2f/ikLy5hU3znSbOikXeZmee LKha3punXQy77Q==; 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 1q3e8D-00044B-99; Mon, 29 May 2023 10:45:57 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Date: Mon, 29 May 2023 16:45:28 +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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Seal: i=1; s=key1; d=yhetil.org; t=1685371655; a=rsa-sha256; cv=none; b=Z4rNqm4sCgh6/oEq3DzZtSaQhMF8ud3+vrmunlEfpjB38OXcR1xTFh2ImUevXEqyBhLTFD jPM1VKK0r2nqur6oH387NfxFGbwavUlvvjtCqsl8QoDwLzhxlzMSCtPz8iU8HspJL+9x+q ErcFrEBLpqjNsLVjwegnP+g4yDAUZLat6+jpfeAidOppzP6ABMFsEVcpo4LtZFRxmpJr5C XNimr3VylMMoVCorHjr5odgJHDYegCMEYPvF3nTenWIFLf8jWhCvAMTPhQbrPQ7MDFUKmp 9fT9KfdthRWii5w3uFndXRz2V0dTcra6eSpfFf5pfgsuK9cfMQJAj1B3nNwfWg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=mzgXr7u4; dmarc=pass (policy=none) header.from=gnu.org; 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" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1685371655; h=from:from:sender:sender: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=VuED8ok7eyfVWIWkDh5geyD8bwN3CMbMYtGfNUwCbaM=; b=cI+9sywdyubPpTffidOAl9S5c0mjbpuiVHDtA/d08GUPLe2IGuk23KQ61k41zv6vQhJ09/ lBOup8MdYQwtJUII5bjH2c0oaJ/Y1bzngO4XeRXIA/RZTgveHoD9es9nRG2p0/Nh7L7Gfl blooh4kECaGqxAcUnzP7lrdg4SiLtfyWx1TmLnTUe0R9CRWgEgrSvqn5iK7onUtqIcvr8y Lp4k0qZscpPRu4BeIQQDb8ZLy+hwGMJr4xdZGsF+dHPIoVkUZt86yNH86G0zGKgbpEaAn+ NVUHo28ckh7kLZFb+SCzG+zJytBccaCxMs7UwEO1SCEKbpdIkGa7Mv29ZJSYeA== X-Migadu-Spam-Score: -2.61 X-Spam-Score: -2.61 X-Migadu-Queue-Id: 845152CF58 X-Migadu-Scanner: scn0.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=mzgXr7u4; dmarc=pass (policy=none) header.from=gnu.org; 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" X-TUID: xh4hzd3lrjML * guix/import/gem.scm (import-release): Add 'inputs' field. * tests/gem.scm ("package-latest-release"): New test. --- guix/import/gem.scm | 13 +++++++++++-- tests/gem.scm | 31 +++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/guix/import/gem.scm b/guix/import/gem.scm index 87a75bdaa6..56cbc681a1 100644 --- a/guix/import/gem.scm +++ b/guix/import/gem.scm @@ -2,7 +2,7 @@ ;;; Copyright © 2015 David Thompson ;;; Copyright © 2016 Ben Woodcroft ;;; Copyright © 2018 Oleg Pykhalov -;;; Copyright © 2020, 2021 Ludovic Courtès +;;; Copyright © 2020, 2021, 2023 Ludovic Courtès ;;; Copyright © 2020 Martin Becze ;;; Copyright © 2021 Sarah Morgensen ;;; Copyright © 2022 Taiju HIGASHI @@ -176,12 +176,21 @@ (define* (import-release package #:key (version #f)) "Return an for the latest release of PACKAGE." (let* ((gem-name (guix-package->gem-name package)) (gem (rubygems-fetch gem-name)) + (inputs (map (lambda (dependency) + (let ((name (gem-dependency-name dependency))) + (upstream-input + (name name) + (downstream-name + (ruby-package-name name)) + (type 'propagated)))) + (gem-dependencies-runtime (gem-dependencies gem)))) (version (or version (gem-version gem))) (url (rubygems-uri gem-name version))) (upstream-source (package (package-name package)) (version version) - (urls (list url))))) + (urls (list url)) + (inputs inputs)))) (define %gem-updater (upstream-updater diff --git a/tests/gem.scm b/tests/gem.scm index 023415de7b..a2b5e39077 100644 --- a/tests/gem.scm +++ b/tests/gem.scm @@ -4,6 +4,7 @@ ;;; Copyright © 2018 Oleg Pykhalov ;;; Copyright © 2021 Sarah Morgensen ;;; Copyright © 2022 Taiju HIGASHI +;;; Copyright © 2023 Ludovic Courtès ;;; ;;; This file is part of GNU Guix. ;;; @@ -22,6 +23,9 @@ (define-module (test-gem) #:use-module (guix import gem) + #:use-module (guix upstream) + #:use-module ((guix download) #:select (url-fetch)) + #:use-module ((guix build-system ruby) #:select (rubygems-uri)) #:use-module (guix base32) #:use-module (gcrypt hash) #:use-module (guix tests) @@ -253,4 +257,31 @@ (define test-bundler-json (x (pk 'fail x #f))))) +(test-equal "package-latest-release" + (list '("https://rubygems.org/downloads/foo-1.0.0.gem") + (list (upstream-input + (name "bundler") + (downstream-name name) + (type 'propagated)) + (upstream-input + (name "bar") + (downstream-name "ruby-bar") + (type 'propagated)))) + (mock ((guix http-client) http-fetch + (lambda (url . rest) + (match url + ("https://rubygems.org/api/v1/gems/foo.json" + (values (open-input-string test-foo-json) + (string-length test-foo-json))) + (_ (error "Unexpected URL: " url))))) + (let ((source (package-latest-release + (dummy-package "ruby-foo" + (version "0.1.2") + (source (dummy-origin + (method url-fetch) + (uri (rubygems-uri "foo" + version)))))))) + (list (upstream-source-urls source) + (upstream-source-inputs source))))) + (test-end "gem") -- 2.40.1