diff mbox series

[v4,3/3] cups: use LOCALE_PATHS to split localized HTML templates

Message ID CZ36N8IH1TRF.3LXKZ2C2DTGIN@joggee.fr
State Accepted, archived
Headers show
Series lib/oe/package: allow to scan extra directories for locale files | expand

Commit Message

Jonathan GUILLOT Dec. 6, 2023, 4:06 p.m. UTC
Localized HTML templates in /usr/share/cups/templates are now part of
locale packages.

Signed-off-by: Jonathan GUILLOT <jonathan@joggee.fr>
---
 meta/recipes-extended/cups/cups.inc | 2 ++
 1 file changed, 2 insertions(+)

Comments

Ross Burton Feb. 15, 2024, 4:27 p.m. UTC | #1
On 6 Dec 2023, at 16:06, Jonathan GUILLOT via lists.openembedded.org <jonathan=joggee.fr@lists.openembedded.org> wrote:
> +LOCALE_PATHS += "${datadir}/cups/templates”

This doesn’t quite do what you expect. Listing the packages generated by cups I see:

cups-locale-da:
        /usr/share/cups/templates/da/add-class.tmpl
        /usr/share/cups/templates/da/add-printer.tmpl
        /usr/share/cups/templates/da/admin.tmpl

Which is good.   But I also see:

cups-locale-add-class.tmpl:
        /usr/share/cups/templates/add-class.tmpl
cups-locale-add-printer.tmpl:
        /usr/share/cups/templates/add-printer.tmpl
cups-locale-admin.tmpl:
        /usr/share/cups/templates/admin.tmpl

That doesn’t look right!

Ross
Jonathan GUILLOT Feb. 19, 2024, 10 a.m. UTC | #2
Thanks Ross,

I was too focus on English and French packages and missed this point.
Listing all items in CUPS added locale path is not OK. I should at least
only get directories (not files) in this path to create the locale list.
However, it remains an issue if some directories in the path would not be
dedicated to locales. This is not the point in CUPS but could be in an
other recipe. Do you think it is possible to determine if the directory
name is a valid language code? Is it reliable to consider locale
directories will always be : 2-letter ISO 639 code followed by optional
hyphen and ISO 3166 country code?

Regards,
Jonathan GUILLOT

Le jeu. 15 févr. 2024 à 17:27, Ross Burton <Ross.Burton@arm.com> a écrit :

> On 6 Dec 2023, at 16:06, Jonathan GUILLOT via lists.openembedded.org
> <jonathan=joggee.fr@lists.openembedded.org> wrote:
> > +LOCALE_PATHS += "${datadir}/cups/templates”
>
> This doesn’t quite do what you expect. Listing the packages generated by
> cups I see:
>
> cups-locale-da:
>         /usr/share/cups/templates/da/add-class.tmpl
>         /usr/share/cups/templates/da/add-printer.tmpl
>         /usr/share/cups/templates/da/admin.tmpl
>
> Which is good.   But I also see:
>
> cups-locale-add-class.tmpl:
>         /usr/share/cups/templates/add-class.tmpl
> cups-locale-add-printer.tmpl:
>         /usr/share/cups/templates/add-printer.tmpl
> cups-locale-admin.tmpl:
>         /usr/share/cups/templates/admin.tmpl
>
> That doesn’t look right!
>
> Ross
Richard Purdie Feb. 19, 2024, 3:10 p.m. UTC | #3
On Mon, 2024-02-19 at 11:00 +0100, Jonathan GUILLOT wrote:
> Thanks Ross,
> 
> I was too focus on English and French packages and missed this point.
> Listing all items in CUPS added locale path is not OK. I should at
> least only get directories (not files) in this path to create the
> locale list. However, it remains an issue if some directories in the
> path would not be dedicated to locales. This is not the point in CUPS
> but could be in an other recipe. Do you think it is possible to
> determine if the directory name is a valid language code? Is it
> reliable to consider locale directories will always be : 2-letter ISO
> 639 code followed by optional hyphen and ISO 3166 country code?

Fixing cups is the priority right now. I was hoping for a fix rather
than having to revert things.

Fixing the core code to only handle directories would also be good. We
should probably just note that all subdirectories are assumed to be
locales in a comment where LOCALE_PATHS is given it's default.

Cheers,

Richard
diff mbox series

Patch

diff --git a/meta/recipes-extended/cups/cups.inc b/meta/recipes-extended/cups/cups.inc
index 31f686cdfd..b70ba3ae58 100644
--- a/meta/recipes-extended/cups/cups.inc
+++ b/meta/recipes-extended/cups/cups.inc
@@ -110,6 +110,8 @@  CONFFILES:${PN} += "${sysconfdir}/cups/cupsd.conf"
 
 MULTILIB_SCRIPTS = "${PN}-dev:${bindir}/cups-config"
 
+LOCALE_PATHS += "${datadir}/cups/templates"
+
 SYSROOT_PREPROCESS_FUNCS += "cups_sysroot_preprocess"
 cups_sysroot_preprocess () {
 	sed -i ${SYSROOT_DESTDIR}${bindir_crossscripts}/cups-config -e 's:cups_datadir=.*:cups_datadir=${datadir}/cups:' -e 's:cups_serverbin=.*:cups_serverbin=${libexecdir}/cups:'