import: gnome: Improve version handling logic.
Before this change, we'd get: $ guix refresh gedit updating from version 40.1 to version 43.alpha... This is because the new GNOME version scheme introduced in 2021 with GNOME 40 was not treated correctly. Also, no longer ignore odd numbered minor versions, as this appears to be a declining practice in GNOME. * guix/import/gnome.scm (latest-gnome-release) <pre-release-text?>: New predicate. <even-minor-version?>: Rename to... <release-version?>: ...this. Return #f in case the version corresponds to a development release. * guix/import/gnome.scm (latest-gnome-release): Adjust accordingly.
This commit is contained in:
parent
f93ad1565b
commit
5dd3acd0a0
@ -1,5 +1,6 @@
|
|||||||
;;; GNU Guix --- Functional package management for GNU
|
;;; GNU Guix --- Functional package management for GNU
|
||||||
;;; Copyright © 2017, 2019, 2021 Ludovic Courtès <ludo@gnu.org>
|
;;; Copyright © 2017, 2019, 2021 Ludovic Courtès <ludo@gnu.org>
|
||||||
|
;;; Copyright © 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
|
||||||
;;;
|
;;;
|
||||||
;;; This file is part of GNU Guix.
|
;;; This file is part of GNU Guix.
|
||||||
;;;
|
;;;
|
||||||
@ -24,9 +25,11 @@
|
|||||||
#:use-module (json)
|
#:use-module (json)
|
||||||
#:use-module (srfi srfi-1)
|
#:use-module (srfi srfi-1)
|
||||||
#:use-module (srfi srfi-11)
|
#:use-module (srfi srfi-11)
|
||||||
|
#:use-module (srfi srfi-26)
|
||||||
#:use-module (srfi srfi-34)
|
#:use-module (srfi srfi-34)
|
||||||
#:use-module (web uri)
|
#:use-module (web uri)
|
||||||
#:use-module (ice-9 match)
|
#:use-module (ice-9 match)
|
||||||
|
#:use-module (ice-9 regex)
|
||||||
#:export (%gnome-updater))
|
#:export (%gnome-updater))
|
||||||
|
|
||||||
;;; Commentary:
|
;;; Commentary:
|
||||||
@ -60,18 +63,26 @@ not be determined."
|
|||||||
(define %not-dot
|
(define %not-dot
|
||||||
(char-set-complement (char-set #\.)))
|
(char-set-complement (char-set #\.)))
|
||||||
|
|
||||||
(define (even-minor-version? version)
|
(define (pre-release-text? text)
|
||||||
(match (string-tokenize version %not-dot)
|
(string-match "^(alpha|beta|rc)" text))
|
||||||
(((= string->number major) (= string->number minor) (= string->number micro))
|
|
||||||
;; This is for things like GLib, with version strings like "2.72.3".
|
(define (release-version? version)
|
||||||
(and minor (even? minor) micro))
|
"Predicate to check if VERSION matches the format of a GNOME release
|
||||||
(((= string->number major) (= string->number minor))
|
version. A release version can have more than one form, depending on the
|
||||||
;; GNOME applications have version strings like "42.1" (only two
|
GNOME component, but typically it takes the form of a major-minor tuple, where
|
||||||
;; integers) and are not subject to the odd/even policy. MAJOR and
|
minor can also be prefixed wih \"alpha\", \"beta\" or \"rc\". For more
|
||||||
;; MINOR should be valid numbers though; "43.alpha" is rejected.
|
information about the GNOME versioning scheme, see:
|
||||||
(and major minor))
|
https://discourse.gnome.org/t/new-gnome-versioning-scheme/4235"
|
||||||
(_
|
(define components (string-tokenize version %not-dot))
|
||||||
#f)))
|
(if (any pre-release-text? components)
|
||||||
|
#f ;ignore pre-releases
|
||||||
|
(match components
|
||||||
|
(((= string->number major) (= string->number minor) . _)
|
||||||
|
;; Any other 3+ components versions such as "2.72.2".
|
||||||
|
(and major minor))
|
||||||
|
(((= string->number major) . _)
|
||||||
|
;; A GNOME version strings like "42.1".
|
||||||
|
major))))
|
||||||
|
|
||||||
(define upstream-name
|
(define upstream-name
|
||||||
;; Some packages like "NetworkManager" have camel-case names.
|
;; Some packages like "NetworkManager" have camel-case names.
|
||||||
@ -99,7 +110,7 @@ not be determined."
|
|||||||
(let* ((releases (assoc-ref releases upstream-name))
|
(let* ((releases (assoc-ref releases upstream-name))
|
||||||
(latest (fold (match-lambda*
|
(latest (fold (match-lambda*
|
||||||
(((key . value) result)
|
(((key . value) result)
|
||||||
(cond ((even-minor-version? key)
|
(cond ((release-version? key)
|
||||||
(match result
|
(match result
|
||||||
(#f
|
(#f
|
||||||
(cons key value))
|
(cons key value))
|
||||||
|
Loading…
Reference in New Issue
Block a user