GNU logs - #73833, boring messages


Message sent to guix-patches@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: [bug#73833] [PATCH] guix: import: composer: Improve composer-fetch.
Resent-From: Nicolas Graves <ngraves@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: guix-patches@HIDDEN
Resent-Date: Wed, 16 Oct 2024 05:31:02 +0000
Resent-Message-ID: <handler.73833.B.172905664115165 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: report 73833
X-GNU-PR-Package: guix-patches
X-GNU-PR-Keywords: patch
To: 73833 <at> debbugs.gnu.org
Cc: Nicolas Graves <ngraves@HIDDEN>
X-Debbugs-Original-To: guix-patches@HIDDEN
Received: via spool by submit <at> debbugs.gnu.org id=B.172905664115165
          (code B ref -1); Wed, 16 Oct 2024 05:31:02 +0000
Received: (at submit) by debbugs.gnu.org; 16 Oct 2024 05:30:41 +0000
Received: from localhost ([127.0.0.1]:58215 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1t0wcK-0003wX-QH
	for submit <at> debbugs.gnu.org; Wed, 16 Oct 2024 01:30:41 -0400
Received: from lists.gnu.org ([209.51.188.17]:54778)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ngraves@HIDDEN>) id 1t0wcH-0003wJ-Un
 for submit <at> debbugs.gnu.org; Wed, 16 Oct 2024 01:30:39 -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 <ngraves@HIDDEN>)
 id 1t0wbu-0007c7-9f
 for guix-patches@HIDDEN; Wed, 16 Oct 2024 01:30:15 -0400
Received: from 5.mo560.mail-out.ovh.net ([87.98.181.248])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <ngraves@HIDDEN>)
 id 1t0wbp-0001Oq-J4
 for guix-patches@HIDDEN; Wed, 16 Oct 2024 01:30:13 -0400
Received: from director1.ghost.mail-out.ovh.net (unknown [10.108.25.23])
 by mo560.mail-out.ovh.net (Postfix) with ESMTP id 4XT00Q2mjSz1TRr
 for <guix-patches@HIDDEN>; Wed, 16 Oct 2024 05:29:58 +0000 (UTC)
Received: from ghost-submission-55b549bf7b-xsbvw (unknown [10.111.174.60])
 by director1.ghost.mail-out.ovh.net (Postfix) with ESMTPS id 6DF841FE03;
 Wed, 16 Oct 2024 05:29:56 +0000 (UTC)
Received: from ngraves.fr ([37.59.142.98])
 by ghost-submission-55b549bf7b-xsbvw with ESMTPSA
 id twRHLVRPD2f2KgAAbjPiVg
 (envelope-from <ngraves@HIDDEN>); Wed, 16 Oct 2024 05:29:56 +0000
Authentication-Results: garm.ovh; auth=pass
 (GARM-98R00243ad54e2-0162-48ab-9e3c-2de306efc9d5,
 BC581D0AC8476CF08C37484D3F5A4D28D157660B) smtp.auth=ngraves@HIDDEN
X-OVh-ClientIp: 89.207.171.135
From: Nicolas Graves <ngraves@HIDDEN>
Date: Wed, 16 Oct 2024 07:29:49 +0200
Message-ID: <20241016052953.16069-1-ngraves@HIDDEN>
X-Mailer: git-send-email 2.46.0
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Ovh-Tracer-Id: 5716756779975631586
X-VR-SPAMSTATE: OK
X-VR-SPAMSCORE: 0
X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeeftddrvdegkedgleejucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucenucfjughrpefhvfevufffkffoggfgsedtkeertdertddtnecuhfhrohhmpefpihgtohhlrghsucfirhgrvhgvshcuoehnghhrrghvvghssehnghhrrghvvghsrdhfrheqnecuggftrfgrthhtvghrnhepkeffgeetfffgffejgeejvdffgfdtvdeuueetgfefuedvjeegvdegjeejveeuueevnecukfhppeduvdejrddtrddtrddupdekledrvddtjedrudejuddrudefhedpfeejrdehledrudegvddrleeknecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepuddvjedrtddrtddruddpmhgrihhlfhhrohhmpehnghhrrghvvghssehnghhrrghvvghsrdhfrhdpnhgspghrtghpthhtohepuddprhgtphhtthhopehguhhigidqphgrthgthhgvshesghhnuhdrohhrghdpoffvtefjohhsthepmhhoheeitddpmhhouggvpehsmhhtphhouhht
DKIM-Signature: a=rsa-sha256; bh=dNCYeQ0XhyQ4PycbZWmYec5TmChI3NfXPBQ1fYdbaKs=; 
 c=relaxed/relaxed; d=ngraves.fr; h=From;
 s=ovhmo4487190-selector1; t=1729056598; v=1;
 b=tBDymzZtlLN+1c9yewPmXihfpGDgtA+HFnlRIuVbK/dleQF4dEbbpdFc15LgUFOGHh1pRTfu
 ftD1k1TKJuY4ZFTH+tlJ2BgFsGPo4E2TeASjTp9zSdKei/7riGiduLGm7PbFhu60J60ASukyJQj
 hVnxDCdx47A88Qj3eEuniQb4p38i6A/eKmnu/oMXKmux5bHq9JTAgzw8SPgrFA5ayQse6Wwd1Z9
 2m0X0UsQHfEC/6HN7eHBg57z4dYXUuxKvdVJZzPTQI6hvkWPROvrlci3KFc+4Pju/OP9ZDtS7k4
 r6HkiZG0QplNHEsmPTqdCB0MCMZYH+15haBorPkOP1kWw==
Received-SPF: pass client-ip=87.98.181.248; envelope-from=ngraves@HIDDEN;
 helo=5.mo560.mail-out.ovh.net
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001,
 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001,
 SPF_HELO_NONE=0.001, SPF_PASS=-0.001,
 T_FILL_THIS_FORM_SHORT=0.01 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
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: -2.3 (--)

* guix/import/composer.scm (composer-fetch): Handle a case where
packages are #f. This improves composer-fetch behavior, which was
sometimes buggy.
---
 guix/import/composer.scm | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/guix/import/composer.scm b/guix/import/composer.scm
index abc9023be4..febde97791 100644
--- a/guix/import/composer.scm
+++ b/guix/import/composer.scm
@@ -111,7 +111,7 @@ (define* (composer-fetch name #:key (version #f))
                             (let ((pkgs (assoc-ref pkg "packages")))
                               (or (assoc-ref pkgs name) pkg))))))
     (if packages
-        (json->composer-package
+        (and=>
          (if version
              (assoc-ref packages version)
              (cdr
@@ -125,7 +125,8 @@ (define* (composer-fetch name #:key (version #f))
                         cur-max))
                    (_ cur-max)))
                (cons* "0.0.0" #f)
-               packages))))
+               packages)))
+         json->composer-package)
         #f)))
 
 (define (php-package-name name)
-- 
2.46.0





Message sent:


Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-Mailer: MIME-tools 5.505 (Entity 5.505)
Content-Type: text/plain; charset=utf-8
X-Loop: help-debbugs@HIDDEN
From: help-debbugs@HIDDEN (GNU bug Tracking System)
To: Nicolas Graves <ngraves@HIDDEN>
Subject: bug#73833: Acknowledgement ([PATCH] guix: import: composer:
 Improve composer-fetch.)
Message-ID: <handler.73833.B.172905664115165.ack <at> debbugs.gnu.org>
References: <20241016052953.16069-1-ngraves@HIDDEN>
X-Gnu-PR-Message: ack 73833
X-Gnu-PR-Package: guix-patches
X-Gnu-PR-Keywords: patch
Reply-To: 73833 <at> debbugs.gnu.org
Date: Wed, 16 Oct 2024 05:31:03 +0000

Thank you for filing a new bug report with debbugs.gnu.org.

This is an automatically generated reply to let you know your message
has been received.

Your message is being forwarded to the package maintainers and other
interested parties for their attention; they will reply in due course.

Your message has been sent to the package maintainer(s):
 guix-patches@HIDDEN

If you wish to submit further information on this problem, please
send it to 73833 <at> debbugs.gnu.org.

Please do not send mail to help-debbugs@HIDDEN unless you wish
to report a problem with the Bug-tracking system.

--=20
73833: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D73833
GNU Bug Tracking System
Contact help-debbugs@HIDDEN with problems


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


Received: (at control) by debbugs.gnu.org; 17 Oct 2024 11:21:54 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Oct 17 07:21:53 2024
Received: from localhost ([127.0.0.1]:33567 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1t1OZh-0002ER-SU
	for submit <at> debbugs.gnu.org; Thu, 17 Oct 2024 07:21:53 -0400
Received: from 10.mo581.mail-out.ovh.net ([178.33.250.56]:33081)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ngraves@HIDDEN>) id 1t1OZb-0002E9-Tj
 for control <at> debbugs.gnu.org; Thu, 17 Oct 2024 07:21:48 -0400
Received: from director2.ghost.mail-out.ovh.net (unknown [10.109.140.207])
 by mo581.mail-out.ovh.net (Postfix) with ESMTP id 4XTllN6YTjz1Fgn
 for <control <at> debbugs.gnu.org>; Thu, 17 Oct 2024 11:21:20 +0000 (UTC)
Received: from ghost-submission-55b549bf7b-zbgtw (unknown [10.108.54.171])
 by director2.ghost.mail-out.ovh.net (Postfix) with ESMTPS id 5F4361FDAB
 for <control <at> debbugs.gnu.org>; Thu, 17 Oct 2024 11:21:20 +0000 (UTC)
Received: from ngraves.fr ([37.59.142.104])
 by ghost-submission-55b549bf7b-zbgtw with ESMTPSA
 id qgdpATDzEGeaCgAARFFF2A (envelope-from <ngraves@HIDDEN>)
 for <control <at> debbugs.gnu.org>; Thu, 17 Oct 2024 11:21:20 +0000
Authentication-Results: garm.ovh; auth=pass
 (GARM-104R005754b1331-7d36-4a0d-9fff-2f0ae5821cea,
 73C839D51F9C708623F95E2DCAB32052372F5FAF) smtp.auth=ngraves@HIDDEN
X-OVh-ClientIp: 90.110.172.34
From: Nicolas Graves <ngraves@HIDDEN>
To: control <at> debbugs.gnu.org
Subject: tag 73833 moreinfo
Date: Thu, 17 Oct 2024 13:21:19 +0200
Message-ID: <87a5f3561c.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Ovh-Tracer-Id: 17523506151380804197
X-VR-SPAMSTATE: OK
X-VR-SPAMSCORE: 0
X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeeftddrvdehuddggedtucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucenucfjughrpefhvffufffkgggtsehttdertddttddtnecuhfhrohhmpefpihgtohhlrghsucfirhgrvhgvshcuoehnghhrrghvvghssehnghhrrghvvghsrdhfrheqnecuggftrfgrthhtvghrnhepueejleeileejfffhleetjedtleejheevudffleevgfdufeekhefgvddvveegveefnecukfhppeduvdejrddtrddtrddupdeltddruddutddrudejvddrfeegpdefjedrheelrddugedvrddutdegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepuddvjedrtddrtddruddpmhgrihhlfhhrohhmpehnghhrrghvvghssehnghhrrghvvghsrdhfrhdpnhgspghrtghpthhtohepuddprhgtphhtthhopegtohhnthhrohhlseguvggssghughhsrdhgnhhurdhorhhgpdfovfetjfhoshhtpehmohehkedupdhmohguvgepshhmthhpohhuth
DKIM-Signature: a=rsa-sha256; bh=MVf++3xucJOFhggMyizsNCwERAJa9JoSPKBpGaPrpqY=; 
 c=relaxed/relaxed; d=ngraves.fr; h=From;
 s=ovhmo4487190-selector1; t=1729164081; v=1;
 b=FOmGyASomUvXPHbsAi0VGgeCGSPAtoggw8mlXOe6G+K5qtZzpZwmWSv895SXmqYf3G9r9nHI
 FbCuASmM3/9twu+u8/3wuwgcurN+Ea69+syEZdqx+pvc/1CBWOeG1Txd5GM2Kd/ujLnKQ1KZSDa
 a5x0oiSCTYDvrfxwJNxaCO4/jIoISgPWVTYGpaOpSivg3R+FoJTG0IDUUOGx3L4m3C+MnPVOKuD
 t6lZTvQ7YZ3N0s+U7FIQFJa6em+8EgcdyWocCZzkF1uDU0znCQ4nX54+F9oQJIIZU7TUSl5As69
 e4+hMYSxevi38FrYkNbgPHXaPzfB5FgtvsuOEk9Qo2Cyw==
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: control
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: -1.0 (-)

tags 73833 + moreinfo
quit

I've got more commits to add to this issue now.

-- 
Best regards,
Nicolas Graves




Message sent to guix-patches@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: [bug#73833] [PATCH v2 0/5] Large improvements to import utils, composer import, and refresh.
References: <20241016052953.16069-1-ngraves@HIDDEN>
In-Reply-To: <20241016052953.16069-1-ngraves@HIDDEN>
Resent-From: Nicolas Graves <ngraves@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: guix-patches@HIDDEN
Resent-Date: Thu, 17 Oct 2024 22:34:02 +0000
Resent-Message-ID: <handler.73833.B73833.172920442832180 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 73833
X-GNU-PR-Package: guix-patches
X-GNU-PR-Keywords: moreinfo patch
To: 73833 <at> debbugs.gnu.org
Cc: Nicolas Graves <ngraves@HIDDEN>
Received: via spool by 73833-submit <at> debbugs.gnu.org id=B73833.172920442832180
          (code B ref 73833); Thu, 17 Oct 2024 22:34:02 +0000
Received: (at 73833) by debbugs.gnu.org; 17 Oct 2024 22:33:48 +0000
Received: from localhost ([127.0.0.1]:35914 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1t1Z3w-0008MU-E0
	for submit <at> debbugs.gnu.org; Thu, 17 Oct 2024 18:33:48 -0400
Received: from 18.mo550.mail-out.ovh.net ([46.105.35.72]:49721)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ngraves@HIDDEN>) id 1t1Z3p-0008Lv-Au
 for 73833 <at> debbugs.gnu.org; Thu, 17 Oct 2024 18:33:42 -0400
Received: from director1.ghost.mail-out.ovh.net (unknown [10.108.17.1])
 by mo550.mail-out.ovh.net (Postfix) with ESMTP id 4XV2ff0dZVz1VYY
 for <73833 <at> debbugs.gnu.org>; Thu, 17 Oct 2024 22:33:13 +0000 (UTC)
Received: from ghost-submission-5b5ff79f4f-txhhv (unknown [10.108.54.179])
 by director1.ghost.mail-out.ovh.net (Postfix) with ESMTPS id 3FE641FD22;
 Thu, 17 Oct 2024 22:33:12 +0000 (UTC)
Received: from ngraves.fr ([37.59.142.108])
 by ghost-submission-5b5ff79f4f-txhhv with ESMTPSA
 id Hi7/IaiQEWdiCwAAow/L8w
 (envelope-from <ngraves@HIDDEN>); Thu, 17 Oct 2024 22:33:12 +0000
Authentication-Results: garm.ovh; auth=pass
 (GARM-108S002826ce76f-b050-4165-a1ad-afc1304da0b4,
 AF64BF28DCF8B52CDC45B9ABB40222CA4ECB7BAD) smtp.auth=ngraves@HIDDEN
X-OVh-ClientIp: 90.110.172.34
From: Nicolas Graves <ngraves@HIDDEN>
Date: Fri, 18 Oct 2024 00:25:56 +0200
Message-ID: <20241017223308.27941-1-ngraves@HIDDEN>
X-Mailer: git-send-email 2.46.0
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Ovh-Tracer-Id: 10423862813214565090
X-VR-SPAMSTATE: OK
X-VR-SPAMSCORE: 0
X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeeftddrvdehvddguddvucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucenucfjughrpefhvfevufffkffoggfgsedtkeertdertddtnecuhfhrohhmpefpihgtohhlrghsucfirhgrvhgvshcuoehnghhrrghvvghssehnghhrrghvvghsrdhfrheqnecuggftrfgrthhtvghrnhepkeffgeetfffgffejgeejvdffgfdtvdeuueetgfefuedvjeegvdegjeejveeuueevnecukfhppeduvdejrddtrddtrddupdeltddruddutddrudejvddrfeegpdefjedrheelrddugedvrddutdeknecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepuddvjedrtddrtddruddpmhgrihhlfhhrohhmpehnghhrrghvvghssehnghhrrghvvghsrdhfrhdpnhgspghrtghpthhtohepuddprhgtphhtthhopeejfeekfeefseguvggssghughhsrdhgnhhurdhorhhgpdfovfetjfhoshhtpehmohehhedtpdhmohguvgepshhmthhpohhuth
DKIM-Signature: a=rsa-sha256; bh=neL+jNaSt2kYr89seTHhyEtiE/eIY8fW/GVpZzkGOJM=; 
 c=relaxed/relaxed; d=ngraves.fr; h=From;
 s=ovhmo4487190-selector1; t=1729204394; v=1;
 b=p57Bo16HNqqaiKV+EozHlsEvxKiXE2k4e0SIjVxT9JcJJZ2fIL8Rh7i7jp12JVCae9XuC+s9
 lbRU3alTBGchovMchU1kE0lNVbupJyU0TC73QHUgoX8xM8L8ufkzqgYx0W7FbKuQtP+lZXzAxXY
 xiQWDegkp/oiNX1HSuynHxiK0uloqnV/+njC69AO5QumQlEn+HOTo4w26Jp4/1HFpjiThomndSi
 xs+PlE/Bnnj29VB4tVHGGoS7YklpNovTHygvVxr5jdLK9aKjtb1pfdDySF6ItxpVVEMMwCmtD2I
 B9mrHUxsIO3CFpU8LsvFUGTE7tG4p+2A+CNwZlnKCH8bg==
X-Spam-Score: 0.0 (/)
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: -1.0 (-)

This patch series merges a lot of different worthwhile contributions
to the import system in Guix. Patches 1 and 2 are extracted from the
work I did on the Juliahub importer to homogeneize and factor out a
git->origin function. Patch 3 has a lot of various but transparent and
explained improvements to the composer import, which should be renamed
to "packagist" instead of "composer" by the way. Patch 4 is a fix to a
shortcoming in refresh. Patch 5 shows a way to use upstream-inputs to
update packages using requirement constraints from packagist.

Nicolas Graves (5):
  guix: import: utils: Add function git->origin.
  tests: go: Add mock-git->origin function.
  guix: import: composer: Improve importer.
  guix: refresh: Keep the version field of each update specification.
  guix: refresh: Implement basic upstream-source-inputs rich updates.

 guix/import/composer.scm | 236 ++++++++++++++++++++++-----------------
 guix/import/elpa.scm     |  44 +++-----
 guix/import/go.scm       |  57 +++-------
 guix/import/minetest.scm |  28 +----
 guix/import/utils.scm    |  39 +++++++
 guix/scripts/refresh.scm |  59 ++++++++--
 tests/composer.scm       |   2 +-
 tests/go.scm             |  30 +++--
 tests/minetest.scm       |  15 +--
 9 files changed, 280 insertions(+), 230 deletions(-)

-- 
2.46.0





Message sent to guix-patches@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: [bug#73833] [PATCH v2 1/5] guix: import: utils: Add function git->origin.
Resent-From: Nicolas Graves <ngraves@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: guix-patches@HIDDEN
Resent-Date: Thu, 17 Oct 2024 22:34:02 +0000
Resent-Message-ID: <handler.73833.B73833.172920443332191 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 73833
X-GNU-PR-Package: guix-patches
X-GNU-PR-Keywords: moreinfo patch
To: 73833 <at> debbugs.gnu.org
Cc: Nicolas Graves <ngraves@HIDDEN>
Received: via spool by 73833-submit <at> debbugs.gnu.org id=B73833.172920443332191
          (code B ref 73833); Thu, 17 Oct 2024 22:34:02 +0000
Received: (at 73833) by debbugs.gnu.org; 17 Oct 2024 22:33:53 +0000
Received: from localhost ([127.0.0.1]:35916 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1t1Z40-0008Mz-JS
	for submit <at> debbugs.gnu.org; Thu, 17 Oct 2024 18:33:53 -0400
Received: from 6.mo575.mail-out.ovh.net ([46.105.63.100]:46655)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ngraves@HIDDEN>) id 1t1Z3q-0008Lx-Me
 for 73833 <at> debbugs.gnu.org; Thu, 17 Oct 2024 18:33:43 -0400
Received: from director11.ghost.mail-out.ovh.net (unknown [10.108.2.160])
 by mo575.mail-out.ovh.net (Postfix) with ESMTP id 4XV2fg53g0z1mJy
 for <73833 <at> debbugs.gnu.org>; Thu, 17 Oct 2024 22:33:15 +0000 (UTC)
Received: from ghost-submission-5b5ff79f4f-5xtkv (unknown [10.111.182.85])
 by director11.ghost.mail-out.ovh.net (Postfix) with ESMTPS id 4D4911FEB9;
 Thu, 17 Oct 2024 22:33:14 +0000 (UTC)
Received: from ngraves.fr ([37.59.142.96])
 by ghost-submission-5b5ff79f4f-5xtkv with ESMTPSA
 id EJ44JaqQEWe8HgAA5ciNLQ
 (envelope-from <ngraves@HIDDEN>); Thu, 17 Oct 2024 22:33:14 +0000
Authentication-Results: garm.ovh; auth=pass
 (GARM-96R0014cd7b8b3-0c16-4686-ad31-39f720c9984d,
 AF64BF28DCF8B52CDC45B9ABB40222CA4ECB7BAD) smtp.auth=ngraves@HIDDEN
X-OVh-ClientIp: 90.110.172.34
From: Nicolas Graves <ngraves@HIDDEN>
Date: Fri, 18 Oct 2024 00:25:57 +0200
Message-ID: <20241017223308.27941-2-ngraves@HIDDEN>
X-Mailer: git-send-email 2.46.0
In-Reply-To: <20241017223308.27941-1-ngraves@HIDDEN>
References: <20241017223308.27941-1-ngraves@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Ovh-Tracer-Id: 10424425762833490658
X-VR-SPAMSTATE: OK
X-VR-SPAMSCORE: 0
X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeeftddrvdehvddguddvucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucenucfjughrpefhvfevufffkffojghfgggtgfesthekredtredtjeenucfhrhhomheppfhitgholhgrshcuifhrrghvvghsuceonhhgrhgrvhgvshesnhhgrhgrvhgvshdrfhhrqeenucggtffrrghtthgvrhhnpeegffejudehfedvgedtveetudejtdetleetffektefghfffjeegudelgfetgffhgeenucffohhmrghinhepghhithhlrggsrdgtohhmpdhsphgugidrohhrghdpghhithhhuhgsrdgtohhmnecukfhppeduvdejrddtrddtrddupdeltddruddutddrudejvddrfeegpdefjedrheelrddugedvrdelieenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeduvdejrddtrddtrddupdhmrghilhhfrhhomhepnhhgrhgrvhgvshesnhhgrhgrvhgvshdrfhhrpdhnsggprhgtphhtthhopedupdhrtghpthhtohepjeefkeeffeesuggvsggsuhhgshdrghhnuhdrohhrghdpoffvtefjohhsthepmhhoheejhedpmhhouggvpehsmhhtphhouhht
DKIM-Signature: a=rsa-sha256; bh=N0BYu8BjKduYRLmQh+SA43GSZyyO93zI+BKLZ/5xg+Q=; 
 c=relaxed/relaxed; d=ngraves.fr; h=From;
 s=ovhmo4487190-selector1; t=1729204395; v=1;
 b=aJpeYyRLCxa/Wmzd8XRUwy6l+gG6aiucdMMdNobx1qIJJNRIjIMA5tt9UDeUvOe4nXbLrxq8
 H1tbgOP4zCCob/t32Eo+vT+f9Bpcswco3+ln+gJCpkaDSgd5dlSSszG9fldnDqrlIfggQC3qGZw
 YA+Z86m7dNkEWKpJDUa1b/yh5sUsiPlaemkwO9kHt57Tokxg7awQtoW6KjLlKx/cSespgseSV+V
 VNTAI3odatfF0x6HEhKxui+kKmaYNdhgsOu8IuMVajvTvLYYG0YV41p6XlE4oglTuhfUktJo5R4
 RlLjPasNtKS5Jh4es4llMJSvrkAn1mbeXaSnEv0KinrZQ==
X-Spam-Score: 0.0 (/)
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: -1.0 (-)

* guix/import/utils.scm: (git->origin): Add function.

* guix/import/elpa.scm
(download-git-repository): Remove function download-git-repository.
(git-repository->origin): Remove function git-repository->origin.
(ref): Add function ref.
(melpa-recipe->origin): Use functions git->origin and ref.

* guix/import/go.scm
(git-checkout-hash): Remove function git-checkout-hash.
(transform-version): Add function transform-version.
(vcs->origin): Use functions git->origin and transform-version. Add
optional argument transform-version.

* tests/import/go.scm
(go-module->guix-package): Adapt test case to changes in guix/import/go.scm.

* guix/import/minetest.scm
(download-git-repository): Remove function download-git-repository.
(make-minetest-sexp): Use function git->origin.

* tests/minetest.scm
(make-package-sexp): Use function git->origin.
(example-package): Adapt test-case to git->origin.

* guix/import/composer.scm
(make-php-sexp): Use function git->origin.

Change-Id: Ied05a63bdd60fbafe26fbbb4e115ff6f0bb9db3c
---
 guix/import/composer.scm | 85 ++++++++++++++--------------------------
 guix/import/elpa.scm     | 44 ++++++---------------
 guix/import/go.scm       | 57 ++++++++-------------------
 guix/import/minetest.scm | 28 ++-----------
 guix/import/utils.scm    | 39 ++++++++++++++++++
 tests/go.scm             | 29 ++++++++++----
 tests/minetest.scm       | 15 ++-----
 7 files changed, 127 insertions(+), 170 deletions(-)

diff --git a/guix/import/composer.scm b/guix/import/composer.scm
index abc9023be4..a6a482021f 100644
--- a/guix/import/composer.scm
+++ b/guix/import/composer.scm
@@ -19,12 +19,9 @@
 (define-module (guix import composer)
   #:use-module (ice-9 match)
   #:use-module (json)
-  #: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 download) #:select (download-to-store))
   #:use-module (guix hash)
   #:use-module (guix i18n)
   #:use-module (guix import json)
@@ -32,11 +29,10 @@ (define-module (guix import composer)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix memoization)
   #:use-module (guix packages)
-  #:use-module (guix serialization)
+  #:use-module (guix store)
   #:use-module (guix upstream)
   #:use-module (guix utils)
   #:use-module (srfi srfi-1)
-  #:use-module (srfi srfi-11)
   #:use-module (srfi srfi-26)
   #:export (composer->guix-package
             %composer-updater
@@ -143,55 +139,34 @@ (define (make-php-sexp composer-package)
          (dependencies (map php-package-name
                             (composer-package-require composer-package)))
          (dev-dependencies (map php-package-name
-                                (composer-package-dev-require composer-package)))
-         (git? (equal? (composer-source-type source) "git")))
-    ((if git? call-with-temporary-directory call-with-temporary-output-file)
-     (lambda* (temp #:optional port)
-       (and (if git?
-               (begin
-                 (mkdir-p temp)
-                 (git-fetch (composer-source-url source)
-                            (composer-source-reference source)
-                            temp))
-               (url-fetch (composer-source-url source) temp))
-            `(package
-               (name ,(composer-package-name composer-package))
-               (version ,(composer-package-version composer-package))
-               (source
-                (origin
-                  ,@(if git?
-                        `((method git-fetch)
-                          (uri (git-reference
-                                (url ,(if (string-suffix?
-                                           ".git"
-                                           (composer-source-url source))
-                                          (string-drop-right
-                                           (composer-source-url source)
-                                           (string-length ".git"))
-                                          (composer-source-url source)))
-                                (commit ,(composer-source-reference source))))
-                          (file-name (git-file-name name version))
-                          (sha256
-                           (base32
-                            ,(bytevector->nix-base32-string
-                              (file-hash* temp)))))
-                        `((method url-fetch)
-                          (uri ,(composer-source-url source))
-                          (sha256 (base32 ,(guix-hash-url temp)))))))
-               (build-system composer-build-system)
-               ,@(if (null? dependencies)
-                     '()
-                     `((inputs
-                        (list ,@(map string->symbol dependencies)))))
-               ,@(if (null? dev-dependencies)
-                     '()
-                     `((native-inputs
-                        (list ,@(map string->symbol dev-dependencies)))))
-               (synopsis "")
-               (description ,(composer-package-description composer-package))
-               (home-page ,(composer-package-homepage composer-package))
-               (license ,(or (composer-package-license composer-package)
-                             'unknown-license!))))))))
+                                (composer-package-dev-require composer-package))))
+    `(package
+       (name ,(composer-package-name composer-package))
+       (version ,(composer-package-version composer-package))
+       (source
+        ,(if (string= (composer-source-type source) "git")
+             (git->origin (composer-source-url source)
+                          `(tag-or-commit . ,(composer-source-reference source)))
+             (let* ((source (composer-source-url source))
+                    (tarball (with-store store (download-to-store store source))))
+               `(origin
+                  (method url-fetch)
+                  (uri ,source)
+                  (sha256 (base32 ,(guix-hash-url tarball)))))))
+       (build-system composer-build-system)
+       ,@(if (null? dependencies)
+             '()
+             `((inputs
+                (list ,@(map string->symbol dependencies)))))
+       ,@(if (null? dev-dependencies)
+             '()
+             `((native-inputs
+                (list ,@(map string->symbol dev-dependencies)))))
+       (synopsis "")
+       (description ,(composer-package-description composer-package))
+       (home-page ,(composer-package-homepage composer-package))
+       (license ,(or (composer-package-license composer-package)
+                     'unknown-license!)))))
 
 (define composer->guix-package
   (memoize
diff --git a/guix/import/elpa.scm b/guix/import/elpa.scm
index 46b6dc98a2..a755387242 100644
--- a/guix/import/elpa.scm
+++ b/guix/import/elpa.scm
@@ -8,6 +8,7 @@
 ;;; Copyright © 2021 Sarah Morgensen <iskarian@HIDDEN>
 ;;; Copyright © 2021 Simon Tournier <zimon.toutoune@HIDDEN>
 ;;; Copyright © 2022 Hartmut Goebel <h.goebel@HIDDEN>
+;;; Copyright © 2023 Nicolas Graves <ngraves@HIDDEN>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -208,11 +209,6 @@ (define* (fetch-elpa-package name #:optional (repo 'gnu))
                             url)))
       (_ #f))))
 
-(define* (download-git-repository url ref)
-  "Fetch the given REF from the Git repository at URL."
-  (with-store store
-    (latest-repository-commit store url #:ref ref)))
-
 (define (package-name->melpa-recipe package-name)
   "Fetch the MELPA recipe for PACKAGE-NAME, represented as an alist from
 keywords to values."
@@ -232,29 +228,15 @@ (define (data->recipe data)
     (close-port port)
     (data->recipe (cons ':name data))))
 
-(define (git-repository->origin recipe url)
-  "Fetch origin details from the Git repository at URL for the provided MELPA
-RECIPE."
-  (define ref
-    (cond
-     ((assoc-ref recipe #:branch)
-      => (lambda (branch) (cons 'branch branch)))
-     ((assoc-ref recipe #:commit)
-      => (lambda (commit) (cons 'commit commit)))
-     (else
-      '())))
-
-  (let-values (((directory commit) (download-git-repository url ref)))
-    `(origin
-       (method git-fetch)
-       (uri (git-reference
-             (url ,url)
-             (commit ,commit)))
-       (file-name (git-file-name name version))
-       (sha256
-        (base32
-         ,(bytevector->nix-base32-string
-           (file-hash* directory #:recursive? #true)))))))
+(define (ref recipe)
+  "Create REF from MELPA RECIPE."
+  (cond
+   ((assoc-ref recipe #:branch)
+    => (lambda (branch) (cons 'branch branch)))
+   ((assoc-ref recipe #:commit)
+    => (lambda (commit) (cons 'commit commit)))
+   (else
+    '())))
 
 (define* (melpa-recipe->origin recipe)
   "Fetch origin details from the MELPA recipe and associated repository for
@@ -265,9 +247,9 @@ (define (gitlab-repo->url repo)
     (string-append "https://gitlab.com/" repo ".git"))
 
   (match (assq-ref recipe ':fetcher)
-    ('github (git-repository->origin recipe (github-repo->url (assq-ref recipe ':repo))))
-    ('gitlab (git-repository->origin recipe (gitlab-repo->url (assq-ref recipe ':repo))))
-    ('git    (git-repository->origin recipe (assq-ref recipe ':url)))
+    ('github (git->origin (github-repo->url (assq-ref recipe ':repo)) (ref recipe)))
+    ('gitlab (git->origin (gitlab-repo->url (assq-ref recipe ':repo)) (ref recipe)))
+    ('git    (git->origin (assq-ref recipe ':url) (ref recipe)))
     (#f #f)   ; if we're not using melpa then this stops us printing a warning
     (_ (warning (G_ "unsupported MELPA fetcher: ~a, falling back to unstable MELPA source~%")
                 (assq-ref recipe ':fetcher))
diff --git a/guix/import/go.scm b/guix/import/go.scm
index dd9298808d..6e2ce2ed00 100644
--- a/guix/import/go.scm
+++ b/guix/import/go.scm
@@ -8,6 +8,7 @@
 ;;; Copyright © 2021 Sarah Morgensen <iskarian@HIDDEN>
 ;;; Copyright © 2021 Simon Tournier <zimon.toutoune@HIDDEN>
 ;;; Copyright © 2023 Efraim Flashner <efraim@HIDDEN>
+;;; Copyright © 2023 Nicolas Graves <ngraves@HIDDEN>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -514,49 +515,24 @@ (define (module-meta-data-repo-url meta-data goproxy)
       goproxy
       (module-meta-repo-root meta-data)))
 
-(define* (git-checkout-hash url reference algorithm)
-  "Return the ALGORITHM hash of the checkout of URL at REFERENCE, a commit or
-tag."
-  (define cache
-    (string-append (or (getenv "TMPDIR") "/tmp")
-                   "/guix-import-go-"
-                   (passwd:name (getpwuid (getuid)))))
+;; This is done because the version field of the package, which the generated
+;; quoted expression refers to, has been stripped of any 'v' prefixed.
+(define (transform-version version)
+  (let ((plain-version? (string=? version (go-version->git-ref version)))
+        (v-prefixed?    (string-prefix? "v" version)))
+    (if (and plain-version? v-prefixed?)
+        '(string-append "v" version)
+        '(go-version->git-ref version))))
 
-  ;; Use a custom cache to avoid cluttering the default one under
-  ;; ~/.cache/guix, but choose one under /tmp so that it's persistent across
-  ;; subsequent "guix import" invocations.
-  (mkdir-p cache)
-  (chmod cache #o700)
-  (let-values (((checkout commit _)
-                (parameterize ((%repository-cache-directory cache))
-                  (update-cached-checkout url
-                                          #:ref
-                                          `(tag-or-commit . ,reference)))))
-    (file-hash* checkout #:algorithm algorithm #:recursive? #true)))
-
-(define (vcs->origin vcs-type vcs-repo-url version)
+(define* (vcs->origin vcs-type vcs-repo-url version
+                      #:key (transform-version #f))
   "Generate the `origin' block of a package depending on what type of source
-control system is being used."
+control system is being used. Optionally use the function TRANSFORM-VERSION
+which takes version as an input."
   (case vcs-type
     ((git)
-     (let ((plain-version? (string=? version (go-version->git-ref version)))
-           (v-prefixed?    (string-prefix? "v" version)))
-       `(origin
-          (method git-fetch)
-          (uri (git-reference
-                (url ,vcs-repo-url)
-                ;; This is done because the version field of the package,
-                ;; which the generated quoted expression refers to, has been
-                ;; stripped of any 'v' prefixed.
-                (commit ,(if (and plain-version? v-prefixed?)
-                             '(string-append "v" version)
-                             '(go-version->git-ref version)))))
-          (file-name (git-file-name name version))
-          (sha256
-           (base32
-            ,(bytevector->nix-base32-string
-              (git-checkout-hash vcs-repo-url (go-version->git-ref version)
-                                 (hash-algorithm sha256))))))))
+     (git->origin vcs-repo-url `(tag-or-commit . ,version)
+                  #:ref->commit transform-version))
     ((hg)
      `(origin
         (method hg-fetch)
@@ -649,7 +625,8 @@ (define* (go-module->guix-package module-path #:key
         (name ,guix-name)
         (version ,(strip-v-prefix version*))
         (source
-         ,(vcs->origin vcs-type vcs-repo-url version*))
+         ,(vcs->origin vcs-type vcs-repo-url version*
+                       #:transform-version transform-version))
         (build-system go-build-system)
         (arguments
          (list ,@(if (version>? min-go-version (package-version (go-package)))
diff --git a/guix/import/minetest.scm b/guix/import/minetest.scm
index 5ea6e023ce..65ef242431 100644
--- a/guix/import/minetest.scm
+++ b/guix/import/minetest.scm
@@ -1,6 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2021, 2022 Maxime Devos <maximedevos@HIDDEN>
 ;;; Copyright © 2022 Hartmut Goebel <h.goebel@HIDDEN>
+;;; Copyright © 2023 Nicolas Graves <ngraves@HIDDEN>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -32,7 +33,6 @@ (define-module (guix import minetest)
   #:use-module (guix import utils)
   #:use-module (guix import json)
   #:use-module (json)
-  #:use-module (guix base32)
   #:use-module (guix git)
   #:use-module ((guix git-download) #:prefix download:)
   #:use-module (guix hash)
@@ -277,12 +277,6 @@ (define url (string-append (%contentdb-api) "packages/?type=" type
 
 
 
-;; XXX copied from (guix import elpa)
-(define* (download-git-repository url ref)
-  "Fetch the given REF from the Git repository at URL."
-  (with-store store
-    (latest-repository-commit store url #:ref ref)))
-
 (define (make-minetest-sexp author/name version repository commit
                             inputs home-page synopsis
                             description media-license license)
@@ -293,24 +287,8 @@ (define (make-minetest-sexp author/name version repository commit
      (name ,(contentdb->package-name author/name))
      (version ,version)
      (source
-       (origin
-         (method git-fetch)
-         (uri (git-reference
-                (url ,repository)
-                (commit ,commit)))
-         (sha256
-          (base32
-           ;; The git commit is not always available.
-           ,(and commit
-                 (bytevector->nix-base32-string
-                  (file-hash*
-                   (download-git-repository repository
-                                            `(commit . ,commit))
-                   ;; 'download-git-repository' already filtered out the '.git'
-                   ;; directory.
-                   #:select? (const #true)
-                   #:recursive? #true)))))
-         (file-name (git-file-name name version))))
+      ,(git->origin
+        repository `(tag-or-commit . ,commit) #:ref->commit #t))
      (build-system minetest-mod-build-system)
      ,@(maybe-propagated-inputs (map contentdb->package-name inputs))
      (home-page ,home-page)
diff --git a/guix/import/utils.scm b/guix/import/utils.scm
index b7756fcc40..8512e0d64c 100644
--- a/guix/import/utils.scm
+++ b/guix/import/utils.scm
@@ -13,6 +13,7 @@
 ;;; Copyright © 2022 Alice Brenon <alice.brenon@HIDDEN>
 ;;; Copyright © 2022 Kyle Meyer <kyle@HIDDEN>
 ;;; Copyright © 2022 Philip McGrath <philip@HIDDEN>
+;;; Copyright © 2023 Nicolas Graves <ngraves@HIDDEN>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -39,6 +40,8 @@ (define-module (guix import utils)
   #:use-module (guix packages)
   #:use-module (guix discovery)
   #:use-module (guix build-system)
+  #:use-module (guix git)
+  #:use-module (guix hash)
   #:use-module ((guix i18n) #:select (G_))
   #:use-module (guix store)
   #:use-module (guix download)
@@ -63,6 +66,7 @@ (define-module (guix import utils)
 
             url-fetch
             guix-hash-url
+            git->origin
 
             package-names->package-inputs
             maybe-inputs
@@ -161,6 +165,41 @@ (define (guix-hash-url filename)
   "Return the hash of FILENAME in nix-base32 format."
   (bytevector->nix-base32-string (file-sha256 filename)))
 
+(define* (git->origin repo-url ref #:key (ref->commit #f))
+  "Returns a generated `origin' block of a package depending on the git source
+control system, and the directory in the store where the package has been
+downloaded, in case further processing is necessary.  REPO-URL or REF can be
+null. REF->COMMIT can be a function or #t, in which case the commit matching
+ref is used. If REF->COMMIT is not used, the value inside REF is used."
+  (let* ((version (and (pair? ref) (cdr ref)))
+         (directory commit
+                    (if version
+                        (with-store store
+                          (latest-repository-commit store repo-url
+                                                    #:ref (if version ref '())))
+                        (values #f #f)))
+         (vcommit (match ref->commit
+                    (#t    commit)
+                    (#f    version)
+                    ((? procedure?) (ref->commit version))
+                    (_     #f))))
+    (values
+     `(origin
+        (method git-fetch)
+        (uri (git-reference
+              (url ,(and (not (eq? repo-url 'null)) repo-url))
+              (commit ,vcommit)))
+        (file-name (git-file-name name version))
+        (sha256
+         (base32
+          ,(and version  ; Version or commit is not always available.
+                (bytevector->nix-base32-string
+                 (file-hash* directory
+                             ;; 'git-fetch' already filtered out '.git'.
+                             #:select? (const #true)
+                             #:recursive? #true))))))
+     directory)))
+
 (define %spdx-license-identifiers
   ;; https://spdx.org/licenses/
   ;; The gfl1.0, nmap, repoze
diff --git a/tests/go.scm b/tests/go.scm
index f925c485c1..8402f3e978 100644
--- a/tests/go.scm
+++ b/tests/go.scm
@@ -1,6 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2021 François Joulaud <francois.joulaud@HIDDEN>
 ;;; Copyright © 2021 Sarah Morgensen <iskarian@HIDDEN>
+;;; Copyright © 2023 Nicolas Graves <ngraves@HIDDEN>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -24,7 +25,6 @@ (define-module (tests-import-go)
   #:use-module (guix base32)
   #:use-module (guix build-system go)
   #:use-module (guix import go)
-  #:use-module (guix base32)
   #:use-module ((guix utils) #:select (call-with-temporary-directory))
   #:use-module (guix tests)
   #:use-module (ice-9 match)
@@ -403,13 +403,26 @@ (define (mock-http-get testcase)
             (mock-http-get fixtures-go-check-test))
          (mock ((guix http-client) http-fetch
                 (mock-http-fetch fixtures-go-check-test))
-             (mock ((guix git) update-cached-checkout
-                    (lambda* (url #:key ref)
-                      ;; Return an empty directory and its hash.
-                      (values checkout
-                              (nix-base32-string->bytevector
-                               "0sjjj9z1dhilhpc8pq4154czrb79z9cm044jvn75kxcjv6v5l2m5")
-                              #f)))
+             (mock ((guix import utils) git->origin
+                    ;; Mock an empty directory by replacing hash.
+                    (lambda* (repo-url ref #:key (ref->commit #f))
+                      (let* ((version (if (pair? ref)
+                                          (cdr ref)
+                                          #f))
+                             (vcommit (match ref->commit
+                                        (#t    commit)
+                                        (#f    version)
+                                        ((? procedure?) (ref->commit version))
+                                        (_     #f))))
+                        `(origin
+                           (method git-fetch)
+                           (uri (git-reference
+                                 (url ,(and (not (eq? repo-url 'null)) repo-url))
+                                 (commit ,vcommit)))
+                           (file-name (git-file-name name version))
+                           (sha256
+                            (base32
+                             "0sjjj9z1dhilhpc8pq4154czrb79z9cm044jvn75kxcjv6v5l2m5"))))))
                  (go-module->guix-package* "github.com/go-check/check")))))))
 
 (test-end "go")
diff --git a/tests/minetest.scm b/tests/minetest.scm
index bf1313ee22..94e93c64bf 100644
--- a/tests/minetest.scm
+++ b/tests/minetest.scm
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2021 Maxime Devos <maximedevos@HIDDEN>
+;;; Copyright © 2023 Nicolas Graves <ngraves@HIDDEN>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -57,15 +58,7 @@ (define* (make-package-sexp #:key
   `(package
      (name ,guix-name)
      (version ,version)
-     (source
-      (origin
-        (method git-fetch)
-        (uri (git-reference
-              (url ,(and (not (eq? repo 'null)) repo))
-              (commit #f)))
-        (sha256
-         (base32 #f))
-        (file-name (git-file-name name version))))
+     (source ,(git->origin repo #f))
      (build-system minetest-mod-build-system)
      ,@(maybe-propagated-inputs inputs)
      (home-page ,home-page)
@@ -419,8 +412,8 @@ (define* (example-package #:key
            (uri (git-reference
                  (url repo)
                  (commit commit #;"808f9ffbd3106da4c92d2367b118b98196c9e81e")))
-           (sha256 #f) ; not important for the following tests
-           (file-name (git-file-name name version)))
+           (file-name (git-file-name name version))
+           (sha256 #f)) ; not important for the following tests
          source))
     (build-system minetest-mod-build-system)
     (license #f)
-- 
2.46.0





Message sent to guix-patches@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: [bug#73833] [PATCH v2 2/5] tests: go: Add mock-git->origin function.
Resent-From: Nicolas Graves <ngraves@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: guix-patches@HIDDEN
Resent-Date: Thu, 17 Oct 2024 22:34:03 +0000
Resent-Message-ID: <handler.73833.B73833.172920443732204 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 73833
X-GNU-PR-Package: guix-patches
X-GNU-PR-Keywords: moreinfo patch
To: 73833 <at> debbugs.gnu.org
Cc: Nicolas Graves <ngraves@HIDDEN>
Received: via spool by 73833-submit <at> debbugs.gnu.org id=B73833.172920443732204
          (code B ref 73833); Thu, 17 Oct 2024 22:34:03 +0000
Received: (at 73833) by debbugs.gnu.org; 17 Oct 2024 22:33:57 +0000
Received: from localhost ([127.0.0.1]:35918 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1t1Z45-0008NA-EE
	for submit <at> debbugs.gnu.org; Thu, 17 Oct 2024 18:33:57 -0400
Received: from 3.mo581.mail-out.ovh.net ([46.105.34.113]:46749)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ngraves@HIDDEN>) id 1t1Z3s-0008M1-NJ
 for 73833 <at> debbugs.gnu.org; Thu, 17 Oct 2024 18:33:46 -0400
Received: from director5.ghost.mail-out.ovh.net (unknown [10.108.25.152])
 by mo581.mail-out.ovh.net (Postfix) with ESMTP id 4XV2fj6ScWz1L5R
 for <73833 <at> debbugs.gnu.org>; Thu, 17 Oct 2024 22:33:17 +0000 (UTC)
Received: from ghost-submission-5b5ff79f4f-lsfph (unknown [10.110.178.2])
 by director5.ghost.mail-out.ovh.net (Postfix) with ESMTPS id ED0451FDB5;
 Thu, 17 Oct 2024 22:33:16 +0000 (UTC)
Received: from ngraves.fr ([37.59.142.109])
 by ghost-submission-5b5ff79f4f-lsfph with ESMTPSA
 id ccFADayQEWepHgAAQvN7eQ
 (envelope-from <ngraves@HIDDEN>); Thu, 17 Oct 2024 22:33:16 +0000
Authentication-Results: garm.ovh; auth=pass
 (GARM-109S003025922eb-b40b-470c-b5ef-d698858f9de0,
 AF64BF28DCF8B52CDC45B9ABB40222CA4ECB7BAD) smtp.auth=ngraves@HIDDEN
X-OVh-ClientIp: 90.110.172.34
From: Nicolas Graves <ngraves@HIDDEN>
Date: Fri, 18 Oct 2024 00:25:58 +0200
Message-ID: <20241017223308.27941-3-ngraves@HIDDEN>
X-Mailer: git-send-email 2.46.0
In-Reply-To: <20241017223308.27941-1-ngraves@HIDDEN>
References: <20241017223308.27941-1-ngraves@HIDDEN>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Ovh-Tracer-Id: 10424988714309837538
X-VR-SPAMSTATE: OK
X-VR-SPAMSCORE: 0
X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeeftddrvdehvddguddvucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucenucfjughrpefhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefpihgtohhlrghsucfirhgrvhgvshcuoehnghhrrghvvghssehnghhrrghvvghsrdhfrheqnecuggftrfgrthhtvghrnhepvdehleeiffehtedvlefhffffjeefgfduhfetkeevheeiteduiedugfekuedtheejnecuffhomhgrihhnpehgihhthhhusgdrtghomhenucfkphepuddvjedrtddrtddruddpledtrdduuddtrddujedvrdefgedpfeejrdehledrudegvddruddtleenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeduvdejrddtrddtrddupdhmrghilhhfrhhomhepnhhgrhgrvhgvshesnhhgrhgrvhgvshdrfhhrpdhnsggprhgtphhtthhopedupdhrtghpthhtohepjeefkeeffeesuggvsggsuhhgshdrghhnuhdrohhrghdpoffvtefjohhsthepmhhoheekuddpmhhouggvpehsmhhtphhouhht
DKIM-Signature: a=rsa-sha256; bh=uUYTFPLt2BK9j2jfT1D+/ZmkriPK2Hz72oFFl/CmtCA=; 
 c=relaxed/relaxed; d=ngraves.fr; h=From;
 s=ovhmo4487190-selector1; t=1729204398; v=1;
 b=xaiF2Z2kcSiPlGiQHrZiOI8hc+HLzA7WkYx5aDsIhTKYVCc0i18xmvzXbINMHDmVOSlvecTA
 eK+3Y90uQK6wuAFef9WUJF7m52un7zOGuQW2jbSjM0JTOzclYlc81/6ds8Lef8wtafFrJvp9vFK
 qNDhT2P3DcnoeIyhOTA8V5Azwbo2csngOf8h96Wni903p1EHbBXZagMIauEa45xHeVHV44tTj2q
 rMX8ZVDIFX7XMXAnPgHAt1mPvx3SZla6ymR4nTS67Fha025yUpo4s0Fe1KdpilEV3FTZViUENMQ
 oW/ossyOs9LvLt1dq376jd++FHnpGdE5mcmmicxFI3AjA==
X-Spam-Score: 0.0 (/)
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: -1.0 (-)

* tests/go.scm
(mock-git->origin): Add function.
(go-module->guix-package test): Use mock-git->origin.
---
 tests/go.scm | 41 +++++++++++++++++++++--------------------
 1 file changed, 21 insertions(+), 20 deletions(-)

diff --git a/tests/go.scm b/tests/go.scm
index 8402f3e978..c08a73a850 100644
--- a/tests/go.scm
+++ b/tests/go.scm
@@ -371,6 +371,26 @@ (define (mock-http-get testcase)
           (values response-header body)
           (error "mocked http-get Unexpected URL: " url)))))
 
+;; Mock an empty directory by replacing hash.
+(define* (mock-git->origin repo-url ref #:key (ref->commit #f))
+  (let* ((version (if (pair? ref)
+                      (cdr ref)
+                      #f))
+         (vcommit (match ref->commit
+                    (#t    commit)
+                    (#f    version)
+                    ((? procedure?) (ref->commit version))
+                    (_     #f))))
+    `(origin
+       (method git-fetch)
+       (uri (git-reference
+             (url ,(and (not (eq? repo-url 'null)) repo-url))
+             (commit ,vcommit)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "0sjjj9z1dhilhpc8pq4154czrb79z9cm044jvn75kxcjv6v5l2m5")))))
+
 (test-equal "go-module->guix-package"
   '(package
      (name "go-github-com-go-check-check")
@@ -403,26 +423,7 @@ (define (mock-http-get testcase)
             (mock-http-get fixtures-go-check-test))
          (mock ((guix http-client) http-fetch
                 (mock-http-fetch fixtures-go-check-test))
-             (mock ((guix import utils) git->origin
-                    ;; Mock an empty directory by replacing hash.
-                    (lambda* (repo-url ref #:key (ref->commit #f))
-                      (let* ((version (if (pair? ref)
-                                          (cdr ref)
-                                          #f))
-                             (vcommit (match ref->commit
-                                        (#t    commit)
-                                        (#f    version)
-                                        ((? procedure?) (ref->commit version))
-                                        (_     #f))))
-                        `(origin
-                           (method git-fetch)
-                           (uri (git-reference
-                                 (url ,(and (not (eq? repo-url 'null)) repo-url))
-                                 (commit ,vcommit)))
-                           (file-name (git-file-name name version))
-                           (sha256
-                            (base32
-                             "0sjjj9z1dhilhpc8pq4154czrb79z9cm044jvn75kxcjv6v5l2m5"))))))
+             (mock ((guix import utils) git->origin mock-git->origin)
                  (go-module->guix-package* "github.com/go-check/check")))))))
 
 (test-end "go")
-- 
2.46.0





Message sent to guix-patches@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: [bug#73833] [PATCH v2 4/5] guix: refresh: Keep the version field of each update specification.
Resent-From: Nicolas Graves <ngraves@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: guix-patches@HIDDEN
Resent-Date: Thu, 17 Oct 2024 22:34:03 +0000
Resent-Message-ID: <handler.73833.B73833.172920444132218 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 73833
X-GNU-PR-Package: guix-patches
X-GNU-PR-Keywords: moreinfo patch
To: 73833 <at> debbugs.gnu.org
Cc: Nicolas Graves <ngraves@HIDDEN>
Received: via spool by 73833-submit <at> debbugs.gnu.org id=B73833.172920444132218
          (code B ref 73833); Thu, 17 Oct 2024 22:34:03 +0000
Received: (at 73833) by debbugs.gnu.org; 17 Oct 2024 22:34:01 +0000
Received: from localhost ([127.0.0.1]:35920 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1t1Z49-0008NS-Jh
	for submit <at> debbugs.gnu.org; Thu, 17 Oct 2024 18:34:01 -0400
Received: from 14.mo583.mail-out.ovh.net ([188.165.51.82]:55369)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ngraves@HIDDEN>) id 1t1Z3u-0008M4-K8
 for 73833 <at> debbugs.gnu.org; Thu, 17 Oct 2024 18:33:46 -0400
Received: from director3.ghost.mail-out.ovh.net (unknown [10.109.140.151])
 by mo583.mail-out.ovh.net (Postfix) with ESMTP id 4XV2fl47fcz1BXm
 for <73833 <at> debbugs.gnu.org>; Thu, 17 Oct 2024 22:33:19 +0000 (UTC)
Received: from ghost-submission-5b5ff79f4f-wjxxw (unknown [10.110.118.160])
 by director3.ghost.mail-out.ovh.net (Postfix) with ESMTPS id 36DF71FE37;
 Thu, 17 Oct 2024 22:33:19 +0000 (UTC)
Received: from ngraves.fr ([37.59.142.103])
 by ghost-submission-5b5ff79f4f-wjxxw with ESMTPSA
 id tLN4Aa+QEWfIXwEAfmDdGw
 (envelope-from <ngraves@HIDDEN>); Thu, 17 Oct 2024 22:33:19 +0000
Authentication-Results: garm.ovh; auth=pass
 (GARM-103G0056fd951eb-24c2-475c-bbb3-aa16d1fd2612,
 AF64BF28DCF8B52CDC45B9ABB40222CA4ECB7BAD) smtp.auth=ngraves@HIDDEN
X-OVh-ClientIp: 90.110.172.34
From: Nicolas Graves <ngraves@HIDDEN>
Date: Fri, 18 Oct 2024 00:26:00 +0200
Message-ID: <20241017223308.27941-5-ngraves@HIDDEN>
X-Mailer: git-send-email 2.46.0
In-Reply-To: <20241017223308.27941-1-ngraves@HIDDEN>
References: <20241017223308.27941-1-ngraves@HIDDEN>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Ovh-Tracer-Id: 10425551666186478306
X-VR-SPAMSTATE: OK
X-VR-SPAMSCORE: 0
X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeeftddrvdehvddguddvucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucenucfjughrpefhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefpihgtohhlrghsucfirhgrvhgvshcuoehnghhrrghvvghssehnghhrrghvvghsrdhfrheqnecuggftrfgrthhtvghrnhepleffjeetueethfefkeffffefvddukeejkefgleduiedthfekvefhiedvhfffgeegnecukfhppeduvdejrddtrddtrddupdeltddruddutddrudejvddrfeegpdefjedrheelrddugedvrddutdefnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepuddvjedrtddrtddruddpmhgrihhlfhhrohhmpehnghhrrghvvghssehnghhrrghvvghsrdhfrhdpnhgspghrtghpthhtohepuddprhgtphhtthhopeejfeekfeefseguvggssghughhsrdhgnhhurdhorhhgpdfovfetjfhoshhtpehmohehkeefpdhmohguvgepshhmthhpohhuth
DKIM-Signature: a=rsa-sha256; bh=7IPP+rNOyjYJOHM7ShBzjiOpq+SVWN0QX+R2h48YiKI=; 
 c=relaxed/relaxed; d=ngraves.fr; h=From;
 s=ovhmo4487190-selector1; t=1729204399; v=1;
 b=yp6OgKl5QAkqiRXSUPcvMwzCrxB1snhaufgOWk4X5xy+y+aNH+OfEOj324LhGPlD90Co0BfM
 SHy2lTvSkBx3s9x+DeFfrkX+I+8NgulImm0rz6e3+2Ha2j6uIDhVcJ+w/ozyjOwNlLhCeZFA4Xw
 HeC6+JGL4OPPHY2nZTlkCPe8+Uz52pesSNeEghU5+dycHY/4oxE/O8JaXm3hO7XA1be75NFcIT1
 t8BbXmFOTm+MFy8N0jtWbu40ve0Hz1EYxppDdtbnrzgp0F10K/A9jNs/YtxG4N3WT84raWc0tuz
 Y14Yw9+IlCIIKEu2eiE2bcbvVqXUiunL/2gr094Q6L2yw==
X-Spam-Score: 0.0 (/)
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: -1.0 (-)

* guix/scripts/refresh.scm (options->update-specs)[update-specs]: Keep
the version field of each update specification.  This is done using a
variable to cache package names and then filter out unwanted candidates.
---
 guix/scripts/refresh.scm | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/guix/scripts/refresh.scm b/guix/scripts/refresh.scm
index ec7d38c22a..810c33c786 100644
--- a/guix/scripts/refresh.scm
+++ b/guix/scripts/refresh.scm
@@ -310,12 +310,23 @@ (define update-specs
        some)))
 
   (if (assoc-ref opts 'recursive?)
-      (mlet* %store-monad ((edges (node-edges %bag-node-type (all-packages)))
-                           (packages -> (node-transitive-edges
-                                         (map update-spec-package update-specs)
-                                         edges)))
-        ;; FIXME: The 'version' field of each update spec is lost.
-        (return (map update-spec packages)))
+      (mlet* %store-monad
+          ((edges (node-edges %bag-node-type (all-packages)))
+           (strict-spec-pkgs -> (map update-spec-package update-specs))
+           (strict-spec-pkg-names -> (map package-name strict-spec-pkgs))
+           (packages -> (node-transitive-edges strict-spec-pkgs edges))
+           (transitive-specs -> (map update-spec packages)))
+        (return (append update-specs
+                        (filter-map (match-lambda
+                                      ((? update? spec)
+                                       (if (member (package-name
+                                                    (update-spec-package spec))
+                                                   strict-spec-pkg-names)
+                                           spec
+                                           #f))
+                                      (_
+                                       #f))
+                                    transitive-specs))))
       (with-monad %store-monad
         (return update-specs))))
 
-- 
2.46.0





Message sent to guix-patches@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: [bug#73833] [PATCH v2 3/5] guix: import: composer: Improve importer.
Resent-From: Nicolas Graves <ngraves@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: guix-patches@HIDDEN
Resent-Date: Thu, 17 Oct 2024 22:34:04 +0000
Resent-Message-ID: <handler.73833.B73833.172920444232243 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 73833
X-GNU-PR-Package: guix-patches
X-GNU-PR-Keywords: moreinfo patch
To: 73833 <at> debbugs.gnu.org
Cc: Nicolas Graves <ngraves@HIDDEN>
Received: via spool by 73833-submit <at> debbugs.gnu.org id=B73833.172920444232243
          (code B ref 73833); Thu, 17 Oct 2024 22:34:04 +0000
Received: (at 73833) by debbugs.gnu.org; 17 Oct 2024 22:34:02 +0000
Received: from localhost ([127.0.0.1]:35922 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1t1Z4D-0008Na-Mi
	for submit <at> debbugs.gnu.org; Thu, 17 Oct 2024 18:34:02 -0400
Received: from 17.mo550.mail-out.ovh.net ([87.98.179.142]:47679)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ngraves@HIDDEN>) id 1t1Z3t-0008M3-Gd
 for 73833 <at> debbugs.gnu.org; Thu, 17 Oct 2024 18:33:47 -0400
Received: from director1.ghost.mail-out.ovh.net (unknown [10.108.17.1])
 by mo550.mail-out.ovh.net (Postfix) with ESMTP id 4XV2fk4jMTz1VZl
 for <73833 <at> debbugs.gnu.org>; Thu, 17 Oct 2024 22:33:18 +0000 (UTC)
Received: from ghost-submission-5b5ff79f4f-j8lkq (unknown [10.108.42.239])
 by director1.ghost.mail-out.ovh.net (Postfix) with ESMTPS id 545AB1FD0F;
 Thu, 17 Oct 2024 22:33:18 +0000 (UTC)
Received: from ngraves.fr ([37.59.142.98])
 by ghost-submission-5b5ff79f4f-j8lkq with ESMTPSA
 id NyJ1Aq6QEWfqZAEABgfSDw
 (envelope-from <ngraves@HIDDEN>); Thu, 17 Oct 2024 22:33:18 +0000
Authentication-Results: garm.ovh; auth=pass
 (GARM-98R0026406115d-8cda-4936-a0f3-c7c465ce10ff,
 AF64BF28DCF8B52CDC45B9ABB40222CA4ECB7BAD) smtp.auth=ngraves@HIDDEN
X-OVh-ClientIp: 90.110.172.34
From: Nicolas Graves <ngraves@HIDDEN>
Date: Fri, 18 Oct 2024 00:25:59 +0200
Message-ID: <20241017223308.27941-4-ngraves@HIDDEN>
X-Mailer: git-send-email 2.46.0
In-Reply-To: <20241017223308.27941-1-ngraves@HIDDEN>
References: <20241017223308.27941-1-ngraves@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Ovh-Tracer-Id: 10425270191694406370
X-VR-SPAMSTATE: OK
X-VR-SPAMSCORE: 0
X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeeftddrvdehvddguddvucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucenucfjughrpefhvfevufffkffojghfgggtgfesthekredtredtjeenucfhrhhomheppfhitgholhgrshcuifhrrghvvghsuceonhhgrhgrvhgvshesnhhgrhgrvhgvshdrfhhrqeenucggtffrrghtthgvrhhnpeekieehjedvvdetueeiveeifeehiedvudelffeufeeggfeifeevgeeggeevgffgheenucffohhmrghinhepphgrtghkrghgihhsthdrohhrghenucfkphepuddvjedrtddrtddruddpledtrdduuddtrddujedvrdefgedpfeejrdehledrudegvddrleeknecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepuddvjedrtddrtddruddpmhgrihhlfhhrohhmpehnghhrrghvvghssehnghhrrghvvghsrdhfrhdpnhgspghrtghpthhtohepuddprhgtphhtthhopeejfeekfeefseguvggssghughhsrdhgnhhurdhorhhgpdfovfetjfhoshhtpehmohehhedtpdhmohguvgepshhmthhpohhuth
DKIM-Signature: a=rsa-sha256; bh=KV4iAGXpWArUijVOAXMWLdk2Gp4bZItdk7tYtlOnFK0=; 
 c=relaxed/relaxed; d=ngraves.fr; h=From;
 s=ovhmo4487190-selector1; t=1729204398; v=1;
 b=whqqNr6hmnvdc7cUxhZmWNFNrX1wEDad9wt+ua7g6YORJptbh300b2BgE1T/AnTWAUTCPard
 fj51KHEGOLrVgbWcFDrOHnAicF8diZUoY99hsMh/F2/Wojq3Gz87lLkcZojJ5DEIFMW3JdEkIGq
 GIgtYHP8n3Mk1YFFppib5NH/BCwcead7fEp4mU3rho4H9dayEYa6CM4ayqhWnxxMo/nmzIg5iOQ
 +NImW5QwKRqB5MjY43VJEQk1Ji1MfzmM9nB5LuUjgPMGkPVymwIMZGhLU+I9/BXDEGGc3QB6ln7
 pfsLeWO01lMNXeh5WFIqtW8JDyxJIxeZp5M+5oRF+T4AQ==
X-Spam-Score: 0.0 (/)
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: -1.0 (-)

* guix/import/composer.scm
(%composer-base-url): Move from here...
(%packagist-base-url): ...to here.
(requirements->prefixes): Add variable to read and take advantage of
version info in composer package requirements and...
(json->require): ...use it here. Rewrite of the function.
(composer-source): Add a sanitizer for composer-source-url.
(select-version): Add variable to select the most recent availble
version that is above to a given min-version and...
(composer-fetch): ...use it here. Improve the function.
(make-php-sexp, composer->guix-package): Adapt to requirements being
alists now.
(php-package?): Handle the particular phpunit case.
(dependency->input): Add min-version and max-version information. This
is currently limited to the first dependency suggested by
requirements.
(import-release): Fix git urls case. This is better but still a bit
buggy (refreshing can replace the version by a commit).

* tests/composer.scm
(%composer-base-url): Move from here...
(%packagist-base-url): ...to here.
---
 guix/import/composer.scm | 151 +++++++++++++++++++++++++++------------
 tests/composer.scm       |   2 +-
 2 files changed, 105 insertions(+), 48 deletions(-)

diff --git a/guix/import/composer.scm b/guix/import/composer.scm
index a6a482021f..d6af50da8c 100644
--- a/guix/import/composer.scm
+++ b/guix/import/composer.scm
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2019 Julien Lepiller <julien@HIDDEN>
+;;; Copyright © 2023, 2024 Nicolas Graves <ngraves@HIDDEN>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -21,6 +22,8 @@ (define-module (guix import composer)
   #:use-module (json)
   #:use-module (guix build-system composer)
   #:use-module ((guix diagnostics) #:select (warning))
+  #:use-module ((guix import git) #:select (latest-git-tag-version))
+  #:use-module ((guix git-download) #:select (git-reference))
   #:use-module ((guix download) #:select (download-to-store))
   #:use-module (guix hash)
   #:use-module (guix i18n)
@@ -34,13 +37,14 @@ (define-module (guix import composer)
   #:use-module (guix utils)
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-26)
+  #:use-module (srfi srfi-71)
   #:export (composer->guix-package
             %composer-updater
             composer-recursive-import
 
-            %composer-base-url))
+            %packagist-base-url))
 
-(define %composer-base-url
+(define %packagist-base-url
   (make-parameter "https://repo.packagist.org"))
 
 (define (fix-version version)
@@ -54,26 +58,40 @@ (define (fix-version version)
      (substring version 1))
     (else version)))
 
-(define (latest-version versions)
-  (fold (lambda (a b) (if (version>? (fix-version a) (fix-version b)) a b))
-        (car versions) versions))
+(define (requirements->prefixes str)
+  (let* ((processed-str (string-replace-substring str " || " "|"))
+         (prefix-strs (string-split processed-str #\|)))
+    (filter-map (match-lambda
+                  ;; SemVer: ^ indicates major+minor match, not a whole match.
+                  ((? (cut string-prefix? "^" <>) prefix)
+                   (let ((pfx (string-drop prefix 1)))
+                     (if (eq? 2 (string-count prefix #\.))
+                         (string-take pfx (string-rindex pfx #\.))
+                         pfx)))
+                  ((? (cut string-suffix? ".*" <>) prefix)
+                   (string-drop-right prefix 2))
+                  (_ #f))
+         prefix-strs)))
 
 (define (json->require dict)
-  (if dict
-      (let loop ((result '()) (require dict))
-        (match require
-          (() result)
-          ((((? (cut string-contains <> "/") name) . _)
-             require ...)
-           (loop (cons name result) require))
-          ((_ require ...) (loop result require))
-          (_ result)))
+  (if (and dict (not (unspecified? dict)))
+      (filter-map
+       (match-lambda
+         (((? (cut string-contains <> "/") name) . requirements)
+          (list name (requirements->prefixes requirements)))
+         (_
+          #f))
+       dict)
       '()))
 
 (define-json-mapping <composer-source> make-composer-source composer-source?
   json->composer-source
   (type      composer-source-type)
-  (url       composer-source-url)
+  (url       composer-source-url "url"
+             (lambda (uri)
+               (if (string-suffix? ".git" uri)
+                   (string-drop-right uri 4)
+                   uri)))
   (reference composer-source-reference))
 
 (define-json-mapping <composer-package> make-composer-package composer-package?
@@ -98,31 +116,44 @@ (define (valid-version? v)
          (not (string-contains d "beta"))
          (not (string-contains d "rc")))))
 
+(define* (select-version packages #:key (min-version #f))
+  "Select the most recent available version in the PACKAGES list
+that is above or equal to MIN-VERSION. MIN-VERSION can be incomplete
+(e.g. version-major only)."
+  (let* ((points (and min-version (string-count min-version #\.)))
+         (min-prefix (and min-version
+                          (match points
+                            ((or 0 1) (fix-version min-version))
+                            (_ #f)))))
+    (cdr
+     (fold
+      (lambda (new cur-max)
+        (match new
+          (((? valid-version? version) . tail)
+           (let ((valid-version (fix-version version)))
+             (if (and (version>? valid-version (fix-version (car cur-max)))
+                      (or (not min-prefix)
+                          (version-prefix? min-prefix valid-version)))
+                 (cons* version tail)
+                 cur-max)))
+          (_ cur-max)))
+      (cons* "0.0.0" #f)
+      packages))))
+
 (define* (composer-fetch name #:key (version #f))
   "Return a composer-package representation of the Composer metadata for the
 package NAME with optional VERSION, or #f on failure."
-  (let* ((url (string-append (%composer-base-url) "/p/" name ".json"))
+  (let* ((url (string-append (%packagist-base-url) "/p/" name ".json"))
          (packages (and=> (json-fetch url)
                           (lambda (pkg)
                             (let ((pkgs (assoc-ref pkg "packages")))
                               (or (assoc-ref pkgs name) pkg))))))
-    (if packages
-        (json->composer-package
-         (if version
-             (assoc-ref packages version)
-             (cdr
-              (fold
-               (lambda (new cur-max)
-                 (match new
-                   (((? valid-version? version) . tail)
-                    (if (version>? (fix-version version)
-                                   (fix-version (car cur-max)))
-                        (cons* version tail)
-                        cur-max))
-                   (_ cur-max)))
-               (cons* "0.0.0" #f)
-               packages))))
-        #f)))
+    (and packages
+        (let ((v (assoc-ref packages version)))
+          (and=>
+           (or (and v (not (unspecified? v)) v)
+               (select-version packages #:min-version version))
+         json->composer-package)))))
 
 (define (php-package-name name)
   "Given the NAME of a package on Packagist, return a Guix-compliant name for
@@ -136,9 +167,9 @@ (define (make-php-sexp composer-package)
   "Return the `package' s-expression for a PHP package for the given
 COMPOSER-PACKAGE."
   (let* ((source (composer-package-source composer-package))
-         (dependencies (map php-package-name
+         (dependencies (map (compose php-package-name car)
                             (composer-package-require composer-package)))
-         (dev-dependencies (map php-package-name
+         (dev-dependencies (map (compose php-package-name car)
                                 (composer-package-dev-require composer-package))))
     `(package
        (name ,(composer-package-name composer-package))
@@ -176,10 +207,14 @@ (define composer->guix-package
 dependencies, or #f and the empty list on failure."
      (let ((package (composer-fetch package-name #:version version)))
        (if package
-           (let* ((dependencies-names (composer-package-require package))
-                  (dev-dependencies-names (composer-package-dev-require package)))
-             (values (make-php-sexp package)
-                     (append dependencies-names dev-dependencies-names)))
+           (values (make-php-sexp package)
+                   (append-map
+                    (match-lambda
+                      ((head . tail)
+                       (cons head (car tail)))
+                      (_ #f))
+                    (list (composer-package-require package)
+                          (composer-package-dev-require package))))
            (values #f '()))))))
 
 (define (guix-name->composer-name name)
@@ -213,24 +248,46 @@ (define (php-package? package)
   "Return true if PACKAGE is a PHP package from Packagist."
   (and
    (eq? (package-build-system package) composer-build-system)
-   (string-prefix? "php-" (package-name package))))
+   (or (string-prefix? "php-" (package-name package))
+       (string=? "phpunit" (package-name package)))))
 
 (define (dependency->input dependency type)
-  (upstream-input
-   (name dependency)
-   (downstream-name (php-package-name dependency))
-   (type type)))
+  (let* ((version (fix-version (caadr dependency)))
+         (points (and version (string-count version #\.)))
+         (max "99"))
+    (upstream-input
+     (name (car dependency))
+     (downstream-name (php-package-name (car dependency)))
+     (type type)
+     (min-version (match points
+                    (0 (string-append version ".0.0"))
+                    (1 (string-append version ".0"))
+                    (2 version)
+                    (_ 'any)))
+     (max-version (match points
+                    (0 (string-append version "." max "." max))
+                    (1 (string-append version "." max))
+                    (2 version)
+                    (_ 'any))))))
 
 (define* (import-release package #:key (version #f))
   "Return an <upstream-source> for VERSION or the latest release of PACKAGE."
   (let* ((php-name (guix-package->composer-name package))
-         (composer-package (composer-fetch php-name #:version version)))
+         (composer-package (composer-fetch php-name #:version version))
+         (new-version new-version-tag
+                      (latest-git-tag-version package #: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))))
+         (urls
+          (let ((source (composer-package-source composer-package)))
+            (if (string=? (composer-source-type source) "git")
+                (git-reference
+                 (url (composer-source-url source))
+                 (commit (or new-version-tag
+                             (composer-source-reference source))))
+                (list (composer-source-url source)))))
          (inputs (append
                   (map (cut dependency->input <> 'regular)
                        (composer-package-require composer-package))
diff --git a/tests/composer.scm b/tests/composer.scm
index 9114fef19e..355ebab67c 100644
--- a/tests/composer.scm
+++ b/tests/composer.scm
@@ -61,7 +61,7 @@ (define test-source
   ;; Replace network resources with sample data.
   (with-http-server `((200 ,test-json)
                       (200 ,test-source))
-    (parameterize ((%composer-base-url (%local-url))
+    (parameterize ((%packagist-base-url (%local-url))
                    (current-http-proxy (%local-url)))
       (match (composer->guix-package "foo/bar")
         (`(package
-- 
2.46.0





Message sent to guix-patches@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: [bug#73833] [PATCH v2 5/5] guix: refresh: Implement basic upstream-source-inputs rich updates.
Resent-From: Nicolas Graves <ngraves@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: guix-patches@HIDDEN
Resent-Date: Thu, 17 Oct 2024 22:34:04 +0000
Resent-Message-ID: <handler.73833.B73833.172920444332257 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 73833
X-GNU-PR-Package: guix-patches
X-GNU-PR-Keywords: moreinfo patch
To: 73833 <at> debbugs.gnu.org
Cc: Nicolas Graves <ngraves@HIDDEN>
Received: via spool by 73833-submit <at> debbugs.gnu.org id=B73833.172920444332257
          (code B ref 73833); Thu, 17 Oct 2024 22:34:04 +0000
Received: (at 73833) by debbugs.gnu.org; 17 Oct 2024 22:34:03 +0000
Received: from localhost ([127.0.0.1]:35925 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1t1Z4E-0008O0-IG
	for submit <at> debbugs.gnu.org; Thu, 17 Oct 2024 18:34:03 -0400
Received: from 13.mo583.mail-out.ovh.net ([87.98.182.191]:58805)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ngraves@HIDDEN>) id 1t1Z3v-0008ML-EH
 for 73833 <at> debbugs.gnu.org; Thu, 17 Oct 2024 18:33:47 -0400
Received: from director2.ghost.mail-out.ovh.net (unknown [10.108.9.136])
 by mo583.mail-out.ovh.net (Postfix) with ESMTP id 4XV2fm4Q4Dz1TCP
 for <73833 <at> debbugs.gnu.org>; Thu, 17 Oct 2024 22:33:20 +0000 (UTC)
Received: from ghost-submission-5b5ff79f4f-fv27r (unknown [10.108.42.247])
 by director2.ghost.mail-out.ovh.net (Postfix) with ESMTPS id 62F1A1FD18;
 Thu, 17 Oct 2024 22:33:20 +0000 (UTC)
Received: from ngraves.fr ([37.59.142.105])
 by ghost-submission-5b5ff79f4f-fv27r with ESMTPSA
 id pTLuMa+QEWeJCwAARl4Asg
 (envelope-from <ngraves@HIDDEN>); Thu, 17 Oct 2024 22:33:20 +0000
Authentication-Results: garm.ovh; auth=pass
 (GARM-105G00685f48028-3fe8-43de-b6d8-907df52afc1e,
 AF64BF28DCF8B52CDC45B9ABB40222CA4ECB7BAD) smtp.auth=ngraves@HIDDEN
X-OVh-ClientIp: 90.110.172.34
From: Nicolas Graves <ngraves@HIDDEN>
Date: Fri, 18 Oct 2024 00:26:01 +0200
Message-ID: <20241017223308.27941-6-ngraves@HIDDEN>
X-Mailer: git-send-email 2.46.0
In-Reply-To: <20241017223308.27941-1-ngraves@HIDDEN>
References: <20241017223308.27941-1-ngraves@HIDDEN>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Ovh-Tracer-Id: 10425833137750663906
X-VR-SPAMSTATE: OK
X-VR-SPAMSCORE: 0
X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeeftddrvdehvddguddvucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucenucfjughrpefhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefpihgtohhlrghsucfirhgrvhgvshcuoehnghhrrghvvghssehnghhrrghvvghsrdhfrheqnecuggftrfgrthhtvghrnhepleffjeetueethfefkeffffefvddukeejkefgleduiedthfekvefhiedvhfffgeegnecukfhppeduvdejrddtrddtrddupdeltddruddutddrudejvddrfeegpdefjedrheelrddugedvrddutdehnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepuddvjedrtddrtddruddpmhgrihhlfhhrohhmpehnghhrrghvvghssehnghhrrghvvghsrdhfrhdpnhgspghrtghpthhtohepuddprhgtphhtthhopeejfeekfeefseguvggssghughhsrdhgnhhurdhorhhgpdfovfetjfhoshhtpehmohehkeefpdhmohguvgepshhmthhpohhuth
DKIM-Signature: a=rsa-sha256; bh=AcsH/fdjYtEfZycmGJSFEAiDp/AI/uWeWbrOxp7imN4=; 
 c=relaxed/relaxed; d=ngraves.fr; h=From;
 s=ovhmo4487190-selector1; t=1729204400; v=1;
 b=XoktjJbOcAE7gNhA9oT4esoNBZaNOCYKWXTST+Ihjl7HA0avcEEd2a9RBtZvdB9AVFVAH7UQ
 a/QmImgQhWow/vupGoNebtCrVqtOF/0N6gG2E7KQxgLwBF8ldWZys5ENWm1BlEVQovu97wwfu6r
 IcRteGCLju5vcpdFE00qhjaO9HGfTzIweIFSjV8RCbZMGvMMET7iavMzSPZ6W27VFBdsL0pCNS+
 eHWpaXKSRWBY246t9ofBfAq2IAAxgf0+jsCYlvIY5y1ok3Gn7GRptPwubaF3D9SPjI4ndbPyrOh
 ISz3SC5FduY6TooL6hTfzygYZPQurgJss1iNkQ7s8Xa+Q==
X-Spam-Score: 0.0 (/)
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: -1.0 (-)

* guix/scripts/refresh.scm (options->user-updaters): Add variable.
(options->update-specs)[input->update-spec]: Restrained default where
the min-version and max-version have the same major+minor version.
[update-specs]: Adapt user-specified packages to be aware of
upstream-source-inputs version in this restrained default.

This should allow to update dependent packages to the right version
as opposed to the latest version. Tested in some capacity, but very
alpha.

This also implies that the upstream-updater-import is able to provide
versions on top of packages, that the updater is able to read
incomplete semver versions (such as 3.2 instead of 3.2.1), and that
the upstream-inputs have their min-version and max-version set.
---
 guix/scripts/refresh.scm | 36 ++++++++++++++++++++++++++++++------
 1 file changed, 30 insertions(+), 6 deletions(-)

diff --git a/guix/scripts/refresh.scm b/guix/scripts/refresh.scm
index 810c33c786..70685ddbc1 100644
--- a/guix/scripts/refresh.scm
+++ b/guix/scripts/refresh.scm
@@ -229,6 +229,14 @@ (define (update-specification->update-spec spec fallback-version)
     (idx (update-spec (specification->package (substring spec 0 idx))
                       (substring spec (1+ idx))))))
 
+(define (options->user-updaters opts)
+  ;; Return the list of user-specified updaters.
+  (filter-map (match-lambda
+                (('updaters . names)
+                 (map lookup-updater-by-name names))
+                (_ #f))
+              opts))
+
 (define (options->update-specs opts)
   "Return the list of <update-spec> records requested by OPTS, honoring
 options like '--recursive'."
@@ -269,6 +277,14 @@ (define (keep-newest package lst)
         (_
          (cons package lst)))))
 
+  (define (input->update-spec input)
+    (%update-spec
+     (specification->package (upstream-input-downstream-name input))
+     (if (string=? (version-major+minor (upstream-input-max-version input))
+                   (version-major+minor (upstream-input-min-version input)))
+         (version-major+minor (upstream-input-max-version input))
+         #f)))
+
   (define update-specs
     ;; Update specs explicitly passed as command-line arguments.
     (match (append-map (match-lambda
@@ -307,7 +323,19 @@ (define update-specs
                              '()
                              modules))))
       (some                                       ;user-specified packages
-       some)))
+       ;; When the user specifies updaters, and these updaters support
+       ;; min/max versions, updates specs so that they account for this
+       ;; updater.
+       (let ((user-updaters (options->user-updaters opts)))
+         (if (and user-updaters (not (unspecified? user-updaters))
+                  (not (null? user-updaters)))
+             (let* ((import (upstream-updater-import (caar user-updaters)))
+                    (package (update-spec-package (car some)))
+                    (version (update-spec-version (car some)))
+                    (source (import package #:version version))
+                    (upstream-inputs (upstream-source-inputs source)))
+               (append some (map input->update-spec upstream-inputs)))
+             some)))))
 
   (if (assoc-ref opts 'recursive?)
       (mlet* %store-monad
@@ -571,11 +599,7 @@ (define (parse-options)
 
   (define (options->updaters opts)
     ;; Return the list of updaters to use.
-    (match (filter-map (match-lambda
-                         (('updaters . names)
-                          (map lookup-updater-by-name names))
-                         (_ #f))
-                       opts)
+    (match (options->user-updaters opts)
       (()
        ;; Use the default updaters.
        (force %updaters))
-- 
2.46.0





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


Received: (at control) by debbugs.gnu.org; 17 Oct 2024 23:10:24 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Oct 17 19:10:24 2024
Received: from localhost ([127.0.0.1]:36228 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1t1ZdQ-0001q9-FB
	for submit <at> debbugs.gnu.org; Thu, 17 Oct 2024 19:10:24 -0400
Received: from 2.mo575.mail-out.ovh.net ([46.105.52.162]:57409)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ngraves@HIDDEN>) id 1t1ZdO-0001pz-Cm
 for control <at> debbugs.gnu.org; Thu, 17 Oct 2024 19:10:23 -0400
Received: from director1.ghost.mail-out.ovh.net (unknown [10.109.139.201])
 by mo575.mail-out.ovh.net (Postfix) with ESMTP id 4XV3T34rntz1k4G
 for <control <at> debbugs.gnu.org>; Thu, 17 Oct 2024 23:09:59 +0000 (UTC)
Received: from ghost-submission-5b5ff79f4f-rdg64 (unknown [10.110.96.170])
 by director1.ghost.mail-out.ovh.net (Postfix) with ESMTPS id 7CC781FD22
 for <control <at> debbugs.gnu.org>; Thu, 17 Oct 2024 23:09:59 +0000 (UTC)
Received: from ngraves.fr ([37.59.142.110])
 by ghost-submission-5b5ff79f4f-rdg64 with ESMTPSA
 id 1oOhHUWZEWcGdgEAGFRN/A (envelope-from <ngraves@HIDDEN>)
 for <control <at> debbugs.gnu.org>; Thu, 17 Oct 2024 23:09:59 +0000
Authentication-Results: garm.ovh; auth=pass
 (GARM-110S0042791d626-810a-407c-90d1-eed1ca871496,
 AF64BF28DCF8B52CDC45B9ABB40222CA4ECB7BAD) smtp.auth=ngraves@HIDDEN
X-OVh-ClientIp: 90.110.172.34
From: Nicolas Graves <ngraves@HIDDEN>
To: control <at> debbugs.gnu.org
Subject: tag 73833 moreinfo
Date: Fri, 18 Oct 2024 01:09:54 +0200
Message-ID: <87msj2con1.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Ovh-Tracer-Id: 11044796614252946021
X-VR-SPAMSTATE: OK
X-VR-SPAMSCORE: 0
X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeeftddrvdehvddgvddtucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucenucfjughrpefhvffufffkgggtsehttdertddttddtnecuhfhrohhmpefpihgtohhlrghsucfirhgrvhgvshcuoehnghhrrghvvghssehnghhrrghvvghsrdhfrheqnecuggftrfgrthhtvghrnhepueejleeileejfffhleetjedtleejheevudffleevgfdufeekhefgvddvveegveefnecukfhppeduvdejrddtrddtrddupdeltddruddutddrudejvddrfeegpdefjedrheelrddugedvrdduuddtnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepuddvjedrtddrtddruddpmhgrihhlfhhrohhmpehnghhrrghvvghssehnghhrrghvvghsrdhfrhdpnhgspghrtghpthhtohepuddprhgtphhtthhopegtohhnthhrohhlseguvggssghughhsrdhgnhhurdhorhhgpdfovfetjfhoshhtpehmohehjeehpdhmohguvgepshhmthhpohhuth
DKIM-Signature: a=rsa-sha256; bh=g4+abPARbQNhqZseSDUczcW61cOU+un5ef5hQN20EfQ=; 
 c=relaxed/relaxed; d=ngraves.fr; h=From;
 s=ovhmo4487190-selector1; t=1729206599; v=1;
 b=xY1TwbW7SGB+y9QLXa8gmN9iBcsvcB1aRaUtagK/q0djZjIkIHZciQDgoVpMvmEXzhVKcciF
 SBHNX1g0FDgZElA0Dmwjfk6HRXE/FU/lg0Tq8N4H0kr/dvmIIQFdjGRdByYH3FLzroWuD8xXWLZ
 ShL6eji5wcnPh4aCvXDjKSIP82znqLoIg9gnWWFjqbOwq1K7V/QYp3tyFMWJZexZ2Kz1nG+Kd1/
 5hwNKtlXduXSF4tgf9k30y1uhFg6/ppfCK7tqg2NCIYGniLYcLEDSN6zsTPdyFm3UGYvsAKU5oT
 2NP2wsrNBrTnZCykVRTb8uiXxwjt91FoPZDX1QgtlWAnA==
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: control
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: -1.0 (-)

tags 73833 - moreinfo
quit

-- 
Best regards,
Nicolas Graves




Message sent to guix-patches@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: [bug#73833] [PATCH v2 1/5] guix: import: utils: Add function git->origin.
Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: guix-patches@HIDDEN
Resent-Date: Wed, 06 Nov 2024 15:19:02 +0000
Resent-Message-ID: <handler.73833.B73833.173090632520364 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 73833
X-GNU-PR-Package: guix-patches
X-GNU-PR-Keywords: patch
To: Nicolas Graves <ngraves@HIDDEN>
Cc: 73833 <at> debbugs.gnu.org
Received: via spool by 73833-submit <at> debbugs.gnu.org id=B73833.173090632520364
          (code B ref 73833); Wed, 06 Nov 2024 15:19:02 +0000
Received: (at 73833) by debbugs.gnu.org; 6 Nov 2024 15:18:45 +0000
Received: from localhost ([127.0.0.1]:45068 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1t8hnw-0005IN-LL
	for submit <at> debbugs.gnu.org; Wed, 06 Nov 2024 10:18:45 -0500
Received: from eggs.gnu.org ([209.51.188.92]:38396)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ludo@HIDDEN>) id 1t8hnu-0005I8-1o
 for 73833 <at> debbugs.gnu.org; Wed, 06 Nov 2024 10:18:43 -0500
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 <ludo@HIDDEN>)
 id 1t8hlg-0005KS-Rl; Wed, 06 Nov 2024 10:16:24 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To:
 From; bh=SQ7kXClpaNYrkL8CFPZOppNfTjaJZFZ09cfMz8rEf2g=; b=BRL795mydgzFuNDQR4xk
 1DubaNZdNgpadTVdw23syCmlZ5v8SYgnux4rRLgnoHmzmTJB3HP2MDmuL+7989O4yhhies5UfsHeS
 59thDmPJV6GVFWJCjI+bwD9g8LdmdkwGRd5Z3nPyEq3cT2QwyDGnKGFeoeoNCo3i1K2EZFLIap9Lc
 werhdvQW5wHuH0VFoT3BX2xBk7uGpuKldgQVHSrm2Xki3TsPpkdnBNGJx6WBKM/Jvhqn+t+fqEIk4
 dyDOApWiv1yGuenm5BjDDTvgjF9UAeS99yu2I0LFqBuA+xQwSH/KXZPNwJD8CIstMjyGgRD7TqQye
 7WxotWTxvL8c2Q==;
From: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN>
In-Reply-To: <20241017223308.27941-2-ngraves@HIDDEN> (Nicolas Graves's
 message of "Fri, 18 Oct 2024 00:25:57 +0200")
References: <20241017223308.27941-1-ngraves@HIDDEN>
 <20241017223308.27941-2-ngraves@HIDDEN>
Date: Wed, 06 Nov 2024 16:16:18 +0100
Message-ID: <87zfmcwfy5.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.3 (--)
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: -3.3 (---)

Hi,

Nice patch series!

Nicolas Graves <ngraves@HIDDEN> skribis:

> * guix/import/utils.scm: (git->origin): Add function.
>
> * guix/import/elpa.scm
> (download-git-repository): Remove function download-git-repository.
> (git-repository->origin): Remove function git-repository->origin.
> (ref): Add function ref.
> (melpa-recipe->origin): Use functions git->origin and ref.
>
> * guix/import/go.scm
> (git-checkout-hash): Remove function git-checkout-hash.
> (transform-version): Add function transform-version.
> (vcs->origin): Use functions git->origin and transform-version. Add
> optional argument transform-version.
>
> * tests/import/go.scm
> (go-module->guix-package): Adapt test case to changes in guix/import/go.s=
cm.
>
> * guix/import/minetest.scm
> (download-git-repository): Remove function download-git-repository.
> (make-minetest-sexp): Use function git->origin.
>
> * tests/minetest.scm
> (make-package-sexp): Use function git->origin.
> (example-package): Adapt test-case to git->origin.
>
> * guix/import/composer.scm
> (make-php-sexp): Use function git->origin.
>
> Change-Id: Ied05a63bdd60fbafe26fbbb4e115ff6f0bb9db3c

[=E2=80=A6]

> +(define (ref recipe)
> +  "Create REF from MELPA RECIPE."

More like: "Return a value suitable for the 'update-cached-checkout'
#:ref argument corresponding to RECIPE, a MELPA recipe alist."

> +;; This is done because the version field of the package, which the gene=
rated
> +;; quoted expression refers to, has been stripped of any 'v' prefixed.
> +(define (transform-version version)

Please add a docstring.

> -  ;; Use a custom cache to avoid cluttering the default one under
> -  ;; ~/.cache/guix, but choose one under /tmp so that it's persistent ac=
ross
> -  ;; subsequent "guix import" invocations.
> -  (mkdir-p cache)
> -  (chmod cache #o700)
> -  (let-values (((checkout commit _)
> -                (parameterize ((%repository-cache-directory cache))
> -                  (update-cached-checkout url

Looks like this bit and its rationale in (guix import go) gets lost
here: =E2=80=98git->origin=E2=80=99 unconditionally uses ~/.cache, which me=
ans that
=E2=80=98guix import go -r =E2=80=A6=E2=80=99 would fill that directory.

Could we restore that behavior, probably as an option to =E2=80=98git->orig=
in=E2=80=99?

> +control system is being used. Optionally use the function TRANSFORM-VERS=
ION
> +which takes version as an input."

Two spaces after end-of-sentence period please.  :-)

=E2=80=9CCall TRANSFORM-VERSION with VERSION as an argument to compute the
downstream version number.=E2=80=9D

You can have #:key (transform-version identity) and call it
unconditionally (that is, it would always be a procedure, never #f).

> +(define* (git->origin repo-url ref #:key (ref->commit #f))
> +  "Returns a generated `origin' block of a package depending on the git =
source
> +control system, and the directory in the store where the package has been
> +downloaded, in case further processing is necessary.  REPO-URL or REF ca=
n be
> +null. REF->COMMIT can be a function or #t, in which case the commit matc=
hing
> +ref is used. If REF->COMMIT is not used, the value inside REF is used."

s/function/procedure/

> +  (let* ((version (and (pair? ref) (cdr ref)))
> +         (directory commit
> +                    (if version
> +                        (with-store store
> +                          (latest-repository-commit store repo-url
> +                                                    #:ref (if version re=
f '())))
> +                        (values #f #f)))
> +         (vcommit (match ref->commit
> +                    (#t    commit)
> +                    (#f    version)
> +                    ((? procedure?) (ref->commit version))
> +                    (_     #f))))

Weird semantics for =E2=80=98ref->commit=E2=80=99.  Could it not always be =
a procedure?

Also, s/vcommit/commit-string/ or something.  See the coding style
regarding identifiers (info "(guix) Formatting Code").

Likewise, could you remove uses of car/cdr in this patch set, at least
for new code (info "(guix) Data Types and Pattern Matching")?

Ludo=E2=80=99.




Message sent to guix-patches@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: [bug#73833] [PATCH v2 3/5] guix: import: composer: Improve importer.
Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: guix-patches@HIDDEN
Resent-Date: Wed, 06 Nov 2024 15:42:02 +0000
Resent-Message-ID: <handler.73833.B73833.173090768324351 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 73833
X-GNU-PR-Package: guix-patches
X-GNU-PR-Keywords: patch
To: Nicolas Graves <ngraves@HIDDEN>
Cc: 73833 <at> debbugs.gnu.org
Received: via spool by 73833-submit <at> debbugs.gnu.org id=B73833.173090768324351
          (code B ref 73833); Wed, 06 Nov 2024 15:42:02 +0000
Received: (at 73833) by debbugs.gnu.org; 6 Nov 2024 15:41:23 +0000
Received: from localhost ([127.0.0.1]:45135 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1t8i9q-0006Kg-U6
	for submit <at> debbugs.gnu.org; Wed, 06 Nov 2024 10:41:23 -0500
Received: from eggs.gnu.org ([209.51.188.92]:50232)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ludo@HIDDEN>) id 1t8i9o-0006KR-9q
 for 73833 <at> debbugs.gnu.org; Wed, 06 Nov 2024 10:41:21 -0500
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 <ludo@HIDDEN>)
 id 1t8i9h-0004zJ-AD; Wed, 06 Nov 2024 10:41:13 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To:
 From; bh=lhaXXl0p+MgPlfvlM39WN1YJw0D72QdgNb0MQVKS1gU=; b=TUEJpH5xqbegHsChoHNS
 wkmmznVGL4Zt/7dOYQrcEKEFnvvIidws4vQjLd91xaqT4dW9hoBRJ8aY1VqQ6MhyQ+AVtidRpqH72
 ElKTWNcAOZS5v0a0v0W6OqKTbqkPnZAbAv9vR2I6Vy73xFQ+ZDAau+OZwJ9i2YNAmbSZswt73PWpO
 pYYNMRw0XraovOp4bWDyp9JTqO2u+NAB4XlBmdT/sWjIH6INywH2/tGsMP5/gVpZR3S1nHcUm8Ee9
 9lAgCr3Mbl7fcxlfDTnfQZ6Dd3ED5W1UpNcvyPek56G01MtT+gsQmMG9h5ko+w6r0VJBZf6CFGgzN
 Emwiea90ccVXSg==;
From: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN>
In-Reply-To: <20241017223308.27941-4-ngraves@HIDDEN> (Nicolas Graves's
 message of "Fri, 18 Oct 2024 00:25:59 +0200")
References: <20241017223308.27941-1-ngraves@HIDDEN>
 <20241017223308.27941-4-ngraves@HIDDEN>
Date: Wed, 06 Nov 2024 16:41:10 +0100
Message-ID: <87r07owesp.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.3 (--)
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: -3.3 (---)

Nicolas Graves <ngraves@HIDDEN> skribis:

> * guix/import/composer.scm
> (%composer-base-url): Move from here...
> (%packagist-base-url): ...to here.
> (requirements->prefixes): Add variable to read and take advantage of
> version info in composer package requirements and...
> (json->require): ...use it here. Rewrite of the function.
> (composer-source): Add a sanitizer for composer-source-url.
> (select-version): Add variable to select the most recent availble
> version that is above to a given min-version and...
> (composer-fetch): ...use it here. Improve the function.
> (make-php-sexp, composer->guix-package): Adapt to requirements being
> alists now.
> (php-package?): Handle the particular phpunit case.
> (dependency->input): Add min-version and max-version information. This
> is currently limited to the first dependency suggested by
> requirements.
> (import-release): Fix git urls case. This is better but still a bit
> buggy (refreshing can replace the version by a commit).
>
> * tests/composer.scm
> (%composer-base-url): Move from here...
> (%packagist-base-url): ...to here.

[...]

> -(define %composer-base-url
> +(define %packagist-base-url
>    (make-parameter "https://repo.packagist.org"))

It would be best to have this in a separate patch.

> +(define (requirements->prefixes str)
> +  (let* ((processed-str (string-replace-substring str " || " "|"))
> +         (prefix-strs (string-split processed-str #\|)))
> +    (filter-map (match-lambda
> +                  ;; SemVer: ^ indicates major+minor match, not a whole =
match.
> +                  ((? (cut string-prefix? "^" <>) prefix)
> +                   (let ((pfx (string-drop prefix 1)))
> +                     (if (eq? 2 (string-count prefix #\.))
> +                         (string-take pfx (string-rindex pfx #\.))
> +                         pfx)))
> +                  ((? (cut string-suffix? ".*" <>) prefix)
> +                   (string-drop-right prefix 2))
> +                  (_ #f))
> +         prefix-strs)))

Please add a docstring and following the coding style for identifiers.

>  (define-json-mapping <composer-source> make-composer-source composer-sou=
rce?
>    json->composer-source
>    (type      composer-source-type)
> -  (url       composer-source-url)
> +  (url       composer-source-url "url"
> +             (lambda (uri)
> +               (if (string-suffix? ".git" uri)
> +                   (string-drop-right uri 4)
> +                   uri)))

Is it the right place to change things?  I would keep <composer-source>
identical to the information available at packagist.org, and
post-process the URL only where it=E2=80=99s needed.

> +(define* (select-version packages #:key (min-version #f))
> +  "Select the most recent available version in the PACKAGES list
> +that is above or equal to MIN-VERSION. MIN-VERSION can be incomplete
> +(e.g. version-major only)."
> +  (let* ((points (and min-version (string-count min-version #\.)))
> +         (min-prefix (and min-version
> +                          (match points
> +                            ((or 0 1) (fix-version min-version))
> +                            (_ #f)))))
> +    (cdr
> +     (fold
> +      (lambda (new cur-max)
> +        (match new
> +          (((? valid-version? version) . tail)
> +           (let ((valid-version (fix-version version)))
> +             (if (and (version>? valid-version (fix-version (car cur-max=
)))
> +                      (or (not min-prefix)
> +                          (version-prefix? min-prefix valid-version)))
> +                 (cons* version tail)
> +                 cur-max)))
> +          (_ cur-max)))

No car/cdr please, especially since it=E2=80=99s already using =E2=80=98mat=
ch=E2=80=99.

> +  (let* ((version (fix-version (caadr dependency)))
> +         (points (and version (string-count version #\.)))
> +         (max "99"))
> +    (upstream-input
> +     (name (car dependency))
> +     (downstream-name (php-package-name (car dependency)))
> +     (type type)
> +     (min-version (match points
> +                    (0 (string-append version ".0.0"))
> +                    (1 (string-append version ".0"))
> +                    (2 version)
> +                    (_ 'any)))
> +     (max-version (match points
> +                    (0 (string-append version "." max "." max))
> +                    (1 (string-append version "." max))
> +                    (2 version)
> +                    (_ 'any))))))

This thing with =E2=80=98points=E2=80=99 is kinda weird: =E2=80=98version>?=
=E2=80=99 works fine even
when there=E2=80=99s a different number of points in the arguments.

>  (define* (import-release package #:key (version #f))
>    "Return an <upstream-source> for VERSION or the latest release of PACK=
AGE."
>    (let* ((php-name (guix-package->composer-name package))
> -         (composer-package (composer-fetch php-name #:version version)))
> +         (composer-package (composer-fetch php-name #:version version))
> +         (new-version new-version-tag
> +                      (latest-git-tag-version package #: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))))
> +         (urls
> +          (let ((source (composer-package-source composer-package)))
> +            (if (string=3D? (composer-source-type source) "git")
> +                (git-reference
> +                 (url (composer-source-url source))
> +                 (commit (or new-version-tag
> +                             (composer-source-reference source))))
> +                (list (composer-source-url source)))))

This seems to be an unrelated change (supporting fetching source from
Git).  Could it be separated out?

Could you add tests for the new functionality?

It=E2=80=99s important to have good test coverage to help maintain importer=
s in
the long run.

Thanks,
Ludo=E2=80=99.




Message sent to guix-patches@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: [bug#73833] [PATCH v2 4/5] guix: refresh: Keep the version field of each update specification.
Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: guix-patches@HIDDEN
Resent-Date: Wed, 06 Nov 2024 15:49:01 +0000
Resent-Message-ID: <handler.73833.B73833.173090808225411 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 73833
X-GNU-PR-Package: guix-patches
X-GNU-PR-Keywords: patch
To: Nicolas Graves <ngraves@HIDDEN>
Cc: 73833 <at> debbugs.gnu.org
Received: via spool by 73833-submit <at> debbugs.gnu.org id=B73833.173090808225411
          (code B ref 73833); Wed, 06 Nov 2024 15:49:01 +0000
Received: (at 73833) by debbugs.gnu.org; 6 Nov 2024 15:48:02 +0000
Received: from localhost ([127.0.0.1]:45182 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1t8iGI-0006bn-Bz
	for submit <at> debbugs.gnu.org; Wed, 06 Nov 2024 10:48:02 -0500
Received: from eggs.gnu.org ([209.51.188.92]:49780)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ludo@HIDDEN>) id 1t8iGG-0006bJ-W2
 for 73833 <at> debbugs.gnu.org; Wed, 06 Nov 2024 10:48:01 -0500
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 <ludo@HIDDEN>)
 id 1t8iGA-0007SW-DD; Wed, 06 Nov 2024 10:47:54 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To:
 From; bh=s7jwbOT+waaqocvmJhYWHOWf00sLJfX1r2PpsJ3qMYI=; b=bGFP5glBwoM6RGdgWrqA
 BITSuHSAvmoe3tyLHSu1VKjEBeRG02qr3LaCqQ3WS4Fh8d4P2E4jTJMUnEwIvktGdBMk4Q3jy9Iqa
 lL8A8WDbOt7+/4QgV5VPaV/5+FmqEVrBkaRdOXWOF2fpKkO6cT525KGCMSPSGrz2B504wx95XGKMK
 6bmDi8DjMGW0G/Ff6MbiHEzFGCwCI+4D8VCINEBvcVnjcqlnynn4zUW40tiQcaEdTedKCyOfUTmxI
 SODd+h+tZVfBpWQPGPAVry+u1lAG6TKD47nRpJ38gy/mHUGG5W1TslckBEv7fvArx/IWpLYB8SQVc
 MSGGi5gPpuE2Ig==;
From: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN>
In-Reply-To: <20241017223308.27941-5-ngraves@HIDDEN> (Nicolas Graves's
 message of "Fri, 18 Oct 2024 00:26:00 +0200")
References: <20241017223308.27941-1-ngraves@HIDDEN>
 <20241017223308.27941-5-ngraves@HIDDEN>
Date: Wed, 06 Nov 2024 16:47:51 +0100
Message-ID: <87msicwehk.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.3 (--)
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: -3.3 (---)

Nicolas Graves <ngraves@HIDDEN> skribis:

> * guix/scripts/refresh.scm (options->update-specs)[update-specs]: Keep
> the version field of each update specification.  This is done using a
> variable to cache package names and then filter out unwanted candidates.
> ---
>  guix/scripts/refresh.scm | 23 +++++++++++++++++------
>  1 file changed, 17 insertions(+), 6 deletions(-)
>
> diff --git a/guix/scripts/refresh.scm b/guix/scripts/refresh.scm
> index ec7d38c22a..810c33c786 100644
> --- a/guix/scripts/refresh.scm
> +++ b/guix/scripts/refresh.scm
> @@ -310,12 +310,23 @@ (define update-specs
>         some)))
>=20=20
>    (if (assoc-ref opts 'recursive?)
> -      (mlet* %store-monad ((edges (node-edges %bag-node-type (all-packag=
es)))
> -                           (packages -> (node-transitive-edges
> -                                         (map update-spec-package update=
-specs)
> -                                         edges)))
> -        ;; FIXME: The 'version' field of each update spec is lost.
> -        (return (map update-spec packages)))
> +      (mlet* %store-monad
> +          ((edges (node-edges %bag-node-type (all-packages)))
> +           (strict-spec-pkgs -> (map update-spec-package update-specs))
> +           (strict-spec-pkg-names -> (map package-name strict-spec-pkgs))
> +           (packages -> (node-transitive-edges strict-spec-pkgs edges))
> +           (transitive-specs -> (map update-spec packages)))
> +        (return (append update-specs
> +                        (filter-map (match-lambda
> +                                      ((? update? spec)
> +                                       (if (member (package-name
> +                                                    (update-spec-package=
 spec))
> +                                                   strict-spec-pkg-names)
> +                                           spec
> +                                           #f))
> +                                      (_
> +                                       #f))
> +                                    transitive-specs))))

Or just:

  (filter (lambda (spec)
            (member (package-name (update-spec-package spec))
                    package-names))
          transitive-specs)

(IIUC.)

Maybe add a comment explaining that this is to retain the =E2=80=98version=
=E2=80=99
field of UPDATE-SPECS?

Also, check out the guidelines for identifiers.

Thanks,
Ludo=E2=80=99.




Message sent to guix-patches@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: [bug#73833] [PATCH v2 1/5] guix: import: utils: Add function git->origin.
Resent-From: Nicolas Graves <ngraves@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: guix-patches@HIDDEN
Resent-Date: Wed, 06 Nov 2024 17:19:02 +0000
Resent-Message-ID: <handler.73833.B73833.17309135069100 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 73833
X-GNU-PR-Package: guix-patches
X-GNU-PR-Keywords: patch
To: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN>
Cc: 73833 <at> debbugs.gnu.org
Received: via spool by 73833-submit <at> debbugs.gnu.org id=B73833.17309135069100
          (code B ref 73833); Wed, 06 Nov 2024 17:19:02 +0000
Received: (at 73833) by debbugs.gnu.org; 6 Nov 2024 17:18:26 +0000
Received: from localhost ([127.0.0.1]:45321 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1t8jfl-0002Mh-Vv
	for submit <at> debbugs.gnu.org; Wed, 06 Nov 2024 12:18:26 -0500
Received: from 7.mo550.mail-out.ovh.net ([87.98.158.110]:58109)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ngraves@HIDDEN>) id 1t8jfh-0002MW-BH
 for 73833 <at> debbugs.gnu.org; Wed, 06 Nov 2024 12:18:23 -0500
Received: from director8.ghost.mail-out.ovh.net (unknown [10.108.9.217])
 by mo550.mail-out.ovh.net (Postfix) with ESMTP id 4XkBk34klCz1XT3
 for <73833 <at> debbugs.gnu.org>; Wed,  6 Nov 2024 17:18:19 +0000 (UTC)
Received: from ghost-submission-5b5ff79f4f-wmp7v (unknown [10.110.168.217])
 by director8.ghost.mail-out.ovh.net (Postfix) with ESMTPS id DB3941FE9C;
 Wed,  6 Nov 2024 17:18:18 +0000 (UTC)
Received: from ngraves.fr ([37.59.142.104])
 by ghost-submission-5b5ff79f4f-wmp7v with ESMTPSA
 id cN0PGtqkK2dvewAAeCgUqA
 (envelope-from <ngraves@HIDDEN>); Wed, 06 Nov 2024 17:18:18 +0000
Authentication-Results: garm.ovh; auth=pass
 (GARM-104R005d4167a4c-761a-47cf-b0ef-a4ee10e07f08,
 7DA11F85E05AC71F4B07BAB71687C1137F5318AF) smtp.auth=ngraves@HIDDEN
X-OVh-ClientIp: 86.246.19.221
From: Nicolas Graves <ngraves@HIDDEN>
In-Reply-To: <87zfmcwfy5.fsf@HIDDEN>
References: <20241017223308.27941-1-ngraves@HIDDEN>
 <20241017223308.27941-2-ngraves@HIDDEN> <87zfmcwfy5.fsf@HIDDEN>
Date: Wed, 06 Nov 2024 18:18:16 +0100
Message-ID: <87ttck9t7r.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Ovh-Tracer-Id: 11879088442793583187
X-VR-SPAMSTATE: OK
X-VR-SPAMSCORE: -100
X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeefuddrtddvgdeljecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufgjfhffkfggtgfgsehtqhertddttdejnecuhfhrohhmpefpihgtohhlrghsucfirhgrvhgvshcuoehnghhrrghvvghssehnghhrrghvvghsrdhfrheqnecuggftrfgrthhtvghrnhepffduleekjeevteelueffjeefffethffhffeutdettefhleeuleevffejvdfftdffnecukfhppeduvdejrddtrddtrddupdekiedrvdegiedrudelrddvvddupdefjedrheelrddugedvrddutdegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepuddvjedrtddrtddruddpmhgrihhlfhhrohhmpehnghhrrghvvghssehnghhrrghvvghsrdhfrhdpnhgspghrtghpthhtohepuddprhgtphhtthhopeejfeekfeefseguvggssghughhsrdhgnhhurdhorhhgpdfovfetjfhoshhtpehmohehhedtmgdpmhhouggvpehsmhhtphhouhht
DKIM-Signature: a=rsa-sha256; bh=cL5ba9YV54oIy0Z8CSkuW5gmjx1XNa210JJWQQ4xmoE=; 
 c=relaxed/relaxed; d=ngraves.fr; h=From;
 s=ovhmo4487190-selector1; t=1730913499; v=1;
 b=Ec8iSuj5fw7HU3PZGDaaJQ9JldSeVvz0yeFVJHsjlMeBsXlqq97uwDiSbpaZxvVCSeNRzDs/
 ciZzg292tzWxRFN9OS4IqYQyw1fHoNEIfiQMqeXgd2GHYNj9tiFRBEDsDQb7gSCCwEXcXEIAfZu
 drA+h7RUBTvTTNIhsWMypY0YAO8ldGSqsts+RAAkNRsDQ3XxUd0Z/ig5uToHzCaXqP7bU1Rt8OC
 x4NKbcY0nkaOePzg5p8SXjuclUm8BjjdAuuZUHp6R11FkEe4h0+/g0+ISL1I/mWzOzypFdRJmmo
 U/soF0gnc7/VIJGjzFEM1nsVq5QFNfHUXS2/kllrX1HxA==
X-Spam-Score: 0.0 (/)
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: -1.0 (-)

On 2024-11-06 16:16, Ludovic Court=C3=A8s wrote:

> Hi,
>
> Nice patch series!
>
> Nicolas Graves <ngraves@HIDDEN> skribis:

[...]=20

>> -  ;; Use a custom cache to avoid cluttering the default one under
>> -  ;; ~/.cache/guix, but choose one under /tmp so that it's persistent a=
cross
>> -  ;; subsequent "guix import" invocations.
>> -  (mkdir-p cache)
>> -  (chmod cache #o700)
>> -  (let-values (((checkout commit _)
>> -                (parameterize ((%repository-cache-directory cache))
>> -                  (update-cached-checkout url
>
> Looks like this bit and its rationale in (guix import go) gets lost
> here: =E2=80=98git->origin=E2=80=99 unconditionally uses ~/.cache, which =
means that
> =E2=80=98guix import go -r =E2=80=A6=E2=80=99 would fill that directory.
>
> Could we restore that behavior, probably as an option to
> =E2=80=98git->origin=E2=80=99?

Yes, we can.  However, IIRC my rationale was that the alternative used in
every other import module was to use the store (and not ~/.cache IIRC,
since it uses latest-repository-commit instead of
update-cached-checkout) as a cache.  Since we often import/update to
build after that, it seemed quite natural to let the store handle the
cache instead of managing a custom cache for that.

So yes, we loose a bit of functionality, but I think it's more
maintainable this way, if the original author doesn't disagree too much
on that.  WDYT?

[...]

>> +  (let* ((version (and (pair? ref) (cdr ref)))
>> +         (directory commit
>> +                    (if version
>> +                        (with-store store
>> +                          (latest-repository-commit store repo-url
>> +                                                    #:ref (if version r=
ef '())))
>> +                        (values #f #f)))
>> +         (vcommit (match ref->commit
>> +                    (#t    commit)
>> +                    (#f    version)
>> +                    ((? procedure?) (ref->commit version))
>> +                    (_     #f))))
>
> Weird semantics for =E2=80=98ref->commit=E2=80=99.  Could it not always b=
e a
> procedure?

I'll try.=20
>
--=20
Best regards,
Nicolas Graves




Message sent to guix-patches@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: [bug#73833] [Nicolas Graves via Guix-patches via] [bug#73833] [PATCH v2 5/5] guix: refresh: Implement basic upstream-source-inputs rich updates.
Resent-From: Nicolas Graves <ngraves@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: guix-patches@HIDDEN
Resent-Date: Thu, 07 Nov 2024 08:59:01 +0000
Resent-Message-ID: <handler.73833.B73833.173096990616362 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 73833
X-GNU-PR-Package: guix-patches
X-GNU-PR-Keywords: patch
To: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN>
Cc: 73833 <at> debbugs.gnu.org
Received: via spool by 73833-submit <at> debbugs.gnu.org id=B73833.173096990616362
          (code B ref 73833); Thu, 07 Nov 2024 08:59:01 +0000
Received: (at 73833) by debbugs.gnu.org; 7 Nov 2024 08:58:26 +0000
Received: from localhost ([127.0.0.1]:47115 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1t8yLS-0004Fq-8J
	for submit <at> debbugs.gnu.org; Thu, 07 Nov 2024 03:58:26 -0500
Received: from 5.mo575.mail-out.ovh.net ([46.105.62.179]:36793)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ngraves@HIDDEN>) id 1t8yLP-0004Fd-4D
 for 73833 <at> debbugs.gnu.org; Thu, 07 Nov 2024 03:58:25 -0500
Received: from director1.ghost.mail-out.ovh.net (unknown [10.108.2.115])
 by mo575.mail-out.ovh.net (Postfix) with ESMTP id 4XkbZj3Ph2z1qxm
 for <73833 <at> debbugs.gnu.org>; Thu,  7 Nov 2024 08:58:21 +0000 (UTC)
Received: from ghost-submission-5b5ff79f4f-mqnr4 (unknown [10.108.42.21])
 by director1.ghost.mail-out.ovh.net (Postfix) with ESMTPS id B57311FEBF;
 Thu,  7 Nov 2024 08:58:20 +0000 (UTC)
Received: from ngraves.fr ([37.59.142.98])
 by ghost-submission-5b5ff79f4f-mqnr4 with ESMTPSA
 id O/hpDSyBLGcPCAAAzCY54g
 (envelope-from <ngraves@HIDDEN>); Thu, 07 Nov 2024 08:58:20 +0000
Authentication-Results: garm.ovh; auth=pass
 (GARM-98R00282779eb6-aff5-4482-8b72-3791bd33da67,
 2B264539C56665297410E0ABC0C486ED03F6DD63) smtp.auth=ngraves@HIDDEN
X-OVh-ClientIp: 80.214.23.161
From: Nicolas Graves <ngraves@HIDDEN>
In-Reply-To: <87y11w9war.fsf@HIDDEN>
References: <20241017223308.27941-6-ngraves@HIDDEN>
 <87y11w9war.fsf@HIDDEN>
Date: Thu, 07 Nov 2024 09:58:17 +0100
Message-ID: <871pznv2s6.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Ovh-Tracer-Id: 9308096006351020627
X-VR-SPAMSTATE: OK
X-VR-SPAMSCORE: -100
X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeefuddrtdefgdduvdejucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvvefujghffffkgggtsehttdertddttddtnecuhfhrohhmpefpihgtohhlrghsucfirhgrvhgvshcuoehnghhrrghvvghssehnghhrrghvvghsrdhfrheqnecuggftrfgrthhtvghrnhepveekleeujedthefgffekleekhffhffetgfdvheekleeuhfehueeljedtjefhvdfgnecukfhppeduvdejrddtrddtrddupdektddrvddugedrvdefrdduiedupdefjedrheelrddugedvrdelkeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeduvdejrddtrddtrddupdhmrghilhhfrhhomhepnhhgrhgrvhgvshesnhhgrhgrvhgvshdrfhhrpdhnsggprhgtphhtthhopedupdhrtghpthhtohepjeefkeeffeesuggvsggsuhhgshdrghhnuhdrohhrghdpoffvtefjohhsthepmhhoheejhegmpdhmohguvgepshhmthhpohhuth
DKIM-Signature: a=rsa-sha256; bh=+QyK8d5R5SiPLVhnMoOuKIxb7B/0i4Wo97P3AuEjwsE=; 
 c=relaxed/relaxed; d=ngraves.fr; h=From;
 s=ovhmo4487190-selector1; t=1730969901; v=1;
 b=4R4d+T+Xgp3tC+lfPzLB+Aj7DteNEfCTsU7ELySaQVUNjap2245/32u9Jpz1Iqx2nDXg5ThC
 pjvyUCg/UOVBNqEwnbGqZB49hQzzEI+E/nYJ1N5zUKCUrq4eih5XgYY3KcNmVFh9CUc4lDTZiH7
 WG12X2lz4pCzmWZTwcMirT3wJ0EeJM7QzYQBTej2uFL/Po7r89zCp0t3K5rjm/GnIoH70xF1uIw
 CwOPQZLD0tP2F91eKnNDA9Xr/yRj9rSi2GQBWFnX60c45WzoS3ccX9ZKqrPvc9ddHxiCZBk7Hbe
 b5HoNklVKIsAlZJ8pwPip92JuUqQzT9GQUMTtu4We1qwA==
X-Spam-Score: 0.0 (/)
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: -1.0 (-)

On 2024-11-06 17:11, Nicolas Graves wrote:

> Thanks for your review, I'll update the patch series.  Just to let you
> know I've also implemented a more elaborated input->update-spec when
> working on hackage import with versions. Don't bother reviewing this 5/5
> one, I'll update it too which welcome changes from there.

Actually I have some questions about this before reworking further on
that.  As I said, I have also worked on the hackage one, and I come to
think that a single min-version and max-version is probably not the best
way to tackle this.

The reason behind this is that most other package managers are relying
on either semver with carets or >/>=/</<=/==/||/&& operators to resolve
the requirements.  The problem with min-version or max-version currently
is (IIRC) that when we define them, we don't necessarily have an
overview of available versions, and, because of that, it's really
difficult down the line in input->update-spec to properly select a
(targeted!) version. (especially if < or > is used).

Instead we could keep a requirements field, and have a function
(resolve available-versions requirements) that returns the valid
versions among available-versions.  Otherwise I have the impression I'm
playing with hacks just to comply with the min-version and max-version
fields.

WDYT ?

-- 
Best regards,
Nicolas Graves




Message sent to guix-patches@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: [bug#73833] [Nicolas Graves via Guix-patches via] [bug#73833] [PATCH v2 5/5] guix: refresh: Implement basic upstream-source-inputs rich updates.
Resent-From: Nicolas Graves <ngraves@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: guix-patches@HIDDEN
Resent-Date: Thu, 07 Nov 2024 20:15:01 +0000
Resent-Message-ID: <handler.73833.B73833.17310104746499 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 73833
X-GNU-PR-Package: guix-patches
X-GNU-PR-Keywords: patch
To: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN>
Cc: 73833 <at> debbugs.gnu.org
Received: via spool by 73833-submit <at> debbugs.gnu.org id=B73833.17310104746499
          (code B ref 73833); Thu, 07 Nov 2024 20:15:01 +0000
Received: (at 73833) by debbugs.gnu.org; 7 Nov 2024 20:14:34 +0000
Received: from localhost ([127.0.0.1]:49684 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1t98tm-0001gh-60
	for submit <at> debbugs.gnu.org; Thu, 07 Nov 2024 15:14:34 -0500
Received: from 18.mo584.mail-out.ovh.net ([188.165.54.143]:48405)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ngraves@HIDDEN>) id 1t98ti-0001gU-MG
 for 73833 <at> debbugs.gnu.org; Thu, 07 Nov 2024 15:14:32 -0500
Received: from director9.ghost.mail-out.ovh.net (unknown [10.108.25.35])
 by mo584.mail-out.ovh.net (Postfix) with ESMTP id 4XktZs0j8Tz1R8k
 for <73833 <at> debbugs.gnu.org>; Thu,  7 Nov 2024 20:14:28 +0000 (UTC)
Received: from ghost-submission-5b5ff79f4f-kxkdw (unknown [10.110.118.228])
 by director9.ghost.mail-out.ovh.net (Postfix) with ESMTPS id 22CC11FE0A;
 Thu,  7 Nov 2024 20:14:28 +0000 (UTC)
Received: from ngraves.fr ([37.59.142.98])
 by ghost-submission-5b5ff79f4f-kxkdw with ESMTPSA
 id Sh5HN6MfLWe5zAEA0HZX3w
 (envelope-from <ngraves@HIDDEN>); Thu, 07 Nov 2024 20:14:28 +0000
Authentication-Results: garm.ovh; auth=pass
 (GARM-98R002c02e841d-461e-48d0-8e21-7e6334c7ac72,
 2B264539C56665297410E0ABC0C486ED03F6DD63) smtp.auth=ngraves@HIDDEN
X-OVh-ClientIp: 80.215.103.88
From: Nicolas Graves <ngraves@HIDDEN>
In-Reply-To: <871pznv2s6.fsf@HIDDEN>
References: <20241017223308.27941-6-ngraves@HIDDEN>
 <87y11w9war.fsf@HIDDEN> <871pznv2s6.fsf@HIDDEN>
Date: Thu, 07 Nov 2024 21:14:25 +0100
Message-ID: <87bjyqol7i.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Ovh-Tracer-Id: 2279947315309634131
X-VR-SPAMSTATE: OK
X-VR-SPAMSCORE: -100
X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeefuddrtdeggddufeefucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvvefujghffffkgggtsehttdertddttddtnecuhfhrohhmpefpihgtohhlrghsucfirhgrvhgvshcuoehnghhrrghvvghssehnghhrrghvvghsrdhfrheqnecuggftrfgrthhtvghrnhepveekleeujedthefgffekleekhffhffetgfdvheekleeuhfehueeljedtjefhvdfgnecukfhppeduvdejrddtrddtrddupdektddrvdduhedruddtfedrkeekpdefjedrheelrddugedvrdelkeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeduvdejrddtrddtrddupdhmrghilhhfrhhomhepnhhgrhgrvhgvshesnhhgrhgrvhgvshdrfhhrpdhnsggprhgtphhtthhopedupdhrtghpthhtohepjeefkeeffeesuggvsggsuhhgshdrghhnuhdrohhrghdpoffvtefjohhsthepmhhoheekgegmpdhmohguvgepshhmthhpohhuth
DKIM-Signature: a=rsa-sha256; bh=Hhu4Q1lP0Uou4aP6Lk34SKXkHkXIn+AwsnZGf+abw7w=; 
 c=relaxed/relaxed; d=ngraves.fr; h=From;
 s=ovhmo4487190-selector1; t=1731010469; v=1;
 b=S+Sqg5W3konmz0FksLciBqbWT3IKCDNOYg8KKpjVLarVSBXrH2BwvN54kLeNeCyIgsqLFPtm
 n7Ea+UzyMp6I2lYA8Sjdu+lMdlk1v9v6xQtYy6uRsish9UcJ2vJzgj2mxSU630g6s9/NJfWK6lz
 brxwj+cQzHf5bEaOPBeht/kfn11Kt9pEKQIrBmCTyzVBYHzw0ls6Ay81sEipcP+cyqbh9t0wSwv
 HNy2gvOuXYseeNdTxjTJy4mF9KgN1MiZRZ3oTMGltIJIMHPJwqtTP2IQXlDopfLwWZSvbzgN/Mc
 VeGJzZ06/iBNRnMoVAComPzCnT/XTlRhMWwCuYPJ6cgZg==
X-Spam-Score: 0.0 (/)
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: -1.0 (-)

On 2024-11-07 09:58, Nicolas Graves via Guix-patches via wrote:

> On 2024-11-06 17:11, Nicolas Graves wrote:
>
>> Thanks for your review, I'll update the patch series.  Just to let you
>> know I've also implemented a more elaborated input->update-spec when
>> working on hackage import with versions. Don't bother reviewing this 5/5
>> one, I'll update it too which welcome changes from there.
>
> Actually I have some questions about this before reworking further on
> that.  As I said, I have also worked on the hackage one, and I come to
> think that a single min-version and max-version is probably not the best
> way to tackle this.
>
> The reason behind this is that most other package managers are relying
> on either semver with carets or >/>=/</<=/==/||/&& operators to resolve
> the requirements.  The problem with min-version or max-version currently
> is (IIRC) that when we define them, we don't necessarily have an
> overview of available versions, and, because of that, it's really
> difficult down the line in input->update-spec to properly select a
> (targeted!) version. (especially if < or > is used).
>
> Instead we could keep a requirements field, and have a function
> (resolve available-versions requirements) that returns the valid

Actually now that I dig in cve.scm, I see that we already have a rich
logic defined for such version management, and that we can probably have
for every importer a converter to the >/>=/</<=/==/or/and requirements
logic in cve.scm and use the version-matches? function there.

Will have to try that, but I think it's a rather good direction to dig
in.  The only thing is that when we call input->update-spec, we probably
don't know which versions are available, though we could also
provide a way to fetch that properly for most if not all importers.

> versions among available-versions.  Otherwise I have the impression I'm
> playing with hacks just to comply with the min-version and max-version
> fields.
>
> WDYT ?

-- 
Best regards,
Nicolas Graves




Message sent to guix-patches@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: [bug#73833] [PATCH v2 1/5] guix: import: utils: Add function git->origin.
Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: guix-patches@HIDDEN
Resent-Date: Fri, 29 Nov 2024 13:07:01 +0000
Resent-Message-ID: <handler.73833.B73833.173288556928606 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 73833
X-GNU-PR-Package: guix-patches
X-GNU-PR-Keywords: patch
To: Nicolas Graves <ngraves@HIDDEN>
Cc: 73833 <at> debbugs.gnu.org
Received: via spool by 73833-submit <at> debbugs.gnu.org id=B73833.173288556928606
          (code B ref 73833); Fri, 29 Nov 2024 13:07:01 +0000
Received: (at 73833) by debbugs.gnu.org; 29 Nov 2024 13:06:09 +0000
Received: from localhost ([127.0.0.1]:41448 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tH0hF-0007RK-FD
	for submit <at> debbugs.gnu.org; Fri, 29 Nov 2024 08:06:09 -0500
Received: from eggs.gnu.org ([209.51.188.92]:35596)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ludo@HIDDEN>) id 1tH0hD-0007R5-2D
 for 73833 <at> debbugs.gnu.org; Fri, 29 Nov 2024 08:06:08 -0500
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 <ludo@HIDDEN>)
 id 1tH0h1-0000YI-QR; Fri, 29 Nov 2024 08:05:57 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To:
 From; bh=/p0VM10gaylN2b4PiDpVPokJoUCycT0oWpGcZbtn4nE=; b=pB1b+m1MNH1AG3mGHc5B
 HtdjENXjsTiwvZkFk4ilG39bIAB+QM0XlrFIiBydu9dbw+NCi2gQcgNzxOc77SzTDd3wFgphSjOrw
 X5sKal4yl7M8qFLRN2LrdSIS8gEj+Zc+1nYgTuTFYPqeMn2CKRu6w7npjq5+bnGK1fqITDTofmzbb
 M2V7Uw7Ov/t1mgtFDz1EPyviR2zi5Rvc+GR4tI4gK7Gr8T5z47n9LylBknjbLRVr35LHtYlgNlkbp
 gVE/Nx4lgBuZv9GNifkLRRq1ChS/ShHZ+ajBp9wOpslAt2WKG3UhHOArD8mn0B9U+mx041glaOOeC
 60dZdssA/5Wfew==;
From: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN>
In-Reply-To: <87ttck9t7r.fsf@HIDDEN> (Nicolas Graves's message of "Wed, 06
 Nov 2024 18:18:16 +0100")
References: <20241017223308.27941-1-ngraves@HIDDEN>
 <20241017223308.27941-2-ngraves@HIDDEN> <87zfmcwfy5.fsf@HIDDEN>
 <87ttck9t7r.fsf@HIDDEN>
Date: Fri, 29 Nov 2024 14:05:52 +0100
Message-ID: <87a5di2nrj.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.3 (--)
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: -3.3 (---)

Hi,

Nicolas Graves <ngraves@HIDDEN> skribis:

> On 2024-11-06 16:16, Ludovic Court=C3=A8s wrote:

[...]

>>> -  ;; Use a custom cache to avoid cluttering the default one under
>>> -  ;; ~/.cache/guix, but choose one under /tmp so that it's persistent =
across
>>> -  ;; subsequent "guix import" invocations.
>>> -  (mkdir-p cache)
>>> -  (chmod cache #o700)
>>> -  (let-values (((checkout commit _)
>>> -                (parameterize ((%repository-cache-directory cache))
>>> -                  (update-cached-checkout url
>>
>> Looks like this bit and its rationale in (guix import go) gets lost
>> here: =E2=80=98git->origin=E2=80=99 unconditionally uses ~/.cache, which=
 means that
>> =E2=80=98guix import go -r =E2=80=A6=E2=80=99 would fill that directory.
>>
>> Could we restore that behavior, probably as an option to
>> =E2=80=98git->origin=E2=80=99?
>
> Yes, we can.  However, IIRC my rationale was that the alternative used in
> every other import module was to use the store (and not ~/.cache IIRC,
> since it uses latest-repository-commit instead of
> update-cached-checkout) as a cache.  Since we often import/update to
> build after that, it seemed quite natural to let the store handle the
> cache instead of managing a custom cache for that.
>
> So yes, we loose a bit of functionality, but I think it's more
> maintainable this way, if the original author doesn't disagree too much
> on that.  WDYT?

=E2=80=98latest-repository-commit=E2=80=99 calls =E2=80=98update-cached-che=
ckout=E2=80=99 to first get a
copy of the repo under ~/.cache, and then import it into the store.

So I think the functionality remains relevant.

I=E2=80=99ve just used =E2=80=9Cguix import go -r code.forgejo.org/forgejo=
=E2=80=9D and it ran
out of disk space after filling /tmp with repos (!).  The fact that it=E2=
=80=99s
in /tmp means I can easily remove it; otherwise I=E2=80=99d have to wipe al=
l of
~/.cache/guix/checkouts, but that=E2=80=99d be inconvenient (my next
pull/time-machine would have to re-clone the Guix repo, for instance).

Ludo=E2=80=99.





Last modified: Sun, 12 Jan 2025 05:45:02 UTC

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