From patchwork Sun Oct 6 23:55:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Graves X-Patchwork-Id: 68658 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 B2D7327BBE2; Mon, 7 Oct 2024 00:57:22 +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=-7.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS 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 9E89A27BBE9 for ; Mon, 7 Oct 2024 00:57:21 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sxb7R-0004WJ-87; Sun, 06 Oct 2024 19:56:58 -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 1sxb7Q-0004Vq-1U for guix-patches@gnu.org; Sun, 06 Oct 2024 19:56:56 -0400 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 1sxb7P-0000fj-Q6 for guix-patches@gnu.org; Sun, 06 Oct 2024 19:56:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:From:To:In-Reply-To:References:Subject; bh=lqH3vuVy7R0wiVtwQCjrNEDHgtCuCM5ajc+RccoYXJc=; b=tRZK4wRBvPu+2pazXRnr2MQ5MWTPHmu6uElX8XqR9AO588jUmq+f720ZS91f5zZzQqG5waVWkQYm90diTyks/383K4gvKieeA/KTk+B6MxIOaIaUFs0pE0buaNdb1amBr/iq31f8dU2D1FEccMIqUI4h8r8zoQwCovd16J3ockZRxiD7484LgjZhyUJg9LMh4lqAmQcQvM42uOq2QyUzWyT0VDMVnOizvBwj+LrzEV2kc1NLRw/CYzQJr7wP9QPqS7LWV4moRVIjY+QiPjS5fkF+/6FDD+e4SV3ygn0I+zOhtYN/xfZsdaThxW1C/C16WVRXLxtICTbOrLfkP9yuig==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sxb7V-0001p9-UL for guix-patches@gnu.org; Sun, 06 Oct 2024 19:57:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#70227] [PATCH v2 1/2] guix: import: composer: Handle parsing failures. References: <20240406020415.9360-1-ngraves@ngraves.fr> In-Reply-To: <20240406020415.9360-1-ngraves@ngraves.fr> Resent-From: Nicolas Graves Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 06 Oct 2024 23:57:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70227 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 70227@debbugs.gnu.org Cc: Nicolas Graves Received: via spool by 70227-submit@debbugs.gnu.org id=B70227.17282589826943 (code B ref 70227); Sun, 06 Oct 2024 23:57:01 +0000 Received: (at 70227) by debbugs.gnu.org; 6 Oct 2024 23:56:22 +0000 Received: from localhost ([127.0.0.1]:42918 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sxb6r-0001nu-VH for submit@debbugs.gnu.org; Sun, 06 Oct 2024 19:56:22 -0400 Received: from 4.mo582.mail-out.ovh.net ([87.98.184.159]:33529) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sxb6n-0001ng-Iy for 70227@debbugs.gnu.org; Sun, 06 Oct 2024 19:56:20 -0400 Received: from director4.ghost.mail-out.ovh.net (unknown [10.108.25.169]) by mo582.mail-out.ovh.net (Postfix) with ESMTP id 4XMK1P1Jfhz1M4B for <70227@debbugs.gnu.org>; Sun, 6 Oct 2024 23:56:08 +0000 (UTC) Received: from ghost-submission-55b549bf7b-rnhqs (unknown [10.108.54.132]) by director4.ghost.mail-out.ovh.net (Postfix) with ESMTPS id 9AD191FD15; Sun, 6 Oct 2024 23:56:08 +0000 (UTC) Received: from ngraves.fr ([37.59.142.95]) by ghost-submission-55b549bf7b-rnhqs with ESMTPSA id U/b8EpgjA2cLkgcAJichJw (envelope-from ); Sun, 06 Oct 2024 23:56:08 +0000 Authentication-Results: garm.ovh; auth=pass (GARM-95G001ee546021-ac5d-417c-af0a-775a314de644, A12302D5D8CF0E033BA678025A323BF4FAD59D46) smtp.auth=ngraves@ngraves.fr X-OVh-ClientIp: 86.246.19.221 Date: Mon, 7 Oct 2024 01:55:59 +0200 Message-ID: <20241006235605.24248-1-ngraves@ngraves.fr> X-Mailer: git-send-email 2.46.0 MIME-Version: 1.0 X-Ovh-Tracer-Id: 2564799991059112674 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeeftddrvddvkedgvdekucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucenucfjughrpefhvfevufffkffoggfgsedtkeertdertddtnecuhfhrohhmpefpihgtohhlrghsucfirhgrvhgvshcuoehnghhrrghvvghssehnghhrrghvvghsrdhfrheqnecuggftrfgrthhtvghrnhepkeffgeetfffgffejgeejvdffgfdtvdeuueetgfefuedvjeegvdegjeejveeuueevnecukfhppeduvdejrddtrddtrddupdekiedrvdegiedrudelrddvvddupdefjedrheelrddugedvrdelheenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeduvdejrddtrddtrddupdhmrghilhhfrhhomhepnhhgrhgrvhgvshesnhhgrhgrvhgvshdrfhhrpdhnsggprhgtphhtthhopedupdhrtghpthhtohepjedtvddvjeesuggvsggsuhhgshdrghhnuhdrohhrghdpoffvtefjohhsthepmhhoheekvddpmhhouggvpehsmhhtphhouhht DKIM-Signature: a=rsa-sha256; bh=lqH3vuVy7R0wiVtwQCjrNEDHgtCuCM5ajc+RccoYXJc=; c=relaxed/relaxed; d=ngraves.fr; h=From; s=ovhmo4487190-selector1; t=1728258969; v=1; b=bf7VSJ1UkuhSXPNF6rCjgdKSAseWfamtXzF7gd4LKWiLr9HK9WIaI5X5bwgaSosLun0WGqr4 c4Xiy1o8UGZwnWINZOFZKZ4zpjfJEEW2mgj3RTdwL003fWy1RD/LQMhOatVXF/K/539eB5V/VpI aFJM5PfhpS4//7f4KWpK7059djSB6GeI6x+fEByMjnQbxD7QORtQ3aJpWaxRNi+a7stJ3JUyQ4J 3eGUAkwPlsHLafv4NNRxH0LnkuQPKTOKj3Hvjsjlpo+QwgXlsa3F1tKmW3e4bYEN3VWNbq82EHJ yQDWkI2s5lh02VOQfcrCr0tVsmyCaYNDFEf8HKaEwrG+Q== 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: Nicolas Graves X-ACL-Warn: , Nicolas Graves via Guix-patches X-Patchwork-Original-From: Nicolas Graves via Guix-patches via From: Nicolas Graves 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/composer (latest-release): Handle parsing failures. Rename package to composer-package for clarity. Change-Id: I57f6fba7b05122b031177681e76cf0b5c9547736 --- guix/import/composer.scm | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/guix/import/composer.scm b/guix/import/composer.scm index 1ad608964b..75419ca63e 100644 --- a/guix/import/composer.scm +++ b/guix/import/composer.scm @@ -243,16 +243,19 @@ (define (php-package? package) (eq? (package-build-system package) composer-build-system) (string-prefix? "php-" (package-name package)))) -(define (latest-release package) +(define* (latest-release package #:key (version #f)) "Return an for the latest release of PACKAGE." (let* ((php-name (guix-package->composer-name package)) - (package (composer-fetch php-name)) - (version (composer-package-version package)) - (url (composer-source-url (composer-package-source package)))) - (upstream-source - (package (package-name package)) - (version version) - (urls (list url))))) + (composer-package (composer-fetch php-name #:version version))) + (if composer-package + (upstream-source + (package (composer-package-name composer-package)) + (version (composer-package-version composer-package)) + (urls (list (composer-source-url + (composer-package-source composer-package))))) + (begin + (warning (G_ "failed to parse ~a~%") php-name) + #f)))) (define %composer-updater (upstream-updater From patchwork Sun Oct 6 23:56:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Graves X-Patchwork-Id: 68657 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 90A0B27BBE9; Mon, 7 Oct 2024 00:57:09 +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=-7.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS 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 380E527BBE2 for ; Mon, 7 Oct 2024 00:57:07 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sxb7S-0004Wi-KJ; Sun, 06 Oct 2024 19:56:58 -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 1sxb7Q-0004Vs-Cu for guix-patches@gnu.org; Sun, 06 Oct 2024 19:56:56 -0400 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 1sxb7Q-0000fm-5J for guix-patches@gnu.org; Sun, 06 Oct 2024 19:56:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=AG9XIGjm55DRINFLg5HtsQoKWF1PtE+l4oF3VDGYA5E=; b=gMWZmVvErlB1YCKYYeMsovwIAB5+BvlCJ2LPAtz1uKmfssEdc0NXyxR+2mbndzY3e3qkIYLHv/PuoOeCnWsjTvrlhEfrKFhNqodouqCJ2auS9bZ+4lK19eeeGbc52vEgSBdGogrny57SFef9tX2EvyUPOt0rWSrgnK7kETXvY659aqNrYt1vXFXcPweM58ug5q5gWWJEB9qHU41LjSMqlnrpJmF/tfRIhUatJWyP20IRrkIC49oQrt4jwfJVOb3tO5H0Rp5rTmNabh5iA9UNmzKAzi/Ya8bAgl2gPbwVrHQUde7X/b89MG9uEk9wGWfqu31D+DL4gWX4LW3l9SwTLA==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sxb7W-0001pH-Ch for guix-patches@gnu.org; Sun, 06 Oct 2024 19:57:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#70227] [PATCH v2 2/2] guix: import: composer: Implement recursive package refresh. Resent-From: Nicolas Graves Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 06 Oct 2024 23:57:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70227 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 70227@debbugs.gnu.org Cc: Nicolas Graves Received: via spool by 70227-submit@debbugs.gnu.org id=B70227.17282589856957 (code B ref 70227); Sun, 06 Oct 2024 23:57:02 +0000 Received: (at 70227) by debbugs.gnu.org; 6 Oct 2024 23:56:25 +0000 Received: from localhost ([127.0.0.1]:42920 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sxb6u-0001o9-FF for submit@debbugs.gnu.org; Sun, 06 Oct 2024 19:56:24 -0400 Received: from 8.mo575.mail-out.ovh.net ([46.105.74.219]:51145) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sxb6r-0001ns-PB for 70227@debbugs.gnu.org; Sun, 06 Oct 2024 19:56:23 -0400 Received: from director4.ghost.mail-out.ovh.net (unknown [10.108.9.32]) by mo575.mail-out.ovh.net (Postfix) with ESMTP id 4XMK1T4hBpz1jYY for <70227@debbugs.gnu.org>; Sun, 6 Oct 2024 23:56:13 +0000 (UTC) Received: from ghost-submission-55b549bf7b-8l4fw (unknown [10.110.101.105]) by director4.ghost.mail-out.ovh.net (Postfix) with ESMTPS id 35F8B1FD15; Sun, 6 Oct 2024 23:56:13 +0000 (UTC) Received: from ngraves.fr ([37.59.142.99]) by ghost-submission-55b549bf7b-8l4fw with ESMTPSA id F6m+AZ0jA2eepj0AKVvujg (envelope-from ); Sun, 06 Oct 2024 23:56:13 +0000 Authentication-Results: garm.ovh; auth=pass (GARM-99G0039c5ccc53-28ec-46b2-934f-50de139b1cd3, A12302D5D8CF0E033BA678025A323BF4FAD59D46) smtp.auth=ngraves@ngraves.fr X-OVh-ClientIp: 86.246.19.221 Date: Mon, 7 Oct 2024 01:56:00 +0200 Message-ID: <20241006235605.24248-2-ngraves@ngraves.fr> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20241006235605.24248-1-ngraves@ngraves.fr> References: <20241006235605.24248-1-ngraves@ngraves.fr> MIME-Version: 1.0 X-Ovh-Tracer-Id: 2566207366645277410 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeeftddrvddvkedgvdelucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucenucfjughrpefhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefpihgtohhlrghsucfirhgrvhgvshcuoehnghhrrghvvghssehnghhrrghvvghsrdhfrheqnecuggftrfgrthhtvghrnhepleffjeetueethfefkeffffefvddukeejkefgleduiedthfekvefhiedvhfffgeegnecukfhppeduvdejrddtrddtrddupdekiedrvdegiedrudelrddvvddupdefjedrheelrddugedvrdelleenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeduvdejrddtrddtrddupdhmrghilhhfrhhomhepnhhgrhgrvhgvshesnhhgrhgrvhgvshdrfhhrpdhnsggprhgtphhtthhopedupdhrtghpthhtohepjedtvddvjeesuggvsggsuhhgshdrghhnuhdrohhrghdpoffvtefjohhsthepmhhoheejhedpmhhouggvpehsmhhtphhouhht DKIM-Signature: a=rsa-sha256; bh=AG9XIGjm55DRINFLg5HtsQoKWF1PtE+l4oF3VDGYA5E=; c=relaxed/relaxed; d=ngraves.fr; h=From; s=ovhmo4487190-selector1; t=1728258973; v=1; b=h8ao/QhgNNttOovlut3Y03HvwGkVE6xBizLXbuiMOYpZIV4omStFnmMQdHPGAkMcxPpVs5r/ OUFjvIQdxBi9PsgNATKgRHsU2zkK5+VJZC1q7CFDexF4aDtoP8FfgubKYmngq17b04iUAttdfPp WYgcamcEgmcWKE8SZrxogYKmGXhY6VRON1tgqRTutm4JW6TakhcZizbrgVd29HaxE9Ef/fuzag8 SEXGqfBLUVQqA7o7MdV+SLCJCQhSADBS+20rY3cjahrUOO4nyQaC3CJ6dlbTdM7R6f2zhaexhoD i1c9yeRiH2i/JLRTWWdWUpvlrOLd27lpAaugqMQvo4EDw== 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: Nicolas Graves X-ACL-Warn: , Nicolas Graves via Guix-patches X-Patchwork-Original-From: Nicolas Graves via Guix-patches via From: Nicolas Graves 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/composer.scm (guix-package->composer-name): Simplify. (composer-fetch): Replace reduce by fold to correct version selection logic. (latest-release): Implement recursive package refresh. Rename to import-release. (import-release): New function, formerly known as latest-release. Change-Id: I8f629b4d1da866f5986d39b4e159f2b44af9ee49 --- guix/import/composer.scm | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/guix/import/composer.scm b/guix/import/composer.scm index 75419ca63e..abc9023be4 100644 --- a/guix/import/composer.scm +++ b/guix/import/composer.scm @@ -19,12 +19,14 @@ (define-module (guix import composer) #:use-module (ice-9 match) #:use-module (json) - #:use-module (guix hash) #:use-module (guix base32) #:use-module (guix build git) #:use-module (guix build utils) #:use-module (guix build-system) #:use-module (guix build-system composer) + #:use-module ((guix diagnostics) #:select (warning)) + #:use-module (guix hash) + #:use-module (guix i18n) #:use-module (guix import json) #:use-module (guix import utils) #:use-module ((guix licenses) #:prefix license:) @@ -113,7 +115,7 @@ (define* (composer-fetch name #:key (version #f)) (if version (assoc-ref packages version) (cdr - (reduce + (fold (lambda (new cur-max) (match new (((? valid-version? version) . tail) @@ -217,13 +219,8 @@ (define (guix-name->composer-name name) (define (guix-package->composer-name package) "Given a Composer PACKAGE built from Packagist, return the name of the package in Packagist." - (let ((upstream-name (assoc-ref - (package-properties package) - 'upstream-name)) - (name (package-name package))) - (if upstream-name - upstream-name - (guix-name->composer-name name)))) + (or (assoc-ref (package-properties package) 'upstream-name) + (guix-name->composer-name (package-name package)))) (define (string->license str) "Convert the string STR into a license object." @@ -243,8 +240,14 @@ (define (php-package? package) (eq? (package-build-system package) composer-build-system) (string-prefix? "php-" (package-name package)))) -(define* (latest-release package #:key (version #f)) - "Return an for the latest release of PACKAGE." +(define (dependency->input dependency type) + (upstream-input + (name dependency) + (downstream-name (php-package-name dependency)) + (type type))) + +(define* (import-release package #:key (version #f)) + "Return an for VERSION or the latest release of PACKAGE." (let* ((php-name (guix-package->composer-name package)) (composer-package (composer-fetch php-name #:version version))) (if composer-package @@ -252,7 +255,12 @@ (define* (latest-release package #:key (version #f)) (package (composer-package-name composer-package)) (version (composer-package-version composer-package)) (urls (list (composer-source-url - (composer-package-source composer-package))))) + (composer-package-source composer-package)))) + (inputs (append + (map (cut dependency->input <> 'regular) + (composer-package-require composer-package)) + (map (cut dependency->input <> 'native) + (composer-package-dev-require composer-package))))) (begin (warning (G_ "failed to parse ~a~%") php-name) #f)))) @@ -262,7 +270,7 @@ (define %composer-updater (name 'composer) (description "Updater for Composer packages") (pred php-package?) - (import latest-release))) + (import import-release))) (define* (composer-recursive-import package-name #:optional version) (recursive-import package-name