[Pkg-utopia-maintainers] Bug#863207: Please backport gettext .its and .loc files from upstream/master

Iain Lane laney at debian.org
Tue May 23 15:02:01 UTC 2017


Package: src:policykit-1
Version: 0.105.17
Severity: wishlist
Tags: upstream patch

Hiya,

I'm attaching a patch to add a patch to debian/patches/master that
cherry-picks two upstream commits. These commits backport gettext .its
and .loc files from upstream's master branch. With those files we can
translate policykit XML files using gettext.

I wanted to upgrade fwupd to 0.9.2 to test the Logitech update[0]. This
version also converts the build system to meson, and that uses gettext
to translate the PK XML files. It fails like so-

  msgfmt: cannot locate ITS rules for ../policy/org.freedesktop.fwupd.policy.in

I've put the files in the main PK package because none of the others
seem to fit properly.

Review appreciated. I'm not in the team so I can't upload. I'd like to
shove it into unstable so that I can build fwupd against it, but if
you'd rather not due to the freeze then I can prepare something for exp
too.

And yes, it's unfortunate that fwupd depends on rules from a
non-released polkit. Looks like fedora backported the patches too[1].

-- 
Iain Lane                                  [ iain at orangesquash.org.uk ]
Debian Developer                                   [ laney at debian.org ]
Ubuntu Developer                                   [ laney at ubuntu.com ]

[0] https://blogs.gnome.org/hughsie/2017/05/22/updating-logitech-hardware-on-linux/
[1] http://pkgs.fedoraproject.org/cgit/rpms/polkit.git/commit/?id=fa6fd575804de92886c95d3bc2b7eb2abcd13760
-------------- next part --------------
>From 3dc67aa003ccc5972a097720aaed2bad8415d039 Mon Sep 17 00:00:00 2001
From: Iain Lane <iain at orangesquash.org.uk>
Date: Tue, 23 May 2017 12:17:09 +0100
Subject: [PATCH] Backport .its and .loc files from master for gettext support

master/Add-gettext-support-for-.policy-files.patch: Backport from
master: Add .loc and .its files so that gettext can be used to translate
policy files. Some upstreams, particularly those that are switching to
meson, expect these files to be present so that their PK policy files
can be translated.
---
 debian/changelog                                   | 10 +++
 .../Add-gettext-support-for-.policy-files.patch    | 87 ++++++++++++++++++++++
 debian/patches/series                              |  1 +
 debian/policykit-1.install                         |  1 +
 4 files changed, 99 insertions(+)
 create mode 100644 debian/patches/master/Add-gettext-support-for-.policy-files.patch

diff --git a/debian/changelog b/debian/changelog
index 12b471f..b3f2e91 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,13 @@
+policykit-1 (0.105-18) UNRELEASED; urgency=medium
+
+  * master/Add-gettext-support-for-.policy-files.patch: Backport from master:
+    Add .loc and .its files so that gettext can be used to translate policy
+    files. Some upstreams, particularly those that are switching to meson,
+    expect these files to be present so that their PK policy files can be
+    translated.
+
+ -- Iain Lane <iain at orangesquash.org.uk>  Tue, 23 May 2017 12:17:09 +0100
+
 policykit-1 (0.105-17) unstable; urgency=medium
 
   [ Michael Biebl ]
diff --git a/debian/patches/master/Add-gettext-support-for-.policy-files.patch b/debian/patches/master/Add-gettext-support-for-.policy-files.patch
new file mode 100644
index 0000000..057d3d9
--- /dev/null
+++ b/debian/patches/master/Add-gettext-support-for-.policy-files.patch
@@ -0,0 +1,87 @@
+From 7eef6482fd3831bfae73a3576230af5341aaf53f Mon Sep 17 00:00:00 2001
+From: Matthias Clasen <mclasen at redhat.com>
+Date: Fri, 15 Jul 2016 11:12:35 -0400
+Subject: [PATCH] Add gettext support for .policy files
+
+gettext can extract strings from and merge them back into xml
+file formats, with the help of .its files.
+
+https://bugs.freedesktop.org/show_bug.cgi?id=96940
+
+---
+
+Author: Peter Hutterer <peter.hutterer at who-t.net>
+Date:   Thu Oct 20 10:50:58 2016 +1000
+gettext: switch to default-translate "no"
+
+The default appears to be to translate all entries. This rule never takes
+effect, the path to /action/message and /action/description is wrong (/action
+is not a root node). Since we wanted them to be translated, it doesn't matter.
+
+But it also translates all other tags (vendor, allow_any, etc.) and that
+causes polkit to be unhappy, it can't handle the various language versions of
+"no"
+
+** (polkitd:27434): WARNING **: Unknown PolkitImplicitAuthorization string
+'tidak'
+
+Switch to a default of "no" and explicitly include the message and description
+strings to be translated.
+
+The patch was modified for PolicyKit by Ondrej Holy <oholy at redhat.com>.
+
+https://bugs.freedesktop.org/show_bug.cgi?id=98366
+
+Origin: upstream, commit:c78819245ff8a270f97c9f800773e727918be838 commit:32e9a69c335324a53a2c0ba4e0b513fb044be0fd
+
+---
+ data/Makefile.am | 3 +++
+ data/polkit.its  | 8 ++++++++
+ data/polkit.loc  | 6 ++++++
+ 3 files changed, 17 insertions(+)
+ create mode 100644 data/polkit.its
+ create mode 100644 data/polkit.loc
+
+diff --git a/data/Makefile.am b/data/Makefile.am
+index f0beeba..7ea361d 100644
+--- a/data/Makefile.am
++++ b/data/Makefile.am
+@@ -20,6 +20,9 @@ endif
+ pkgconfigdir = $(libdir)/pkgconfig
+ pkgconfig_DATA = polkit-gobject-1.pc polkit-backend-1.pc polkit-agent-1.pc
+ 
++itsdir = $(datadir)/gettext/its
++its_DATA = polkit.loc polkit.its
++
+ CLEANFILES = $(BUILT_SOURCES)
+ 
+ EXTRA_DIST = 							\
+diff --git a/data/polkit.its b/data/polkit.its
+new file mode 100644
+index 0000000..1c37e6b
+--- /dev/null
++++ b/data/polkit.its
+@@ -0,0 +1,8 @@
++<?xml version="1.0"?>
++<its:rules xmlns:its="http://www.w3.org/2005/11/its"
++           version="2.0">
++  <its:translateRule selector="//*" translate="no"/>
++  <its:translateRule selector="//action/description |
++                               //action/message"
++                     translate="yes"/>
++</its:rules>
+diff --git a/data/polkit.loc b/data/polkit.loc
+new file mode 100644
+index 0000000..c7427ec
+--- /dev/null
++++ b/data/polkit.loc
+@@ -0,0 +1,6 @@
++<?xml version="1.0"?>
++<locatingRules>
++  <locatingRule name="polkit policy" pattern="*.policy">
++    <documentRule localName="policyconfig" target="polkit.its"/>
++  </locatingRule>
++</locatingRules>
+-- 
+2.11.0
+
diff --git a/debian/patches/series b/debian/patches/series
index 76011d0..f86d649 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -29,6 +29,7 @@
 0.113/Fix-use-after-free-in-polkitagentsession.c.patch
 0.113/README-Note-to-send-security-reports-via-DBus-s-mech.patch
 master/Fix-multi-line-pam-text-info.patch
+master/Add-gettext-support-for-.policy-files.patch
 01_pam_polkit.patch
 02_gettext.patch
 03_polkitunixsession_sessionid_from_display.patch
diff --git a/debian/policykit-1.install b/debian/policykit-1.install
index a3de089..ed9a935 100644
--- a/debian/policykit-1.install
+++ b/debian/policykit-1.install
@@ -6,6 +6,7 @@ usr/bin/
 usr/lib/*/polkit-1/extensions/*.so
 usr/lib/policykit-1/
 usr/share/dbus-1/
+usr/share/gettext/
 usr/share/locale/
 usr/share/man/
 usr/share/polkit-1/
-- 
2.11.0



More information about the Pkg-utopia-maintainers mailing list