[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
11/18: import: gnome: Allow updating to a specific version.
From: |
guix-commits |
Subject: |
11/18: import: gnome: Allow updating to a specific version. |
Date: |
Mon, 26 Dec 2022 11:41:43 -0500 (EST) |
htgoebel pushed a commit to branch master
in repository guix.
commit c7faeae2b1d313a6a04ecb6d3cac2dfd35320e29
Author: Hartmut Goebel <h.goebel@crazy-compilers.com>
AuthorDate: Wed Jun 29 10:51:12 2022 +0200
import: gnome: Allow updating to a specific version.
* 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 <ludo@gnu.org>
;;; Copyright © 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+;;; Copyright © 2022 Hartmut Goebel <h.goebel@crazy-compilers.com>
;;;
;;; 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)))
- 10/18: import: github: Allow updating to a specific version., (continued)
- 10/18: import: github: Allow updating to a specific version., guix-commits, 2022/12/26
- 04/18: import: sourceforge: Issue error-message if version is given., guix-commits, 2022/12/26
- 05/18: gnu-maintenance: Allow updating to a specific version., guix-commits, 2022/12/26
- 07/18: import: egg: Allow updating to a specific version., guix-commits, 2022/12/26
- 09/18: import: git: Allow updating to a specific version., guix-commits, 2022/12/26
- 06/18: import: crate: Allow updating to a specific version., guix-commits, 2022/12/26
- 12/18: import: hexpm: Allow updating to a specific version., guix-commits, 2022/12/26
- 16/18: refresh: Allow updating to a specific version., guix-commits, 2022/12/26
- 14/18: import: launchpad: Allow updating to a specific version., guix-commits, 2022/12/26
- 17/18: upstream: Allow updating to a specific version., guix-commits, 2022/12/26
- 11/18: import: gnome: Allow updating to a specific version.,
guix-commits <=
- 08/18: import: gem: Allow updating to a specific version., guix-commits, 2022/12/26
- 18/18: doc: Describe how to update to a specific version., guix-commits, 2022/12/26
- 13/18: import: kde: Allow updating to a specific version., guix-commits, 2022/12/26
- 15/18: import: pypi: Allow updating to a specific version., guix-commits, 2022/12/26