From: claudius.heine.ext@siemens.com
To: isar-users@googlegroups.com
Cc: Claudius Heine <ch@denx.de>
Subject: [PATCH 1/1] meta/isar-cfg-localepurge: move locale configuration inside bb
Date: Tue, 29 May 2018 17:15:27 +0200 [thread overview]
Message-ID: <20180529151527.6090-2-claudius.heine.ext@siemens.com> (raw)
In-Reply-To: <20180529151527.6090-1-claudius.heine.ext@siemens.com>
From: Claudius Heine <ch@denx.de>
To set custom locale configuration it in necessary to overwrite the
files of isar-cfg-localepurge before. That can be a bit of a hassle.
With this patch the locale configuration is generated based on bitbake
variables and therefor can be set from outside.
The new variables are `LOCALE_GEN` which is basically the content of the
desired `/etc/locale.gen` with each line seperated by '\n' and
`LOCALE_DEFAULT` which sets the global default locale of the system.
Signed-off-by: Claudius Heine <ch@denx.de>
---
.../isar-cfg-localepurge/files/locale.debconf | 12 ------
.../isar-cfg-localepurge/files/locale.gen | 1 -
.../isar-cfg-localepurge.bb | 43 +++++++++++++++++--
3 files changed, 40 insertions(+), 16 deletions(-)
delete mode 100644 meta/recipes-support/isar-cfg-localepurge/files/locale.debconf
delete mode 100644 meta/recipes-support/isar-cfg-localepurge/files/locale.gen
diff --git a/meta/recipes-support/isar-cfg-localepurge/files/locale.debconf b/meta/recipes-support/isar-cfg-localepurge/files/locale.debconf
deleted file mode 100644
index 169c071..0000000
--- a/meta/recipes-support/isar-cfg-localepurge/files/locale.debconf
+++ /dev/null
@@ -1,12 +0,0 @@
-locales locales/locales_to_be_generated multiselect en_US.UTF-8 UTF-8
-locales locales/default_environment_locale select en_US.UTF-8
-
-localepurge localepurge/dontbothernew boolean true
-localepurge localepurge/nopurge multiselect en, en_US, en_US.UTF-8
-localepurge localepurge/use-dpkg-feature boolean false
-localepurge localepurge/verbose boolean false
-localepurge localepurge/showfreedspace boolean false
-localepurge localepurge/none_selected boolean false
-localepurge localepurge/mandelete boolean true
-localepurge localepurge/quickndirtycalc boolean false
-localepurge localepurge/remove_no note
diff --git a/meta/recipes-support/isar-cfg-localepurge/files/locale.gen b/meta/recipes-support/isar-cfg-localepurge/files/locale.gen
deleted file mode 100644
index a66d814..0000000
--- a/meta/recipes-support/isar-cfg-localepurge/files/locale.gen
+++ /dev/null
@@ -1 +0,0 @@
-en_US.UTF-8 UTF-8
diff --git a/meta/recipes-support/isar-cfg-localepurge/isar-cfg-localepurge.bb b/meta/recipes-support/isar-cfg-localepurge/isar-cfg-localepurge.bb
index d2cf1f3..f815717 100644
--- a/meta/recipes-support/isar-cfg-localepurge/isar-cfg-localepurge.bb
+++ b/meta/recipes-support/isar-cfg-localepurge/isar-cfg-localepurge.bb
@@ -4,12 +4,49 @@ DESCRIPTION = "Isar configuration package for locale and localepurge"
MAINTAINER = "isar-users <isar-users@googlegroups.com>"
DEBIAN_DEPENDS = "localepurge"
-SRC_URI = "file://locale.debconf \
- file://locale.gen \
- file://postinst"
+SRC_URI = "file://postinst"
inherit dpkg-raw
+LOCALE_GEN ?= "en_US.UTF-8 UTF-8\n\
+ en_US ISO-8859-1\n"
+LOCALE_DEFAULT ?= "en_US.UTF-8"
+
+def get_locale_gen(d):
+ locale_gen = d.getVar("LOCALE_GEN", True) or ""
+ return ', '.join(sorted(set(i.strip()
+ for i in locale_gen.split('\\n'))))
+
+def get_nopurge(d):
+ locale_gen = d.getVar("LOCALE_GEN", True) or ""
+ return ', '.join(sorted(set(i.strip()
+ for j in locale_gen.split('\\n')
+ for i in (j.split()[0].split("_")[0],
+ j.split()[0].split(".")[0],
+ j.split()[0]))))
+
+do_gen_config[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}"
+do_gen_config() {
+ cat<<-__EOF__ > ${WORKDIR}/locale.gen
+ ${@(d.getVar("LOCALE_GEN", True) or "").replace('\\n','\n')}
+ __EOF__
+ cat<<-__EOF__ > ${WORKDIR}/locale.debconf
+ locales locales/locales_to_be_generated multiselect ${@get_locale_gen(d)}
+ locales locales/default_environment_locale select ${LOCALE_DEFAULT}
+
+ localepurge localepurge/dontbothernew boolean true
+ localepurge localepurge/nopurge multiselect ${@get_nopurge(d)}
+ localepurge localepurge/use-dpkg-feature boolean false
+ localepurge localepurge/verbose boolean false
+ localepurge localepurge/showfreedspace boolean false
+ localepurge localepurge/none_selected boolean false
+ localepurge localepurge/mandelete boolean true
+ localepurge localepurge/quickndirtycalc boolean false
+ localepurge localepurge/remove_no note
+ __EOF__
+}
+addtask gen_config after do_unpack before do_install
+
do_install() {
install -v -d ${D}/usr/lib/${PN}
install -v -m 644 ${WORKDIR}/locale.debconf \
--
2.17.0
next prev parent reply other threads:[~2018-05-29 15:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-29 15:15 [PATCH 0/1] Improve isar-cfg-localepurge claudius.heine.ext
2018-05-29 15:15 ` claudius.heine.ext [this message]
2018-05-30 8:23 ` [PATCH 1/1] meta/isar-cfg-localepurge: move locale configuration inside bb Claudius Heine
2018-05-30 8:38 ` Maxim Yu. Osipov
2018-05-30 10:32 ` Claudius Heine
2018-05-30 11:11 ` [PATCH 0/1] Improve isar-cfg-localepurge Claudius Heine
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180529151527.6090-2-claudius.heine.ext@siemens.com \
--to=claudius.heine.ext@siemens.com \
--cc=ch@denx.de \
--cc=isar-users@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox