summaryrefslogtreecommitdiff
path: root/gnu/packages/patches/qtbase-5-use-TZDIR.patch
diff options
context:
space:
mode:
authorMaxim Cournoyer <maxim.cournoyer@gmail.com>2023-09-12 10:14:32 -0400
committerMaxim Cournoyer <maxim.cournoyer@gmail.com>2023-10-16 11:16:01 -0400
commit6b8e35ce23d6fc1aa4525005063345d221b42730 (patch)
tree43e63845eebd4c823fe221d6adb16cd48525e1d4 /gnu/packages/patches/qtbase-5-use-TZDIR.patch
parent3eba1dc655c8bb4c2b609fce8ddab05c083a8a60 (diff)
gnu: qtbase: Reinstate date related tests.
* gnu/packages/qt.scm (qtbase) [native-inputs]: Add tzdata-for-tests. [arguments]: Set the TZDIR and TZ environment variables, and reinstate the tst_qdate, tst_qtimezone and tst_qdatetime tests in the check phase. (qtbase-5) [source]: Replace qtbase-use-TZDIR.patch with qtbase-5-use-TZDIR.patch. * gnu/packages/patches/qtbase-use-TZDIR.patch: Refresh patch with upstream version, and preserve the old one for qtbase@5 as... * gnu/packages/patches/qtbase-5-use-TZDIR.patch: ... this. * gnu/local.mk (dist_patch_DATA): Register new patch. Series-changes: 2 - Use old TZDIR patch for qtbase@5 (the new one doesn't apply)
Diffstat (limited to 'gnu/packages/patches/qtbase-5-use-TZDIR.patch')
-rw-r--r--gnu/packages/patches/qtbase-5-use-TZDIR.patch39
1 files changed, 39 insertions, 0 deletions
diff --git a/gnu/packages/patches/qtbase-5-use-TZDIR.patch b/gnu/packages/patches/qtbase-5-use-TZDIR.patch
new file mode 100644
index 0000000000..b6c377b133
--- /dev/null
+++ b/gnu/packages/patches/qtbase-5-use-TZDIR.patch
@@ -0,0 +1,39 @@
+Use $TZDIR to search for time-zone data. Thus avoid depending on package
+"tzdata", which often introduces changes with near-immediate effects, so it's
+important to be able to update it fast.
+
+Based on a patch fron NixOS.
+===================================================================
+--- qtbase-opensource-src-5.14.2.orig/src/corelib/time/qtimezoneprivate_tz.cpp
++++ qtbase-opensource-src-5.15.2/src/corelib/time/qtimezoneprivate_tz.cpp
+@@ -70,7 +70,11 @@
+ // Parse zone.tab table, assume lists all installed zones, if not will need to read directories
+ static QTzTimeZoneHash loadTzTimeZones()
+ {
+- QString path = QStringLiteral("/usr/share/zoneinfo/zone.tab");
++ // Try TZDIR first, in case we're running on GuixSD.
++ QString path = QFile::decodeName(qgetenv("TZDIR")) + QStringLiteral("/zone.tab");
++ // Fallback to traditional paths in case we are not on GuixSD.
++ if (!QFile::exists(path))
++ path = QStringLiteral("/usr/share/zoneinfo/zone.tab");
+ if (!QFile::exists(path))
+ path = QStringLiteral("/usr/lib/zoneinfo/zone.tab");
+
+@@ -645,6 +649,9 @@
+ if (!tzif.open(QIODevice::ReadOnly))
+ return;
+ } else {
++ // Try TZDIR first, in case we're running on GuixSD.
++ tzif.setFileName(QFile::decodeName(qgetenv("TZDIR")) + QStringLiteral("/") + QString::fromLocal8Bit(ianaId));
++ if (!tzif.open(QIODevice::ReadOnly)) {
+ // Open named tz, try modern path first, if fails try legacy path
+ tzif.setFileName(QLatin1String("/usr/share/zoneinfo/") + QString::fromLocal8Bit(ianaId));
+ if (!tzif.open(QIODevice::ReadOnly)) {
+@@ -652,6 +659,7 @@
+ if (!tzif.open(QIODevice::ReadOnly))
+ return;
+ }
++ }
+ }
+
+ QDataStream ds(&tzif);