From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.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 SFd6HbZrC2NPugAAbAwnHQ (envelope-from ) for ; Sun, 28 Aug 2022 15:20:54 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id iJOQHLZrC2O/zQAAG6o9tA (envelope-from ) for ; Sun, 28 Aug 2022 15:20:54 +0200 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 F0F7223CA1 for ; Sun, 28 Aug 2022 15:20:53 +0200 (CEST) Received: from localhost ([::1]:46714 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oSIDd-000477-0m for larch@yhetil.org; Sun, 28 Aug 2022 09:20:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59402) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oSICs-0002q3-TB for guix-patches@gnu.org; Sun, 28 Aug 2022 09:20:06 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:39837) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oSICs-0002ef-KE for guix-patches@gnu.org; Sun, 28 Aug 2022 09:20:06 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oSICs-0006yM-Fa for guix-patches@gnu.org; Sun, 28 Aug 2022 09:20:06 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#57460] [PATCH 08/20] refresh: Allow updating to a specific version (git) Resent-From: Hartmut Goebel Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 28 Aug 2022 13:20:06 +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 To: 57460@debbugs.gnu.org Received: via spool by 57460-submit@debbugs.gnu.org id=B57460.166169275926559 (code B ref 57460); Sun, 28 Aug 2022 13:20:06 +0000 Received: (at 57460) by debbugs.gnu.org; 28 Aug 2022 13:19:19 +0000 Received: from localhost ([127.0.0.1]:57781 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oSIC6-0006u7-Nq for submit@debbugs.gnu.org; Sun, 28 Aug 2022 09:19:19 -0400 Received: from mout.kundenserver.de ([212.227.17.10]:46849) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oSIC1-0006sz-Vf for 57460@debbugs.gnu.org; Sun, 28 Aug 2022 09:19:14 -0400 Received: from hermia.goebel-consult.de ([46.87.137.46]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MtOX2-1pHVAL3q8c-00uu6c for <57460@debbugs.gnu.org>; Sun, 28 Aug 2022 15:19:07 +0200 Received: from lenashee.fritz.box (lenashee.goebel-consult.de [192.168.110.2]) by hermia.goebel-consult.de (Postfix) with ESMTP id D076865A3A; Sun, 28 Aug 2022 15:18:55 +0200 (CEST) From: Hartmut Goebel Date: Sun, 28 Aug 2022 15:18:34 +0200 Message-Id: X-Mailer: git-send-email 2.30.4 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K1:geru7qQfw13bFNoFDMDerTnXHUgMdCsmemtrIJ1PcnPFSB5Wxt6 GiASyotvnOFnz80M8b0+zeNVS+BtmLDNl02XwVUK9cXb+xZfGurblfj0P4o00nvRFA0Pu7M DkrNIL1WxZ+oLGDoqcOt7wPq6Kj6zFHkJ7uR+sA7O2RWWd7Hyab0lK2IURHPiBNcWrimwHb Gi/mrWSIF4KnLxmLLCjVg== X-UI-Out-Filterresults: notjunk:1;V03:K0:t5VATJLeJ+Q=:CejxlN3BrksAyx2CoCx9Qg 1VVKSi9FfbNsVeBsMxU3DvVw9d5G/d4RXiX1fPAB2jvQKzfJsg1vSq+FBU4UF9Acsr65rj+5v SVXI2w/1PRFhiLOyxdE81/yVnMOqfe0ejZhdwH9W6yJPU7pNTCp6Vnb1/PesAQyYb+kYHrks0 yhMdQSopnoV4afPRNX2INXmO9HruDOxJbW0bjt3RndPkF8R2Y+cKGDESJ1UoXe0WXX1RtFVUG gDdXbkjJMAM6DorMD4TnPShPMqdqUoWRvrtPpfmDukaJ/mtt4GD/86IfbJAtb+uB4xo9kwiZq wT3FeSwOthJd6pxVkUMsdRf98JxMnQMQJBjnUZow8PFFdTchtgilOxKvKbEIw341kLfqNdmm4 hDeeRFZRKYEVpKeR7rdBDTyKAVGWnmn4ubfhcAzlCJ4GsXHz1sc+PCkn71k+tB0iHChPOoPva BmoIPixRZBoBdeX1L8wbTQdnluBXB96YQS6xFBbr6akAxYggZlkUZuNsA7gQfymP2gI1TB1P+ rFMp8Zli6esjPJ7148k2yWovspGyNkU2Al28EXUiPtfYBTN0Ayy2nfkhePeZH6I1bnIJmKP/b dy+bBu8/c86BtMcvIOsjkDOiZoaA2XlaYbQ16IgbI1ZkwMPAEqgFxI1wOkzzTpKoclMduh+og 6dnCyVmq9G0cAe6mYMcNZy0j92nf/lcetOPU58CsPEKG3JJIuy8NkzAVw7xcPv7ySDH/4uFlK Ku060t/Cw2x2CgWsDFouB84ZL6DCwVCOe45n+RHAr/+KuzwGUKplq4HVlcg= 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" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1661692854; 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=MGbLo1u24U8RKLz/SZNg9rQBmEZGA1YRDe/vhwe52h8=; b=TSPdXawNNyzuuYRxxqjKLNhNjehPZ+hsGWex1O4gcS3X4NoyradBEhsr2KfEKPae9noX7T 6MrKykei3gfV8eeVOfWsjImoQSzjJwNd4H4wOcmi1fccxakvSogjP3KmZNqQt8q0Qa6tHx sQ/TmAevLjg17ZKjjYMJUpryEIv5BtL9hVrDY6ZHoQVMHP4m9QFHTkMC+egQid2UDw8PuC kfMbPIpbY/An7EaH78U0xeMxNwaXFxO611YkpRiEwlKdJarNHwmMZQPGkBxY1sL+WqX1Cc 78O/UB63PSorSY0Ekg0xpYRvamV7k3H/wgKjpBfeDXtKWGirbZQJFpaD5UAUpQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1661692854; a=rsa-sha256; cv=none; b=aHyw9JUSxEOQFBzG+9FEKxLvWzyPiaVd9pO6ACeVUXQyNZ/L2q2lQYkCgLOeSsLOgazado 6YDOUGjoLY+y+mM4O2lE1LtS52Ke4Uti8i7BSlX/A/Jt3QcL3ZOlFN7R4bpedmZ5tOqREf moPxv8E3NcqFA53Ao8JW1fLmSoqJdowKaadPEgHfT11FaoXas2LP+vlzq6RZgKBcBHr5RM OYOxeF82aGbNHwrNBAM5Lc84u0C63XvBr5vVYyFwHvm8Fi48mglaH6UUYZB3Dj6AOzjWgm ewb36N/uXh46VhoDzrHjRRIkEt+IWKDecZFD5T5JKuNlHzrupDufVsC8ZV2G9Q== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=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" X-Migadu-Spam-Score: -1.30 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=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" X-Migadu-Queue-Id: F0F7223CA1 X-Spam-Score: -1.30 X-Migadu-Scanner: scn0.migadu.com X-TUID: p+tesouWAoRh * guix/import/git.scm (latest-tag): Add keyword-argument 'version'. If version is given, try to find the respective version tag. (latest-git-tag-version): Add keyword-argument 'version' and pass it on to called functions. (latest-releease) Rename to (import-release), add keyword-argument 'version' and pass it on to called functions. --- guix/import/git.scm | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/guix/import/git.scm b/guix/import/git.scm index bb5ba4d97e..fdac51edfd 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,7 +147,8 @@ version corresponding to the tag, and the cdr is the name of the tag." tags) entrytags) (git-no-valid-tags-error)) (else - (match (last versions->tags) - ((version . tag) - (values version tag))))))) - -(define (latest-git-tag-version package) + (let ((version-to-pick + (if version + (filter (lambda (vt) (string=? version (car vt))) + versions->tags) + versions->tags))) + (if (null? version-to-pick) + (values #f #f) + (match (last version-to-pick) + ((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." (guard (c ((or (git-no-tags-error? c) (git-no-valid-tags-error? c)) @@ -193,6 +202,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 +216,13 @@ tag, or #false and #false if the latest version could not be determined." (git-reference? (origin-uri origin)))) (_ #f))) -(define (latest-git-release package) +(define* (import-git-release package #:key (version #f)) "Return an for the latest release of PACKAGE." (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 +237,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.4