From patchwork Mon May 29 14:45:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 50433 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 64A1727BBE2; Mon, 29 May 2023 15:47:51 +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 340AF27BBE9 for ; Mon, 29 May 2023 15:47:50 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q3e9c-0002E4-01; 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 1q3e9M-00023x-BR for guix-patches@gnu.org; Mon, 29 May 2023 10:47:08 -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-00034r-VE 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 1q3e9L-0001QK-OI; Mon, 29 May 2023 10:47:07 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#63571] [PATCH v2 15/19] import: elpa: Updater provides input list. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: andrew@trop.in, liliana.prikler@gmail.com, 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?= , Andrew Tropin , Liliana Marie Prikler X-Debbugs-Original-Xcc: Andrew Tropin , Liliana Marie Prikler Received: via spool by 63571-submit@debbugs.gnu.org id=B63571.16853716165317 (code B ref 63571); Mon, 29 May 2023 14:47:07 +0000 Received: (at 63571) by debbugs.gnu.org; 29 May 2023 14:46:56 +0000 Received: from localhost ([127.0.0.1]:58791 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q3e99-0001Nb-IE for submit@debbugs.gnu.org; Mon, 29 May 2023 10:46:56 -0400 Received: from eggs.gnu.org ([209.51.188.92]:45780) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q3e8H-0001JO-6s for 63571@debbugs.gnu.org; Mon, 29 May 2023 10:46:02 -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 1q3e8C-0002gA-08; Mon, 29 May 2023 10:45:56 -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=BoWmbPozV1pulrqNU1oS32x/gPEOI0MTCrYrvIhaJb0=; b=AYicoDfqUwQtmoPDXlJT JKoMsXONgsCT8AcND8xFXnJx5ENBBmLKE2NI9uNw4CYlZCSbnuF/CiRhoSJGlEwf6mKDo0za+nA+F HSsNeay69JWJ+GJcLPPeLDnt94twNKUlTarJH6AFcl07ybOxfNvTZrWVmtLkUnsWWgAY1LuUgzy2F iZIJLf0mS+iVP5GlD1A1UvcWGuY1FyGkk4Hl1dx+E28BbQ5sjL+p8VmqvJXns1XF5bUIBjp6efRMh W801grjnlYTD2zIYSqxDbxSFThdW6gHeM3s0rG7EpJilZ9xMjXxqVVYsxjCkYi1hpJSrrnjcDZP1Z kz6fG1TtUTS8Fg==; 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 1q3e8B-00044B-JD; Mon, 29 May 2023 10:45:55 -0400 From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Mon, 29 May 2023 16:45:26 +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/elpa.scm (elpa-dependency->upstream-input): New procedure. (latest-release): Add 'inputs' field. * tests/elpa.scm ("package-latest-release"): New test. --- guix/import/elpa.scm | 30 +++++++++++++++++++++++++-- tests/elpa.scm | 48 ++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 74 insertions(+), 4 deletions(-) diff --git a/guix/import/elpa.scm b/guix/import/elpa.scm index 1313a8aa67..e65cf6683b 100644 --- a/guix/import/elpa.scm +++ b/guix/import/elpa.scm @@ -272,6 +272,25 @@ (define* (melpa-recipe->origin recipe) (assq-ref recipe ':fetcher)) #f))) +(define (elpa-dependency->upstream-input dependency) + "Convert DEPENDENCY, an sexp as returned by 'elpa-package-inputs', into an +." + (match dependency + ((name version) + (and (not (emacs-standard-library? (symbol->string name))) + (upstream-input + (name (symbol->string name)) + (downstream-name (elpa-guix-name name)) + (type 'propagated) + (min-version (if (pair? version) + (string-join (map number->string version) ".") + #f)) + (max-version (match version + (() #f) + ((_) #f) + ((_ _) #f) + (_ min-version)))))))) + (define default-files-spec ;; This contains more than just the things contained in %default-include and ;; %default-exclude, presumably because this includes source files (*.in, @@ -421,12 +440,19 @@ (define* (latest-release package #:key (version #f)) (elpa-version->string raw-version)))) (url (match info ((_ raw-version reqs synopsis kind . rest) - (package-source-url kind name version repo))))) + (package-source-url kind name version repo)))) + (inputs (match info + ((name raw-version reqs . _) + (filter-map elpa-dependency->upstream-input + (if (eq? 'nil reqs) + '() + reqs)))))) (upstream-source (package (package-name package)) (version version) (urls (list url)) - (signature-urls (list (string-append url ".sig")))))))) + (signature-urls (list (string-append url ".sig"))) + (inputs inputs)))))) (define elpa-repository (memoize diff --git a/tests/elpa.scm b/tests/elpa.scm index 1efdf2457f..56008fe014 100644 --- a/tests/elpa.scm +++ b/tests/elpa.scm @@ -1,6 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2015 Federico Beffa -;;; Copyright © 2020 Ludovic Courtès +;;; Copyright © 2020, 2023 Ludovic Courtès ;;; Copyright © 2020 Martin Becze ;;; Copyright © 2021 Xinglu Chen ;;; @@ -21,6 +21,8 @@ (define-module (test-elpa) #:use-module (guix import elpa) + #:use-module (guix upstream) + #:use-module ((guix download) #:select (url-fetch)) #:use-module (guix tests) #:use-module (guix tests http) #:use-module (srfi srfi-1) @@ -40,8 +42,20 @@ (define elpa-mock-archive (auctex . [(11 88 6) nil "Integrated environment for *TeX*" tar - ((:url . "http://www.gnu.org/software/auctex/"))]))) + ((:url . "http://www.gnu.org/software/auctex/"))]) + (taxy-magit-section . + [(0 12 2) + ((emacs + (26 3)) + (magit-section + (3 2 1)) + (taxy + (0 10))) + "View Taxy structs in a Magit Section buffer" tar + ((:url . "https://github.com/alphapapa/taxy.el") + (:keywords "lisp"))]))) + (test-begin "elpa") (define (eval-test-with-elpa pkg) @@ -73,6 +87,36 @@ (define (eval-test-with-elpa pkg) (test-assert "elpa->guix-package test 1" (eval-test-with-elpa "auctex")) +(test-equal "package-latest-release" + (list '("https://elpa.gnu.org/packages/taxy-magit-section-0.12.2.tar") + '("https://elpa.gnu.org/packages/taxy-magit-section-0.12.2.tar.sig") + (list (upstream-input + (name "magit-section") + (downstream-name "emacs-magit-section") + (type 'propagated) + (min-version "3.2.1") + (max-version min-version)) + (upstream-input + (name "taxy") + (downstream-name "emacs-taxy") + (type 'propagated) + (min-version "0.10") + (max-version #f)))) + (with-http-server `((200 ,(object->string elpa-mock-archive))) + (parameterize ((current-http-proxy (%local-url))) + (define source + (package-latest-release + (dummy-package "emacs-taxy-magit-section" + (version "0.0.0") + (source (dummy-origin + (method url-fetch) + (uri "https://elpa.gnu.org/xyz")))) + (list %elpa-updater))) + + (list (upstream-source-urls source) + (upstream-source-signature-urls source) + (upstream-source-inputs source))))) + (test-equal "guix-package->elpa-name: without 'upstream-name' property" "auctex" (guix-package->elpa-name (dummy-package "emacs-auctex")))