diff mbox series

[meta-oe] cups-pk-helper: fix localization of the polkit policy

Message ID 20260910155105.2207041-1-f_l_k@t-online.de
State Under Review
Headers show
Series [meta-oe] cups-pk-helper: fix localization of the polkit policy | expand

Commit Message

Markus Volk Sept. 10, 2026, 3:51 p.m. UTC
The recipe carried a patch that commented out the i18n.merge_file()
call for org.opensuse.cupspkhelper.mechanism.policy and installed the
untranslated template in its place, so the polkit dialogs showed
English strings only and the 43 translations shipped in po/ were
discarded.

The merge failed because meson hands the data_dirs argument to its
msgfmthelper script, which replaces GETTEXTDATADIRS instead of
extending it. That hides the ITS rules polkit installs into the target
sysroot, which msgfmt needs to recognize the translatable elements of
a policy file, and which gettext.bbclass already points at.
cups-pk-helper ships no ITS rules of its own, so the argument has no
purpose beyond breaking the merge.

Replace the patch with one that drops data_dirs and keeps the merge
enabled, and remove the manual install of the template.

Tested by rebuilding for corei7-64: the installed policy file now
carries description and message elements for all 43 languages.

AI-Generated: Uses Claude Code (Claude Opus 5)
Signed-off-by: Markus Volk <f_l_k@t-online.de>
---
 ...nsuse.CupsPkHelper.Mechanism.service.patch | 26 -----------------
 .../dont-override-gettextdatadirs.patch       | 28 +++++++++++++++++++
 .../cups/cups-pk-helper_0.2.7.bb              |  7 +----
 3 files changed, 29 insertions(+), 32 deletions(-)
 delete mode 100644 meta-oe/recipes-printing/cups/cups-pk-helper/dont-localize-org.opensuse.CupsPkHelper.Mechanism.service.patch
 create mode 100644 meta-oe/recipes-printing/cups/cups-pk-helper/dont-override-gettextdatadirs.patch
diff mbox series

Patch

diff --git a/meta-oe/recipes-printing/cups/cups-pk-helper/dont-localize-org.opensuse.CupsPkHelper.Mechanism.service.patch b/meta-oe/recipes-printing/cups/cups-pk-helper/dont-localize-org.opensuse.CupsPkHelper.Mechanism.service.patch
deleted file mode 100644
index 371ce01181..0000000000
--- a/meta-oe/recipes-printing/cups/cups-pk-helper/dont-localize-org.opensuse.CupsPkHelper.Mechanism.service.patch
+++ /dev/null
@@ -1,26 +0,0 @@ 
-Upstream-Status: Pending
-
---- a/src/meson.build	2023-01-24 09:22:59.874074134 +0100
-+++ b/src/meson.build	2023-01-24 09:27:00.494627305 +0100
-@@ -73,12 +73,12 @@
- 
- 
- # Translate and install policy file
--i18n.merge_file (
--  input: 'org.opensuse.cupspkhelper.mechanism.policy.in',
--  output: 'org.opensuse.cupspkhelper.mechanism.policy',
--  type: 'xml',
--  data_dirs: join_paths (meson.source_root (), 'src'),
--  po_dir: join_paths (meson.source_root (), 'po'),
--  install: true,
--  install_dir: join_paths (prefix, datadir, 'polkit-1', 'actions')
--)
-+#i18n.merge_file (
-+#  input: 'org.opensuse.cupspkhelper.mechanism.policy.in',
-+#  output: 'org.opensuse.cupspkhelper.mechanism.policy',
-+#  type: 'xml',
-+#  data_dirs: join_paths (meson.source_root (), 'src'),
-+#  po_dir: join_paths (meson.source_root (), 'po'),
-+#  install: true,
-+#  install_dir: join_paths (prefix, datadir, 'polkit-1', 'actions')
-+#)
diff --git a/meta-oe/recipes-printing/cups/cups-pk-helper/dont-override-gettextdatadirs.patch b/meta-oe/recipes-printing/cups/cups-pk-helper/dont-override-gettextdatadirs.patch
new file mode 100644
index 0000000000..0926b302e4
--- /dev/null
+++ b/meta-oe/recipes-printing/cups/cups-pk-helper/dont-override-gettextdatadirs.patch
@@ -0,0 +1,28 @@ 
+meson: don't override GETTEXTDATADIRS for the policy file
+
+The translatable strings of a polkit policy file are described by ITS
+rules that polkit installs as gettext data, so msgfmt only finds them
+when GETTEXTDATADIRS points at the directory holding polkit.its. In a
+cross build that directory lives in the target sysroot, and
+gettext.bbclass exports GETTEXTDATADIRS accordingly.
+
+meson passes the data_dirs argument of i18n.merge_file() to its
+msgfmthelper script, which replaces GETTEXTDATADIRS instead of
+extending it. cups-pk-helper ships no ITS rules of its own, so the
+argument only serves to hide polkit.its from msgfmt and make the merge
+fail. Drop it and rely on the environment.
+
+Upstream-Status: Pending
+AI-Generated: Uses Claude Code (Claude Opus 5)
+Signed-off-by: Markus Volk <f_l_k@t-online.de>
+
+--- a/src/meson.build
++++ b/src/meson.build
+@@ -77,7 +77,6 @@
+   input: 'org.opensuse.cupspkhelper.mechanism.policy.in',
+   output: 'org.opensuse.cupspkhelper.mechanism.policy',
+   type: 'xml',
+-  data_dirs: join_paths (meson.source_root (), 'src'),
+   po_dir: join_paths (meson.source_root (), 'po'),
+   install: true,
+   install_dir: join_paths (prefix, datadir, 'polkit-1', 'actions')
diff --git a/meta-oe/recipes-printing/cups/cups-pk-helper_0.2.7.bb b/meta-oe/recipes-printing/cups/cups-pk-helper_0.2.7.bb
index 81fdf2a7fb..8b2be55354 100644
--- a/meta-oe/recipes-printing/cups/cups-pk-helper_0.2.7.bb
+++ b/meta-oe/recipes-printing/cups/cups-pk-helper_0.2.7.bb
@@ -11,13 +11,8 @@  REQUIRED_DISTRO_FEATURES = "polkit"
 
 SRC_URI = " \
     https://www.freedesktop.org/software/cups-pk-helper/releases/cups-pk-helper-${PV}.tar.xz \
-    file://dont-localize-org.opensuse.CupsPkHelper.Mechanism.service.patch \
+    file://dont-override-gettextdatadirs.patch \
 "
 SRC_URI[sha256sum] = "66070ddb448fe9fcee76aa26be2ede5a80f85563e3a4afd59d2bfd79fbe2e831"
 
-do_install:append() {
-    install -d ${D}${datadir}/polkit-1/actions
-    install -m 644 ${S}/src/org.opensuse.cupspkhelper.mechanism.policy.in ${D}${datadir}/polkit-1/actions/org.opensuse.cupspkhelper.mechanism.policy
-}
-
 FILES:${PN} += "${datadir}"