From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id 2JHYEiyIoWP5ZAEAbAwnHQ (envelope-from ) for ; Tue, 20 Dec 2022 11:02:20 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id yA6UEiyIoWOiMwEAauVa8A (envelope-from ) for ; Tue, 20 Dec 2022 11:02:20 +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 EE880400A0 for ; Tue, 20 Dec 2022 11:02:14 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p7Z2W-0004tU-Rd; Tue, 20 Dec 2022 04:36:00 -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 1p7Z1h-0004gC-9t 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-0002w4-W7 for guix-patches@gnu.org; Tue, 20 Dec 2022 04:35:09 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p7Z1g-0003Ru-P8 for guix-patches@gnu.org; Tue, 20 Dec 2022 04:35:08 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#57460] [PATCH v3 11/18] import: gnome: 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:08 +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.167152890313177 (code B ref 57460); Tue, 20 Dec 2022 09:35:08 +0000 Received: (at 57460) by debbugs.gnu.org; 20 Dec 2022 09:35:03 +0000 Received: from localhost ([127.0.0.1]:43747 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p7Z1a-0003Q9-Nk for submit@debbugs.gnu.org; Tue, 20 Dec 2022 04:35:03 -0500 Received: from mout.kundenserver.de ([212.227.126.130]:39065) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p7Z1V-0003P4-7b for 57460@debbugs.gnu.org; Tue, 20 Dec 2022 04:34:57 -0500 Received: from hermia.goebel-consult.de ([87.176.134.225]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MoeU5-1oVoPa0lGT-00p86t for <57460@debbugs.gnu.org>; Tue, 20 Dec 2022 10:34:51 +0100 Received: from thisbe.goebel-consult.de (hermia.goebel-consult.de [192.168.110.7]) by hermia.goebel-consult.de (Postfix) with ESMTP id 0549F669A8; Tue, 20 Dec 2022 10:34:24 +0100 (CET) From: Hartmut Goebel Date: Tue, 20 Dec 2022 10:34:16 +0100 Message-Id: <424e88881eb29ea85b2bc2aa0da95cc0fb8a7aac.1671527962.git.h.goebel@crazy-compilers.com> 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:6wy24axkXv7uXoBl8YayYDNfHD+cpXLws3SvAs+4tiNnZYKL8DF hn8gQavtFvm4Jo/FSdDJ7mhO8hprM7COCD2pxIySv2dWaqc7hr5EHomSnOBbHjKWnDc6xa2 7Nh/09cb0wQCxq2XKaiiJbclxlVoKxmoh6nIt8N+prSaxRhYTiEOCvhg5e4LByuzMlJVqL+ Yur4rX5mZgANkYDWsWdUA== UI-OutboundReport: notjunk:1;M01:P0:711oOjfxw00=;SU1E3scJeYoPN/IjohP0WSmYcHP o5txPox/QX8FzBjfp76z+MV0DjHTRV+l4iM4iuwB5JEISJ+HrpUu/F8t4UK6VN2t4jNp/NGZz TUv/4a1oFffxGC+ERdchoCMkQ18SEs6ZgY6io3M6RD0XSezuYaQJ3AKBZE1vzmft6eUlkR2c1 54Ig3ROUuemFmLVYY5wyrdZlcup5hN6wnUWwzsi7RPjlxnZh4Q6T/ciKDAIlxY7mE6LAcXhVx lPNsOZQW8nWL2ms+bubP9oLYx+ckiXfM2wS5Egol3//ADMk6EbPUedqmwMcsp6iB+F5/+zGcq 0cs4yw7cadyHZg47xMbGyi0+kpLFyvdnkty2md+uDGdqTsU9DmUqz65NF+5LINoXPgi7Rx2B8 0U3ernxorSbwW/ZQNNu3sbyQL4DK4JyoONvCEfGUhhsZhDE7ZInB7a0oz47c4VEs416uU2GgY Dp3X4yuAM1uLzdjoMb7kZ4f1n2L4141Mt8bJd5IoXWpX1li3pQNzG3sZizihuE8PYvTHcgf8n uDYeo2mcuPt2WPuZADgLwlWS+7cb289SKG+uxbsBwSFNblHKfN08Ik+uOo7oyzEQE0FINzKWB MTxaOyynd51EbjNtOsBLD+i+SI/JxghwCCquOz3T/E3vjvR+i51iKKZu7vyoVW73pMlFL0Ijn KpjRdZ0b5PqROmtHlWAGa2EqR6pyEFFYCMryJsFoJgmUsJFzs+9JfqL9iq0Z20o= 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=1671530535; a=rsa-sha256; cv=none; b=KvVPZqZrYdHrdcz23r77iazApVRdearA2c8Zwe5DkjCOtDBjCQ1/Rc/xbdsRbPXBGN0iup dYTeqmlY7LUyFQKWBWSIQUR5/vjC34XI3dQqq0Qa4uVNYA+SxyVQGQM86xHFzKcmUHdEmL CZ3LYR+ISrKfRVYbICmJjTDI0QbDln7pSsy6dA8MHqmefpvXIFXa8bFLxyE8Z0kyV9fruZ z8qgHc83L8n2s0YDo3xDvHLQzSWWFVWchj1IwWCbYdiIKB0+Lgdld+H6Y0unc5a2QBc9aE iFbov+kWJ03xKTnwoX7kCltzbS6xk+JIlhqhOgRHDe0qi7J4mY5cKOaFIdCKPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1671530535; 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=1VimeSVoCnHJsFht47CzB9QxZ3EujK1x0g8Uw9/20WI=; b=E+R9PpahMQZAjCFBJQW8En31nyIbDfxoQHMHBwJdaQub8+Ek7WI7eZdS9buuFJD2dORemz Jb2tYZzrVUgDMkeYPSkzYzF4vOgo/8Czejthc1IzBSTbR/8f1f94Xqf+OUEHCN/XunH1o+ vJyfEmkZU5cnKoKOM6flO4aToWuLnpf7B9yEKesl5XUxj8ke3gxdGNIxOyi18OEcPxry20 aP42NH7rQId/Euj/ONkLNGnnBJk/xzYJObgAndJtlOgDmBMpvHmr94Rp1UzD3A3ifalq0w gg6SYMJRaCAb0MJ3GxcBAEj/8damcsSPRFC3oowCwTGRG7lrGYOQZuTBWBp9EA== 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: EE880400A0 X-TUID: Rd3tN4fsUKcb * guix/import/gnome.scm (latest-gnome-release): Rename to 'import-gnome-release', add #:version argument. If version is given, try to find the respective version [find-latest-release]: New function, based on former code. [find-version-release]: New function. --- guix/import/gnome.scm | 47 +++++++++++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 17 deletions(-) diff --git a/guix/import/gnome.scm b/guix/import/gnome.scm index 09c6dbbd0d..3c5a96fdde 100644 --- a/guix/import/gnome.scm +++ b/guix/import/gnome.scm @@ -1,6 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2017, 2019, 2021 Ludovic Courtès ;;; Copyright © 2022 Maxim Cournoyer +;;; Copyright © 2022 Hartmut Goebel ;;; ;;; This file is part of GNU Guix. ;;; @@ -57,9 +58,10 @@ source for metadata." name "/" relative-url)))) '("tar.lz" "tar.xz" "tar.bz2" "tar.gz"))))))) -(define (latest-gnome-release package) +(define* (import-gnome-release package #:key (version #f)) "Return the latest release of PACKAGE, a GNOME package, or #f if it could -not be determined." +not be determined. Optionally include a VERSION string to fetch a specific +version." (define %not-dot (char-set-complement (char-set #\.))) @@ -88,6 +90,28 @@ https://discourse.gnome.org/t/new-gnome-versioning-scheme/4235" ;; Some packages like "NetworkManager" have camel-case names. (package-upstream-name package)) + (define (find-latest-release releases) + (fold (match-lambda* + (((key . value) result) + (cond ((release-version? key) + (match result + (#f + (cons key value)) + ((newest . _) + (if (version>? key newest) + (cons key value) + result)))) + (else + result)))) + #f + releases)) + + (define (find-version-release releases version) + (find (match-lambda + ((key . value) + (string=? key version))) + releases)) + (guard (c ((http-get-error? c) (if (= 404 (http-get-error-code c)) #f @@ -108,20 +132,9 @@ https://discourse.gnome.org/t/new-gnome-versioning-scheme/4235" (match json (#(4 releases _ ...) (let* ((releases (assoc-ref releases upstream-name)) - (latest (fold (match-lambda* - (((key . value) result) - (cond ((release-version? key) - (match result - (#f - (cons key value)) - ((newest . _) - (if (version>? key newest) - (cons key value) - result)))) - (else - result)))) - #f - releases))) + (latest (if version + (find-version-release releases version) + (find-latest-release releases)))) (and latest (jsonish->upstream-source upstream-name latest)))))))) @@ -130,4 +143,4 @@ https://discourse.gnome.org/t/new-gnome-versioning-scheme/4235" (name 'gnome) (description "Updater for GNOME packages") (pred (url-prefix-predicate "mirror://gnome/")) - (import latest-gnome-release))) + (import import-gnome-release))) -- 2.30.6