From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id QOBCAXyCoWMqDwEAbAwnHQ (envelope-from ) for ; Tue, 20 Dec 2022 10:38:04 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id AJI1AXyCoWNmQwAA9RJhRA (envelope-from ) for ; Tue, 20 Dec 2022 10:38:04 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 80773F427 for ; Tue, 20 Dec 2022 10:38:03 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p7Z2r-00056W-MW; Tue, 20 Dec 2022 04:36:21 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p7Z1g-0004fZ-AX for guix-patches@gnu.org; Tue, 20 Dec 2022 04:35:12 -0500 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p7Z1g-0002vn-0r for guix-patches@gnu.org; Tue, 20 Dec 2022 04:35:08 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p7Z1f-0003Rg-SX for guix-patches@gnu.org; Tue, 20 Dec 2022 04:35:07 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#57460] [PATCH v3 09/18] import: git: Allow updating to a specific version. Resent-From: Hartmut Goebel Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 20 Dec 2022 09:35:07 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57460 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch moreinfo To: 57460@debbugs.gnu.org Received: via spool by 57460-submit@debbugs.gnu.org id=B57460.167152890213144 (code B ref 57460); Tue, 20 Dec 2022 09:35:07 +0000 Received: (at 57460) by debbugs.gnu.org; 20 Dec 2022 09:35:02 +0000 Received: from localhost ([127.0.0.1]:43743 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p7Z1Z-0003Po-EO for submit@debbugs.gnu.org; Tue, 20 Dec 2022 04:35:02 -0500 Received: from mout.kundenserver.de ([217.72.192.74]:35623) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p7Z1O-0003Ok-U5 for 57460@debbugs.gnu.org; Tue, 20 Dec 2022 04:34:51 -0500 Received: from hermia.goebel-consult.de ([87.176.134.225]) by mrelayeu.kundenserver.de (mreue109 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MAORp-1p1HcU1HKN-00Bri2 for <57460@debbugs.gnu.org>; Tue, 20 Dec 2022 10:34:45 +0100 Received: from thisbe.goebel-consult.de (hermia.goebel-consult.de [192.168.110.7]) by hermia.goebel-consult.de (Postfix) with ESMTP id BDC34669A4; Tue, 20 Dec 2022 10:34:23 +0100 (CET) From: Hartmut Goebel Date: Tue, 20 Dec 2022 10:34:14 +0100 Message-Id: X-Mailer: git-send-email 2.30.6 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K1:t5ih020ghzFPutTDAk2J0eNwXsPC6UEGopjofTNi49bkVXVYfce sI/dgKLb/E5XiQAz5ksvf8tQ1ABbzo8JNSDTymQxLGC0d+mDEtXJMpBp48muBMbLpgeCsNR 0eMD4Q8aksPgfDwCch/FaOsXxKwwfKFgO/8M17yun0OCLRMF9lvja1luwcbZvlzrYbiWqFy tmU1MgFblCUn2lCqkGOTg== UI-OutboundReport: notjunk:1;M01:P0:CxiNzNtdGms=;QaThMoGOegf54jNF175gTBGI8fY Zq9aNTpU0JvN5fIHRQrScr42G4T3cgjD/MNp17XNfQGQRsObqGxCWzHCNRnxisZPg+Nd/BrW5 6Q2dB5KpAhm4Zz0x7jMvDZcmmJl6x51+pMMhgEJvwxWlxzzv7aZzqZ7GdS9sfcxsBntesNePY 5f4FoqWL0oUooZATarFH/QrtjBAfgWMcpyOlt/FUouhFQeM7T2TuuDi9c5naixwJx3+3DUvjh HmKAbEHFdOYNos0z0YekEwha5Mv45gTwu3lPJjjwJff/hCNNmFDc93iiWPTrRllw44QT7OE+h k5aVnwBiEgLq/Z8NpY1Kbr16h3w/S/0gwKUC0pnQw3xJxkuutjpIz0oNRZU0i6sMIZKDEV8LI GbK5t7hGS/cmmhxXEAdKq1nxcUqkGVOCOvdjgPgLcXubdZ9CUB7RscCkfi6EcmhF0L5bXqrUH LAVaIrI+iwQ4O0ywztTAIvycPyc+LMa6SxcB18/ES7QsusJi7ngeBUWSuMgPXBsAhtGOQ1GQW ZGLQIdXo98UBhvJSEJ6OwUC88tkQessDNSOrpKrEuKhbHN75YpE+grPd0aMUpSMbsq3ijU+Ne OW15j5itIIcpJXAeu6Wh/P/7LUpfXHw/XKkvuTSYDo1fyQaCq6y6f+jCYThredKG5uFu+myv2 jZrc12aSETexWYOOjFEWR9vjHBEwHuwjLvZT0bWCoA== X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=none ARC-Seal: i=1; s=key1; d=yhetil.org; t=1671529083; a=rsa-sha256; cv=none; b=MVA0B3H3WnHiLiAIutUdC/4BnnjVh4Z0lNbZyed/3BRrAZKrNdB4Ra3S+NqIfSEB5C/bY2 NG50e+unRVOP69PPd1Gb7bAolpNmA86zQfoSkxx6WHXH1OPKvRYCCeSRwtpUCBvoQDj7Xs xrERniW4xUgu4y8RURnAmipSt8kFhP08/PO9s8m8w/a2nNTFC4ISbdLHkGztWWxKgtTWAq cBD2TUG0DoBpf/iqNrbVXA434GzpSsIMArQHkg+Wcg5EUGw9YG2DXR+W5x9ypZfkzNaydm ChSBBWW7khG4CWlTm8+obncYXxMv0vx0sfif0eTQrcorfpV8Bs2+1rE4ta/TeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1671529083; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post; bh=JXQlVLrWuVseY3yRp10lrJkN3iIrrrZxr+fleGg2WmI=; b=RHCFESTCo2RQlj2yhDQTM5W0pjwrE/bwU+4wjLAZpZpNEcTgsV12mwCkd8IPA+qqTWAzoS KtSg+ISL53nFsClDgQa//Wz2X9pU+4l2GivPD52+zScPljLsdscycN/mUxRkesoUEPss2e Kyjequ0XljRvpTGzbp2nQZuJtr7kh6Tp1sc4IoS0UnDTrQ1azhZzgZwbABofNqkHz7sgOb HFNLpkaG1rL8cSiEyoA/liKNG3IbK/1RY+m2BM32uRKS8pww+NXflIhxEObHoWvoQvleYH 7S81kMhY3f+OEJB4bYIKQIcTTKjXAqPd4ENvoOTMi1AufRbc4SMZOqplTjFdCQ== X-Migadu-Scanner: scn0.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=none X-Migadu-Spam-Score: -2.99 X-Spam-Score: -2.99 X-Migadu-Queue-Id: 80773F427 X-TUID: Dy7h0Dt5f849 * guix/import/git.scm (latest-tag): Add #:version argument. If version is given, try to find the respective version tag. (latest-git-tag-version): Add #:version argument and pass it on to called functions. (latest-releease) Rename to 'import-release', add #:version argument and pass it on to called functions. --- guix/import/git.scm | 39 +++++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/guix/import/git.scm b/guix/import/git.scm index bb5ba4d97e..c15943bd7c 100644 --- a/guix/import/git.scm +++ b/guix/import/git.scm @@ -2,6 +2,7 @@ ;;; Copyright © 2021 Xinglu Chen ;;; Copyright © 2021 Sarah Morgensen ;;; Copyright © 2022 Maxime Devos +;;; Copyright © 2022 Hartmut Goebel ;;; ;;; This file is part of GNU Guix. ;;; @@ -146,9 +147,11 @@ version corresponding to the tag, and the cdr is the name of the tag." tags) entry tag) %pre-release-rx)) @@ -169,13 +172,22 @@ repository at URL." ((null? versions->tags) (git-no-valid-tags-error)) (else - (match (last versions->tags) - ((version . tag) - (values version tag))))))) - -(define (latest-git-tag-version package) + (let ((versions (if version + (filter (match-lambda + ((candidate-version . tag) + (string=? version candidate-version))) + versions->tags) + versions->tags))) + (if (null? versions) + (values #f #f) + (match (last versions) + ((version . tag) + (values version tag))))))))) + +(define* (latest-git-tag-version package #:key (version #f)) "Given a PACKAGE, return the latest version of it and the corresponding git -tag, or #false and #false if the latest version could not be determined." +tag, or #false and #false if the latest version could not be determined. +Optionally include a VERSION string to fetch a specific version." (guard (c ((or (git-no-tags-error? c) (git-no-valid-tags-error? c)) (warning (or (package-field-location package 'source) (package-location package)) @@ -193,6 +205,7 @@ tag, or #false and #false if the latest version could not be determined." (url (git-reference-url (origin-uri source))) (property (cute assq-ref (package-properties package) <>))) (latest-tag url + #:version version #:prefix (property 'release-tag-prefix) #:suffix (property 'release-tag-suffix) #:delim (property 'release-tag-version-delimiter) @@ -206,12 +219,14 @@ tag, or #false and #false if the latest version could not be determined." (git-reference? (origin-uri origin)))) (_ #f))) -(define (latest-git-release package) - "Return an for the latest release of PACKAGE." +(define* (import-git-release package #:key (version #f)) + "Return an for the latest release of PACKAGE. +Optionally include a VERSION string to fetch a specific version." (let* ((name (package-name package)) (old-version (package-version package)) (old-reference (origin-uri (package-source package))) - (new-version new-version-tag (latest-git-tag-version package))) + (new-version new-version-tag + (latest-git-tag-version package #:version version))) (and new-version new-version-tag (upstream-source (package name) @@ -226,4 +241,4 @@ tag, or #false and #false if the latest version could not be determined." (name 'generic-git) (description "Updater for packages hosted on Git repositories") (pred git-package?) - (import latest-git-release))) + (import import-git-release))) -- 2.30.6