GNU bug report logs - #67906
[PATCH] guix: import: composer: Implement recursive package refresh.

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guix-patches; Reported by: Nicolas Graves <ngraves@HIDDEN>; Keywords: patch; dated Tue, 19 Dec 2023 16:55:02 UTC; Maintainer for guix-patches is guix-patches@HIDDEN.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 19 Dec 2023 16:54:16 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Dec 19 11:54:16 2023
Received: from localhost ([127.0.0.1]:37217 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rFdMF-0004Iz-Iw
	for submit <at> debbugs.gnu.org; Tue, 19 Dec 2023 11:54:15 -0500
Received: from lists.gnu.org ([2001:470:142::17]:50406)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ngraves@HIDDEN>) id 1rFdMD-0004Ik-RQ
 for submit <at> debbugs.gnu.org; Tue, 19 Dec 2023 11:54:14 -0500
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 <ngraves@HIDDEN>)
 id 1rFdM5-0006Lg-Oh
 for guix-patches@HIDDEN; Tue, 19 Dec 2023 11:54:05 -0500
Received: from 4.mo560.mail-out.ovh.net ([87.98.172.75])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <ngraves@HIDDEN>)
 id 1rFdLr-0003dC-Sc
 for guix-patches@HIDDEN; Tue, 19 Dec 2023 11:54:05 -0500
Received: from director9.ghost.mail-out.ovh.net (unknown [10.109.148.20])
 by mo560.mail-out.ovh.net (Postfix) with ESMTP id B6BAC2C035
 for <guix-patches@HIDDEN>; Tue, 19 Dec 2023 16:53:47 +0000 (UTC)
Received: from ghost-submission-6684bf9d7b-mhcvk (unknown [10.108.9.175])
 by director9.ghost.mail-out.ovh.net (Postfix) with ESMTPS id 6841F1FDB1;
 Tue, 19 Dec 2023 16:53:46 +0000 (UTC)
Received: from ngraves.fr ([37.59.142.109])
 by ghost-submission-6684bf9d7b-mhcvk with ESMTPSA
 id TpgBFZrKgWVOuAgAWtQG5g
 (envelope-from <ngraves@HIDDEN>); Tue, 19 Dec 2023 16:53:46 +0000
Authentication-Results: garm.ovh; auth=pass
 (GARM-109S003e9008a7d-54ef-4d88-94f2-8b56df405b94,
 0A183DEDD9F7D7733B4F13041BD52F66DC821FED) smtp.auth=ngraves@HIDDEN
X-OVh-ClientIp: 81.67.140.142
From: Nicolas Graves <ngraves@HIDDEN>
To: guix-patches@HIDDEN
Subject: [PATCH] guix: import: composer: Implement recursive package refresh.
Date: Tue, 19 Dec 2023 17:53:28 +0100
Message-ID: <20231219165328.11135-1-ngraves@HIDDEN>
X-Mailer: git-send-email 2.41.0
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Ovh-Tracer-Id: 14599262617711534813
X-VR-SPAMSTATE: OK
X-VR-SPAMSCORE: 0
X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvkedrvddutddgleegucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucenucfjughrpefhvfevufffkffoggfgsedtkeertdertddtnecuhfhrohhmpefpihgtohhlrghsucfirhgrvhgvshcuoehnghhrrghvvghssehnghhrrghvvghsrdhfrheqnecuggftrfgrthhtvghrnhepkeffgeetfffgffejgeejvdffgfdtvdeuueetgfefuedvjeegvdegjeejveeuueevnecukfhppeduvdejrddtrddtrddupdekuddrieejrddugedtrddugedvpdefjedrheelrddugedvrddutdelnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepuddvjedrtddrtddruddpmhgrihhlfhhrohhmpeeonhhgrhgrvhgvshesnhhgrhgrvhgvshdrfhhrqedpnhgspghrtghpthhtohepuddprhgtphhtthhopehguhhigidqphgrthgthhgvshesghhnuhdrohhrghdpoffvtefjohhsthepmhhoheeitddpmhhouggvpehsmhhtphhouhht
Received-SPF: pass client-ip=87.98.172.75; envelope-from=ngraves@HIDDEN;
 helo=4.mo560.mail-out.ovh.net
X-Spam_score_int: -18
X-Spam_score: -1.9
X-Spam_bar: -
X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001,
 T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: submit
Cc: ludo@HIDDEN, ngraves@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

* guix/import/composer.scm
 (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.
---
 guix/import/composer.scm | 34 +++++++++++++++++++++++++---------
 1 file changed, 25 insertions(+), 9 deletions(-)

diff --git a/guix/import/composer.scm b/guix/import/composer.scm
index b23af1b91f..26229e3ad0 100644
--- a/guix/import/composer.scm
+++ b/guix/import/composer.scm
@@ -113,7 +113,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)
@@ -243,8 +243,8 @@ (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 <upstream-source> for the latest release of PACKAGE."
+(define* (import-release package #:key (version #f))
+  "Return an <upstream-source> for the VERSION or latest release of PACKAGE."
   (let* ((php-name (guix-package->composer-name package))
          (composer-package (composer-fetch php-name #:version version)))
     (match composer-package
@@ -254,18 +254,34 @@ (define* (latest-release package #:key (version #f))
                php-name)
        #f)
       (_
-       (upstream-source
-        (package (composer-package-name composer-package))
-        (version (composer-package-version composer-package))
-        (urls (list (composer-source-url
-                     (composer-package-source composer-package)))))))))
+       (let* ((guix-name (composer-package-name composer-package))
+              (inputs
+               (append
+                (map (lambda (dep)
+                       (upstream-input
+                        (name php-name)
+                        (downstream-name guix-name)
+                        (type 'regular)))
+                     (composer-package-require composer-package))
+                (map (lambda (dep)
+                       (upstream-input
+                        (name php-name)
+                        (downstream-name guix-name)
+                        (type 'native)))
+                     (composer-package-dev-require composer-package)))))
+         (upstream-source
+          (package guix-name)
+          (version (composer-package-version composer-package))
+          (urls (list (composer-source-url
+                       (composer-package-source composer-package))))
+          (inputs inputs)))))))
 
 (define %composer-updater
   (upstream-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
-- 
2.41.0





Acknowledgement sent to Nicolas Graves <ngraves@HIDDEN>:
New bug report received and forwarded. Copy sent to guix-patches@HIDDEN. Full text available.
Report forwarded to guix-patches@HIDDEN:
bug#67906; Package guix-patches. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sat, 20 Jan 2024 12:30:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.