cups-pk-helper: fix localization of the polkit policy

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>
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
This commit is contained in:
Markus Volk
2026-09-11 07:08:00 -07:00
committed by Khem Raj
parent 03420389ca
commit b21bc99384
3 changed files with 29 additions and 32 deletions
@@ -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')
+#)
@@ -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')
@@ -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}"