From patchwork Sun May 18 13:01:20 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Maxim Cournoyer X-Patchwork-Id: 42725 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 721E827BC4B; Sun, 18 May 2025 14:02:30 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL, RCVD_IN_VALIDITY_SAFE,SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id BC83327BC49 for ; Sun, 18 May 2025 14:02:29 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uGdeg-0008Bg-7D; Sun, 18 May 2025 09:02:14 -0400 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 1uGdeW-0007ys-K1 for guix-patches@gnu.org; Sun, 18 May 2025 09:02:05 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uGdeW-0004Hp-1M for guix-patches@gnu.org; Sun, 18 May 2025 09:02:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:From:To:Subject; bh=kcsYuM8+rSlBkEx0ANm+Gn4Cr6nwomt0IiyzSPXkgoo=; b=PlX3EZFvbaWxJuZtR5EVSabM2yXc9dHGhkQheuoZEGKVM7QtmIdFf0rRUG73LXmUJclM0SznO7xP/jT5F6KXx8cRl29VhtXZmTuhMoVWF2IpF1I97tywsW5fV7EMtUBg4zBNzpcLjwqZ1oIqhRPPpHLxGgNXmxM8UeO8DkT3df9DpOe2yflc/XAeflh+9upfG+tUs0sZyEKVGgSe/vgHXycRU0quOdtZro8sTI/T7kGhRZCPY3dUl/84MUcK7X8f7daPxuWdt43X0bpkz7LKJdDCrAVyEaoJ+YQ5nJoBlo7E5YTpDYgWEL8Jqh+l8O9tY3g+4cY55gIs0SvOa63WcQ==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1uGdeU-0007mG-Dz; Sun, 18 May 2025 09:02:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#78477] [PATCH] teams: Add script to refresh GNOME core packages. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: liliana.prikler@gmail.com, maxim.cournoyer@gmail.com, noelopez@free.fr, vivien@planete-kraus.eu, guix-patches@gnu.org Resent-Date: Sun, 18 May 2025 13:02:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 78477 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 78477@debbugs.gnu.org Cc: Maxim Cournoyer , Liliana Marie Prikler , Maxim Cournoyer , =?utf-8?q?No=C3=A9?= Lopez , Vivien Kraus X-Debbugs-Original-To: guix-patches@gnu.org X-Debbugs-Original-Xcc: Liliana Marie Prikler , Maxim Cournoyer , =?utf-8?q?No=C3=A9?= Lopez , Vivien Kraus Received: via spool by submit@debbugs.gnu.org id=B.174757330829858 (code B ref -1); Sun, 18 May 2025 13:02:02 +0000 Received: (at submit) by debbugs.gnu.org; 18 May 2025 13:01:48 +0000 Received: from localhost ([127.0.0.1]:56402 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uGdeF-0007lW-PE for submit@debbugs.gnu.org; Sun, 18 May 2025 09:01:48 -0400 Received: from lists.gnu.org ([2001:470:142::17]:49444) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uGdeC-0007l4-JH for submit@debbugs.gnu.org; Sun, 18 May 2025 09:01:45 -0400 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 1uGde0-0007Pi-GJ for guix-patches@gnu.org; Sun, 18 May 2025 09:01:33 -0400 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uGddy-0004Ey-DY for guix-patches@gnu.org; Sun, 18 May 2025 09:01:32 -0400 Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-231fc83a33aso11232375ad.0 for ; Sun, 18 May 2025 06:01:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1747573287; x=1748178087; darn=gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=kcsYuM8+rSlBkEx0ANm+Gn4Cr6nwomt0IiyzSPXkgoo=; b=WAZCfdoYJ+iv39OpgcYWEdv8e9natvAyCXh/QFGN72uHj5SF8bGwGcVYk7fAunw9ot VoZg/LkZnXxBv5wWFpeGL5VJPnzrY3KUrF8hkXrm+GhO0IGPZ1hMp/j/ajn9Khz2cTiV qTkcKJWfK+bhcbKrDk20lFHiArJFAmnoTQ9/p7LyDglmpO87VUDuJQKUXRzcboD1Lkzx bbIIuRUJ1pJT3MZLUdf9hNxX4GsDpCrA3Ghx4our2VRDagvvZDydxQNqxXbP9mZSKS5r YaBNtAbCVTqShp35m/gSl6Gm4YtJJM1yW8Fyciw3PX0lGRWGlEg6/GpUR3V6Kl0cANha j3TQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747573287; x=1748178087; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=kcsYuM8+rSlBkEx0ANm+Gn4Cr6nwomt0IiyzSPXkgoo=; b=I8GDirJhqgXxbSk/nPlLpNRAKrx4wtljxo+oc+CrIuhNLEZLY6iYvaONprviC6GJEU rFSc/LOKG8q53hpNx9YbDZ3K+97LKm44TXP9/yvKhY/PVQdYZtIx3NsREPW+QspNLrzE BeRMH5gvvZgADpL/gmQ4WpLwJZrX2AbzRapqFO9tMelI7ijqO/lS6WYxSQUZY5inCaTG 9M2oqhfYCpcXkWomDFJ58xWyQ6kD/t2YPBbP32yKQ9WKrRO1pP5ZAGuLNlKfgBEDdoes BaJYQcn0c4fFQ93TSHtPvuuPGme2mA9cGl+tUTfzKclOncEtXpxQCqidczhN3fPE+saT B4SQ== X-Gm-Message-State: AOJu0YzDtAb40f6V3odoDnnS/6kxu1Y7MdV6uVURyCjeL30tWhh/k8Zy sin39HhtG+WzenvNJ6SrKB5MsBRZlQ48N5VgFu22JaVsGip2PSYR5n8ZCIXbQQ== X-Gm-Gg: ASbGncvQPXJz0MNkBIrNvQWYzBAFVNkaF/SCO6Au86HcOEEjvPvBHBac5cjv6WW3zkl sp1SEeaXLtuhIrQLZD8vqcNppLLfRoO1UOtLdGfMGv8+XodZVse5ZdwhXYcZ3WSIiFvilyxrUhx 0fdJWAdNc5NfJn7aXrgqCb1dz1/pxUDm4T6xKWaI5TZkTxkZCJFJdDZebhYFVkwk1hX9sXwsGoC 1Me1ohVHYc/rj+lFXMgZ5DVKk6BkwvP6p8Gvm21SijEV3AO+InipIozyC4RhHKsTVgutlzxjwaJ FMVapkn17qeqo1jjmmu1eAYVLn3vqcfB+xXfXJPGwDs8+oovq/MJHsb+pv/Jx80azQZo5MglLVR cVXQjdA== X-Google-Smtp-Source: AGHT+IEgt/GgxfC1tapsy1cVd/xoAYEF1cbl/55ME/plfrdsAWKIhK7yRqtT9TOzs7HcV0eGW1/nHQ== X-Received: by 2002:a17:903:41c7:b0:22e:37b8:7972 with SMTP id d9443c01a7336-231de3514dcmr126493825ad.10.1747573287337; Sun, 18 May 2025 06:01:27 -0700 (PDT) Received: from localhost.localdomain ([2405:6586:be0:0:83c8:d31d:2cec:f542]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-231d4ebaf53sm43402705ad.187.2025.05.18.06.01.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 May 2025 06:01:26 -0700 (PDT) From: Maxim Cournoyer Date: Sun, 18 May 2025 22:01:20 +0900 Message-ID: X-Mailer: git-send-email 2.49.0 MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62e; envelope-from=maxim.cournoyer@gmail.com; helo=mail-pl1-x62e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_FILL_THIS_FORM_SHORT=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action 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+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * etc/teams/gnome/gnome-core-refresh: New file. Change-Id: I7c7de6ce4689cef9c51d357e6ea3d16468078013 --- etc/teams/gnome/gnome-core-refresh | 120 +++++++++++++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100755 etc/teams/gnome/gnome-core-refresh base-commit: 6b5fc4812981f2cadffcc5d39e48cd8e02ee73af diff --git a/etc/teams/gnome/gnome-core-refresh b/etc/teams/gnome/gnome-core-refresh new file mode 100755 index 00000000000..785e9a08b59 --- /dev/null +++ b/etc/teams/gnome/gnome-core-refresh @@ -0,0 +1,120 @@ +#!/usr/bin/env -S guix repl -- +!# ;-*- mode: scheme; -*- +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2025 Maxim Cournoyer +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +;;; Commentary: +;;; +;;; This is a wrapper of 'guix refresh' that refreshes all the GNOME core +;;; packages listed in their release engineering (releng) list to their stable +;;; version. Set the PARTIAL_VERSIONS environment variable to update to +;;; compatible versions instead of exact ones. The GNOME_RELENG_VERSIONS_URI +;;; environment variable can also point to a different URL or file, for +;;; example to update to a past GNOME version. The script can be invoked as: +;;; +;;; $ ./pre-inst-env etc/teams/gnome/gnome-core-refresh --update +;;; or +;;; $ ./pre-inst-env env PARTIAL_VERSIONS=1 etc/teams/gnome/gnome-core-refresh -u +;;; +;;; Code: + +(use-modules (gnu packages) + (guix diagnostics) + (guix http-client) + (guix scripts refresh) + (guix utils) + (ice-9 format) + (ice-9 exceptions) + (ice-9 match) + (ice-9 peg) + (ice-9 textual-ports) + (srfi srfi-1)) + +(define %gnome-releng-versions-uri + (make-parameter + (or (getenv "GNOME_RELENG_VERSIONS_URI") + "https://gitlab.gnome.org/GNOME/releng/-/raw/master/\ +tools/versions-stable"))) + +(define (fetch-releng-content) + "Return an input port to the %GNOME-RELENG-VERSIONS-URI file." + (call-with-port (http-fetch/cached (%gnome-releng-versions-uri)) + get-string-all)) + +(define-exception-type &releng-parser-error &error + make-releng-parser-error releng-parser-error?) + +(define-peg-string-patterns "\ +releng <-- (comment / entry)* !. +entry <-- suite C name C version C subdir NL +suite <-- text +name <-- text +version <-- text +subdir <-- text? +text <- (!NL !C .)* +comment < '#' (!NL .)* NL +C < ':' +NL < '\n'") + +(define %names + '(("adwaita-fonts" . "font-adwaita"))) + +(define (parse-releng data) + "Return DATA, a string representing the content of a GNOME releng file, and +return the complete parse tree." + (let ((tree (peg:tree (match-pattern releng data)))) + (match tree + (#f (raise-exception (make-releng-parser-error))) + (_ tree)))) + +(define (check-package-name name) + "Return #t if a package corresponding to NAME exists, else #f." + (catch 'quit + (lambda () + (parameterize ((guix-warning-port (%make-void-port "w"))) + (specification->package name) + #t)) + (lambda _ + (format (current-error-port) "TODO: package ~a~%" name) + #f))) + +(define* (releng-tree->update-specs tree #:key (partial-versions? + (getenv "PARTIAL_VERSIONS"))) + "Take TREE and return a list of package specifications. If +PARTIAL-VERSIONS? is true, the least significant digit in version is +stripped and the version is prefixed with the '~' character, so that 'guix +refresh' can automatically find the newest compatible version." + (match tree + (('releng ('entry ('suite "core") ('name name) ('version version) _) ...) + (filter-map (lambda (name version) + (let ((name (or (assoc-ref %names name) name))) + (and (check-package-name name) + (if partial-versions? + (let* ((parts (string-split version #\.)) + (num-parts (length parts))) + (if (> num-parts 1) + (format #f "~a=~~~a" name + (version-prefix version + (1- num-parts))) + (format #f "~a=~a" name version))) + (format #f "~a=~a" name version))))) + name version)))) + +(apply guix-refresh (append (cdr (command-line)) + (releng-tree->update-specs + (parse-releng (fetch-releng-content)))))