unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: Liliana Marie Prikler <liliana.prikler@gmail.com>
To: 55854@debbugs.gnu.org
Cc: Kaelyn <kaelyn.alexi@protonmail.com>
Subject: bug#55854: [PATCH 2/2] gnu: Restrict gtk+ updaters to their major versions.
Date: Fri, 17 Jun 2022 15:46:29 +0200	[thread overview]
Message-ID: <8d1df21d42539c5a0690be407e60e90c7335697a.camel@gmail.com> (raw)
In-Reply-To: <bpII8BMbxEJbaiPdFNKwLKOzgKF3fpl3t_Fl8yesV6QnyKVgD_Wl2z5Ip8rT8KIOHULjf9wIi_qbDshR2aC2gxdwwAUARVmWQxZ9H8JIiRg=@protonmail.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(-)

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





      parent reply	other threads:[~2022-06-17 13:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-08 17:18 bug#55854: "guix refresh" doesn't handle older versions like gtk+@2 Kaelyn via Bug reports for GNU Guix
2022-06-17 13:44 ` bug#55854: [PATCH 1/2] import: Check that GNOME minor version is not a semver prerelease Liliana Marie Prikler
2022-06-17 13:46 ` Liliana Marie Prikler [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8d1df21d42539c5a0690be407e60e90c7335697a.camel@gmail.com \
    --to=liliana.prikler@gmail.com \
    --cc=55854@debbugs.gnu.org \
    --cc=kaelyn.alexi@protonmail.com \
    --subject='Re: bug#55854: [PATCH 2/2] gnu: Restrict gtk+ updaters to their major versions.' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Code repositories for project(s) associated with this inbox:

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).