guix_mirror_bot pushed a commit to branch gnome-team
in repository guix.
commit 4f8471451b5042e765e3a5ca3338469e6b870b6d
Author: Maxim Cournoyer <[email protected]>
AuthorDate: Tue Mar 17 17:22:56 2026 +0900
gnu: gtk: Make reproducible.
* gnu/packages/patches/gtk4-demo-reproducible.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register it.
* gnu/packages/gtk.scm (gtk) [source]: Apply it.
Change-Id: I03ef58f324a84151a681988a18aa1ab986aeba79
---
gnu/local.mk | 1 +
gnu/packages/gtk.scm | 3 +-
gnu/packages/patches/gtk4-demo-reproducible.patch | 79 +++++++++++++++++++++++
3 files changed, 82 insertions(+), 1 deletion(-)
diff --git a/gnu/local.mk b/gnu/local.mk
index b60dacb0ac..af9d1b67d3 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1577,6 +1577,7 @@ dist_patch_DATA =
\
%D%/packages/patches/gtk3-respect-GUIX_GTK3_IM_MODULE_FILE.patch \
%D%/packages/patches/gtk-doc-respect-xml-catalog.patch \
%D%/packages/patches/gtk-doc-mkhtml-test-fix.patch \
+ %D%/packages/patches/gtk4-demo-reproducible.patch \
%D%/packages/patches/gtk4-needs-udmabuf.patch \
%D%/packages/patches/gtk4-respect-GUIX_GTK4_PATH.patch \
%D%/packages/patches/gtkglext-disable-disable-deprecated.patch \
diff --git a/gnu/packages/gtk.scm b/gnu/packages/gtk.scm
index df28c88ded..05ee09242d 100644
--- a/gnu/packages/gtk.scm
+++ b/gnu/packages/gtk.scm
@@ -1133,7 +1133,8 @@ application suites.")
(sha256
(base32 "1z2mkmazc2d51jbg3qwwdycycqiwswm88nhw6bxscz8j86f5lyyd"))
(patches
- (search-patches "gtk4-needs-udmabuf.patch"
+ (search-patches "gtk4-demo-reproducible.patch"
+ "gtk4-needs-udmabuf.patch"
"gtk4-respect-GUIX_GTK4_PATH.patch"))
(modules '((guix build utils)))))
(build-system meson-build-system)
diff --git a/gnu/packages/patches/gtk4-demo-reproducible.patch
b/gnu/packages/patches/gtk4-demo-reproducible.patch
new file mode 100644
index 0000000000..5b0a194cfa
--- /dev/null
+++ b/gnu/packages/patches/gtk4-demo-reproducible.patch
@@ -0,0 +1,79 @@
+Upstream-status: https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/9675
+
+diff --git a/demos/gtk-demo/geninclude.py b/demos/gtk-demo/geninclude.py
+index 2ebfaeb625..5864a608f5 100755
+--- a/demos/gtk-demo/geninclude.py
++++ b/demos/gtk-demo/geninclude.py
+@@ -2,19 +2,20 @@
+ # -*- coding: utf-8 -*-
+
+ import sys
+-import re
+-import os
+ from collections import *
+
++
+ def add_quotes(s):
+ return "\"" + s.lower() + "\""
+
++
+ def wordify(s):
+ return s.strip().rstrip(".,;:")
+
++
+ def is_keyword(s):
+ if s == "GTK":
+- return False
++ return False
+ elif s.startswith(("Gtk", "Gdk", "Pango")):
+ return True
+ elif s.startswith("G") and s[1].isupper():
+@@ -22,6 +23,7 @@ def is_keyword(s):
+ else:
+ return False
+
++
+ out_file = sys.argv[1]
+ in_files = sys.argv[2:]
+
+@@ -82,6 +84,10 @@ for demo in demos:
+ parent_index = parent_index + 1
+
+
++# Sort demos by title
++demos = sorted(demos, key=lambda x: x[1])
++
++
+ # For every child with a parent, generate a list of child demos
+ i = 0
+ for parent in parents:
+@@ -91,15 +97,12 @@ for parent in parents:
+ for child in demos:
+ if child[1].startswith(parent + "/"):
+ title = child[1][child[1].rfind('/') + 1:]
+- file_output += " { \"" + child[0] + "\", \"" + title + "\", " +
"(const char*[]) {" + ", ".join(list(map(add_quotes, child[2])) + ["NULL"]) + "
}, \"" + child[3] + "\", " + child[4] + ", NULL },\n"
++ file_output += " { \"" + child[0] + "\", \"" + title + "\", " +
"(const char*[]) {" + ", ".join(list(map(add_quotes, sorted(child[2]))) +
["NULL"]) + " }, \"" + child[3] + "\", " + child[4] + ", NULL },\n"
+
+ file_output += " { NULL }\n};\n"
+ i = i + 1
+
+
+-# Sort demos by title
+-demos = sorted(demos, key=lambda x: x[1])
+-
+ file_output += "\nDemoData gtk_demos[] = {\n"
+ for demo in demos:
+ # Do not generate one of these for demos with a parent demo
+@@ -118,10 +121,10 @@ for demo in demos:
+
+ if demo[5] != -1:
+ child_array = "child" + str(demo[5])
+- file_output += " { " + name + ", " + title + ", " + "(const char*[])
{" + ", ".join(list(map(add_quotes, keywords)) + ["NULL"]) + " }, " + file + ",
" + demo[4] + ", " + child_array + " },\n"
++ file_output += " { " + name + ", " + title + ", " + "(const char*[])
{" + ", ".join(list(map(add_quotes, sorted(keywords))) + ["NULL"]) + " }, " +
file + ", " + demo[4] + ", " + child_array + " },\n"
+
+-file_output += " { NULL }\n};\n"
+
++file_output += " { NULL }\n};\n"
+ ofile = open(out_file, "w")
+ ofile.write(file_output)
+ ofile.close()