Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package tilix for openSUSE:Factory checked in at 2023-04-25 16:42:50 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/tilix (Old) and /work/SRC/openSUSE:Factory/.tilix.new.1533 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "tilix" Tue Apr 25 16:42:50 2023 rev:27 rq:1082707 version:1.9.5 Changes: -------- --- /work/SRC/openSUSE:Factory/tilix/tilix.changes 2022-09-25 15:35:39.619674560 +0200 +++ /work/SRC/openSUSE:Factory/.tilix.new.1533/tilix.changes 2023-04-25 16:44:35.218853961 +0200 @@ -1,0 +2,6 @@ +Tue Apr 25 07:35:16 UTC 2023 - Bjørn Lie <[email protected]> + +- Add b027797.patch: Replace std.xml with GMarkup-based parser. +- Build nautilus-extension-tilix as noarch. + +------------------------------------------------------------------- New: ---- b027797.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ tilix.spec ++++++ --- /var/tmp/diff_new_pack.pC3HRh/_old 2023-04-25 16:44:35.742857066 +0200 +++ /var/tmp/diff_new_pack.pC3HRh/_new 2023-04-25 16:44:35.746857090 +0200 @@ -1,7 +1,7 @@ # # spec file for package tilix # -# Copyright (c) 2022 SUSE LLC +# Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -24,7 +24,7 @@ Summary: A tiling terminal emulator based on GTK+ 3 License: LGPL-3.0-only AND MPL-2.0 URL: https://github.com/gnunn1/tilix -Source0: https://github.com/gnunn1/tilix/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz +Source0: %{url}/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz %if 0%{?sle_version} < 150400 && 0%{?is_opensuse} Source1: com.gexperts.Tilix.appdata.xml %endif @@ -36,6 +36,8 @@ %endif # PATCH-FIX-UPSTREAM tilix-nautilus-43-compat.patch gh#gnunn1/tilix#2115 [email protected] -- nautilus: Add compatibility with Nautilus 43 Patch2: tilix-nautilus-43-compat.patch +# PATCH-FIX-UPSTREAM b027797.patch -- Replace std.xml with GMarkup-based parser +Patch3: %{url}/commit/b027797.patch BuildRequires: AppStream BuildRequires: appstream-glib BuildRequires: desktop-file-utils @@ -73,6 +75,7 @@ %package -n nautilus-extension-tilix Summary: Nautilus Extension to Open Tilix in Folders +BuildArch: noarch Requires: python3-nautilus Supplements: (nautilus and %{name}) ++++++ b027797.patch ++++++ >From b02779737997a02b98b690e6f8478d28d5e931a5 Mon Sep 17 00:00:00 2001 From: Matthias Klumpp <[email protected]> Date: Thu, 20 Apr 2023 02:09:36 +0200 Subject: [PATCH] Replace std.xml with GMarkup-based parser This is quite ugly, but using GMarkup avoids us introducing another hard-to-maintain dependency for a tiny task. (It would either be a better D XML parsing library or undeaD to resurrect the removed standard-library module, both options are pretty unattractive. GMarkup will not go away anytime soon) Resolves: #2151 --- source/gx/tilix/prefeditor/prefdialog.d | 73 +++++++++++++++++++------ 1 file changed, 55 insertions(+), 18 deletions(-) diff --git a/source/gx/tilix/prefeditor/prefdialog.d b/source/gx/tilix/prefeditor/prefdialog.d index a5c3ce37..505096ec 100644 --- a/source/gx/tilix/prefeditor/prefdialog.d +++ b/source/gx/tilix/prefeditor/prefdialog.d @@ -947,9 +947,10 @@ private: * pre GTK 3.20 */ void loadLocalizedShortcutLabels() { - //Clear associative arrays since clear method isn't compatible with LDC - labels = null; - prefixes = null; + import glib.SimpleXML : SimpleXML; + import glib.c.types : GMarkupParser, GMarkupParseContext, GMarkupParseFlags; + import std.string : fromStringz; + import std.array : empty; string ui = getResource(SHORTCUT_UI_RESOURCE); if (ui.length == 0) { @@ -957,22 +958,58 @@ private: return; } - import std.xml: DocumentParser, ElementParser, Element, XMLException; + struct ParseHelper { + string currentId = ""; + bool addNextText = false; + string[string] labels; + } - try { - DocumentParser parser = new DocumentParser(ui); - parser.onStartTag["object"] = (ElementParser xml) { - if (xml.tag.attr["class"] == "GtkShortcutsShortcut") { - string id = xml.tag.attr["id"]; - xml.onEndTag["property"] = (in Element e) { - if (e.tag.attr["name"] == "title") { - labels[id] = C_(SHORTCUT_LOCALIZATION_CONTEXT, e.text); - } - }; - xml.parse(); + GMarkupParser parseConfig; + parseConfig.startElement = function void(GMarkupParseContext* context, + const(char)* elementNameC, + char** attributeNames, + char** attributeValues, + void* userData, + GError** err) { + auto helper = cast(ParseHelper*)userData; + const elementName = elementNameC.fromStringz; + if (elementName == "object") { + string[string] attrs; + for (uint i = 0; attributeNames[i] != null; i++) + attrs[attributeNames[i].fromStringz.to!string] = attributeValues[i].fromStringz.to!string; + + if (attrs.get("class", "") == "GtkShortcutsShortcut") + helper.currentId = attrs["id"]; + + } else if (elementName == "property" && !helper.currentId.empty) { + for (uint i = 0; attributeNames[i] != null; i++) { + if (attributeNames[i].fromStringz == "name" && attributeValues[i].fromStringz == "title") { + helper.addNextText = true; + break; + } } - }; - parser.parse(); + } + }; + parseConfig.text = function void(GMarkupParseContext* context, + const(char)* text, + size_t textLen, + void* userData, + GError** err) { + auto helper = cast(ParseHelper*)userData; + if (!helper.addNextText) + return; + + helper.labels[helper.currentId] = C_(SHORTCUT_LOCALIZATION_CONTEXT, text.fromStringz.to!string); + helper.currentId = null; + helper.addNextText = false; + }; + + try { + ParseHelper helper; + auto parser = new SimpleXML(&parseConfig, GMarkupParseFlags.PREFIX_ERROR_POSITION, &helper, null); + parser.parse(ui, ui.length); + labels = helper.labels; + // While you could use sections to get prefixes, not all sections are there // and it's not inutituve from a localization perspective. Just add them manually prefixes[ACTION_PREFIX_WIN] = C_(SHORTCUT_LOCALIZATION_CONTEXT, "Window"); @@ -980,7 +1017,7 @@ private: prefixes[ACTION_PREFIX_TERMINAL] = C_(SHORTCUT_LOCALIZATION_CONTEXT, "Terminal"); prefixes[ACTION_PREFIX_SESSION] = C_(SHORTCUT_LOCALIZATION_CONTEXT, "Session"); prefixes[ACTION_PREFIX_NAUTILUS] = C_(SHORTCUT_LOCALIZATION_CONTEXT, "Nautilus"); - } catch (XMLException e) { + } catch (Exception e) { error("Failed to parse shortcuts.ui", e); } }
