"guix refresh" doesn't handle older versions like gtk+@2

  • Open
  • quality assurance status badge
Details
2 participants
  • Kaelyn
  • Liliana Marie Prikler
Owner
unassigned
Submitted by
Kaelyn
Severity
normal
K
K
Kaelyn wrote on 8 Jun 2022 19:18
(name . bug-guix@gnu.org)(address . bug-guix@gnu.org)
bpII8BMbxEJbaiPdFNKwLKOzgKF3fpl3t_Fl8yesV6QnyKVgD_Wl2z5Ip8rT8KIOHULjf9wIi_qbDshR2aC2gxdwwAUARVmWQxZ9H8JIiRg=@protonmail.com
When attempting a mass "guix refresh -ru" of system and home profile packages, some bogus updates were encountered. One category of those is older/multiple versions of a package all being updated to the latest, as was seen with gtk+@2, libsigc++@2, and the gtkmm packages. For example:


$ guix refresh gtk+@2
gnu/packages/gtk.scm:851:13: gtk+ would be upgraded from 2.24.33 to 3.94.0


Per the IRC discussion at https://logs.guix.gnu.org/guix/2022-06-08.log#185744,those packages should only be upgraded within the same major version. Maxime suggested adding a REQUIRED-MAJOR-VERSION field to such packages so they are updated correctly: https://logs.guix.gnu.org/guix/2022-06-08.log#185842

(Side note: I believe gtk+ uses a numbering scheme of x.9y.0 for pre-releases of the (x+1).0.0 release; i.e. gtk+ 3.94.0 is a pre-release of gtk 4.)
L
L
Liliana Marie Prikler wrote on 17 Jun 2022 15:44
[PATCH 1/2] import: Check that GNOME minor version is not a semver prerelease.
(address . 55854@debbugs.gnu.org)(name . Kaelyn)(address . kaelyn.alexi@protonmail.com)
8f37e2ae72f4e532f05f8cd010099a8e87e57c47.camel@gmail.com
* guix/import/gnome.scm (latest-gnome-release)[even-minor-version]: Rename
to...
[stable-minor-version?]: ... this. Also check that minor < 90.
---
guix/import/gnome.scm | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

Toggle diff (28 lines)
diff --git a/guix/import/gnome.scm b/guix/import/gnome.scm
index 43966c1028..1a0786ab8d 100644
--- a/guix/import/gnome.scm
+++ b/guix/import/gnome.scm
@@ -60,10 +60,10 @@ (define (latest-gnome-release package)
(define %not-dot
(char-set-complement (char-set #\.)))
- (define (even-minor-version? version)
+ (define (stable-minor-version? version)
(match (string-tokenize version %not-dot)
(((= string->number major) (= string->number minor) . rest)
- (and minor (even? minor)))
+ (and minor (even? minor) (< minor 90)))
(((= string->number major) . _)
;; It should at last start with a digit.
major)))
@@ -94,7 +94,7 @@ (define upstream-name
(let* ((releases (assoc-ref releases upstream-name))
(latest (fold (match-lambda*
(((key . value) result)
- (cond ((even-minor-version? key)
+ (cond ((stable-minor-version? key)
(match result
(#f
(cons key value))
--
2.36.1
L
L
Liliana Marie Prikler wrote on 17 Jun 2022 15:46
[PATCH 2/2] gnu: Restrict gtk+ updaters to their major versions.
(address . 55854@debbugs.gnu.org)(name . Kaelyn)(address . kaelyn.alexi@protonmail.com)
8d1df21d42539c5a0690be407e60e90c7335697a.camel@gmail.com
* gnu/packages/gtk.scm (gtk+-2, gtk+)[properties]: Add update-major-version.
* guix/import/gnome.scm (lastest-gnome-release): Add ‘allowed-major-version?’
and use it to filter latest releases.
---
gnu/packages/gtk.scm | 6 ++++--
guix/import/gnome.scm | 33 +++++++++++++++++++++++----------
2 files changed, 27 insertions(+), 12 deletions(-)

Toggle diff (77 lines)
diff --git a/gnu/packages/gtk.scm b/gnu/packages/gtk.scm
index 4d6a690fbb..73b313520f 100644
--- a/gnu/packages/gtk.scm
+++ b/gnu/packages/gtk.scm
@@ -939,7 +939,8 @@ (define-public gtk+-2
suitable for projects ranging from small one-off tools to complete
application suites.")
(license license:lgpl2.0+)
- (home-page "https://www.gtk.org/")))
+ (home-page "https://www.gtk.org/")
+ (properties `((update-major-version . 2)))))
(define-public gtk+
(package
@@ -1073,7 +1074,8 @@ (define-public gtk+
(native-search-paths
(list (search-path-specification
(variable "GUIX_GTK3_PATH")
- (files '("lib/gtk-3.0")))))))
+ (files '("lib/gtk-3.0")))))
+ (properties `((update-major-version . 3)))))
(define-public gtk
(package
diff --git a/guix/import/gnome.scm b/guix/import/gnome.scm
index 1a0786ab8d..94a2598ab2 100644
--- a/guix/import/gnome.scm
+++ b/guix/import/gnome.scm
@@ -68,6 +68,17 @@ (define (stable-minor-version? version)
;; It should at last start with a digit.
major)))
+ (define allowed-major-version?
+ (let ((fixed-major (assoc-ref (package-properties package)
+ 'update-major-version)))
+ (if fixed-major
+ (lambda (version)
+ (match (string-tokenize version %not-dot)
+ (((= string->number major) . _)
+ (= major fixed-major))
+ (_ #f)))
+ (const #t))))
+
(define upstream-name
;; Some packages like "NetworkManager" have camel-case names.
(package-upstream-name package))
@@ -94,16 +105,18 @@ (define upstream-name
(let* ((releases (assoc-ref releases upstream-name))
(latest (fold (match-lambda*
(((key . value) result)
- (cond ((stable-minor-version? key)
- (match result
- (#f
- (cons key value))
- ((newest . _)
- (if (version>? key newest)
- (cons key value)
- result))))
- (else
- result))))
+ (cond
+ ((not (allowed-major-version? key))
+ result)
+ ((stable-minor-version? key)
+ (match result
+ (#f
+ (cons key value))
+ ((newest . _)
+ (if (version>? key newest)
+ (cons key value)
+ result))))
+ (else result))))
#f
releases)))
(and latest
--
2.36.1
?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send an email to 55854@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 55854
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch