public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Claudius Heine <claudius.heine.ext@siemens.com>
To: Alexander Smirnov <asmirnov@ilbers.de>, isar-users@googlegroups.com
Subject: Re: [PATCH 1/2] isar-bootsrtap: Setup locale
Date: Tue, 22 May 2018 10:04:40 +0200	[thread overview]
Message-ID: <6795a2f7-77b3-1d35-be67-858995018164@siemens.com> (raw)
In-Reply-To: <20180515153052.4946-2-asmirnov@ilbers.de>

Hi Alex,

On 2018-05-15 17:30, Alexander Smirnov wrote:
> Currently locale is set in config scripts for buildchroot and images.
> This is absolutely the same routine which is duplicated in all these
> scripts. This patch moves locale initialization to isar-bootstrap, so
> now locale is set once and works for all the futher root filesystems.
> 
> The task do_set_locale is added right after do_bootstrap to avoid warning
> messages in isar-bootstrap logs after 'apt-get' calls.
> 
> Signed-off-by: Alexander Smirnov <asmirnov@ilbers.de>
> ---
>   .../images/files/debian-configscript.sh            | 22 --------------------
>   .../images/files/raspbian-configscript.sh          | 22 --------------------
>   meta/recipes-core/isar-bootstrap/files/locale      |  4 ++++
>   .../isar-bootstrap/files/locale.nopurge            | 10 +++++++++
>   meta/recipes-core/isar-bootstrap/isar-bootstrap.bb | 13 ++++++++++--
>   .../buildchroot/files/configscript.sh              | 24 +---------------------
>   6 files changed, 26 insertions(+), 69 deletions(-)
>   create mode 100644 meta/recipes-core/isar-bootstrap/files/locale
>   create mode 100644 meta/recipes-core/isar-bootstrap/files/locale.nopurge
> 
> diff --git a/meta-isar/recipes-core/images/files/debian-configscript.sh b/meta-isar/recipes-core/images/files/debian-configscript.sh
> index 042b530..7ca0562 100755
> --- a/meta-isar/recipes-core/images/files/debian-configscript.sh
> +++ b/meta-isar/recipes-core/images/files/debian-configscript.sh
> @@ -10,28 +10,6 @@ readonly BAUDRATE_TTY="$2"
>   readonly ROOTFS_DEV="$3"
>   readonly ROOTFS_TYPE="$4"
>   
> -cat >> /etc/default/locale << EOF
> -LANG=en_US.UTF-8
> -LANGUAGE=en_US.UTF-8
> -LC_ALL=C
> -LC_CTYPE=C
> -EOF
> -
> -## Configuration file for localepurge(8)
> -cat > /etc/locale.nopurge << EOF
> -
> -# Remove localized man pages
> -MANDELETE
> -
> -# Delete new locales which appear on the system without bothering you
> -DONTBOTHERNEWLOCALE
> -
> -# Keep these locales after package installations via apt-get(8)
> -en
> -en_US
> -en_US.UTF-8
> -EOF
> -
>   debconf-set-selections <<END
>   locales locales/locales_to_be_generated multiselect en_US.UTF-8 UTF-8
>   locales locales/default_environment_locale select en_US.UTF-8
> diff --git a/meta-isar/recipes-core/images/files/raspbian-configscript.sh b/meta-isar/recipes-core/images/files/raspbian-configscript.sh
> index ec05a6b..b240de9 100644
> --- a/meta-isar/recipes-core/images/files/raspbian-configscript.sh
> +++ b/meta-isar/recipes-core/images/files/raspbian-configscript.sh
> @@ -10,28 +10,6 @@ readonly BAUDRATE_TTY="$2"
>   readonly ROOTFS_DEV="$3"
>   readonly ROOTFS_TYPE="$4"
>   
> -cat >> /etc/default/locale << EOF
> -LANG=en_US.UTF-8
> -LANGUAGE=en_US.UTF-8
> -LC_ALL=C
> -LC_CTYPE=C
> -EOF
> -
> -## Configuration file for localepurge(8)
> -cat > /etc/locale.nopurge << EOF
> -
> -# Remove localized man pages
> -MANDELETE
> -
> -# Delete new locales which appear on the system without bothering you
> -DONTBOTHERNEWLOCALE
> -
> -# Keep these locales after package installations via apt-get(8)
> -en
> -en_US
> -en_US.UTF-8
> -EOF
> -
>   debconf-set-selections <<END
>   locales locales/locales_to_be_generated multiselect en_US.UTF-8 UTF-8
>   locales locales/default_environment_locale select en_US.UTF-8
> diff --git a/meta/recipes-core/isar-bootstrap/files/locale b/meta/recipes-core/isar-bootstrap/files/locale
> new file mode 100644
> index 0000000..5b3a663
> --- /dev/null
> +++ b/meta/recipes-core/isar-bootstrap/files/locale
> @@ -0,0 +1,4 @@
> +LANG=en_US.UTF-8
> +LANGUAGE=en_US.UTF-8
> +LC_ALL=C
> +LC_CTYPE=C
> diff --git a/meta/recipes-core/isar-bootstrap/files/locale.nopurge b/meta/recipes-core/isar-bootstrap/files/locale.nopurge
> new file mode 100644
> index 0000000..510d40c
> --- /dev/null
> +++ b/meta/recipes-core/isar-bootstrap/files/locale.nopurge
> @@ -0,0 +1,10 @@
> +# Remove localized man pages
> +MANDELETE
> +
> +# Delete new locales which appear on the system without bothering you
> +DONTBOTHERNEWLOCALE
> +
> +# Keep these locales after package installations via apt-get(8)
> +en
> +en_US
> +en_US.UTF-8

I don't think that putting 'locale.nopurge' in every image is the right 
solution. That means that every image is configured for localepurge.

I'm working on a solution to allow configuration packages, that are 
installed and then purged from the image:

https://github.com/cmhe/isar/commit/624ee1278657689ad5ef493b345905308a340039

https://github.com/cmhe/isar/commit/765b6b09e32230cd6d1929fd9f54455cb4ff65fc

This is useful for one-shot configuration stuff like localepurge and 
maybe even the complete locale configuration.

But I do see the reason for setting *some* locale variables in the 
isar-bootstrap, that can be easily overwritten later on just to provide 
a baseline configuration that avoids those warnings.

Claudius


> diff --git a/meta/recipes-core/isar-bootstrap/isar-bootstrap.bb b/meta/recipes-core/isar-bootstrap/isar-bootstrap.bb
> index 35953b5..28ad395 100644
> --- a/meta/recipes-core/isar-bootstrap/isar-bootstrap.bb
> +++ b/meta/recipes-core/isar-bootstrap/isar-bootstrap.bb
> @@ -12,7 +12,9 @@ LIC_FILES_CHKSUM = "file://${LAYERDIR_isar}/licenses/COPYING.GPLv2;md5=751419260
>   FILESPATH_prepend := "${THISDIR}/files:"
>   SRC_URI = " \
>       file://isar-apt.conf \
> -    file://isar-apt-fallback.conf"
> +    file://isar-apt-fallback.conf \
> +    file://locale \
> +    file://locale.nopurge"
>   PV = "1.0"
>   
>   WORKDIR = "${TMPDIR}/work/${DISTRO}-${DISTRO_ARCH}/${PN}"
> @@ -183,6 +185,7 @@ do_bootstrap() {
>       sudo -E "${DEBOOTSTRAP}" --verbose \
>                                --variant=minbase \
>                                --arch="${DISTRO_ARCH}" \
> +                             --include=locales \
>                                ${@get_distro_components_argument(d)} \
>                                ${DEBOOTSTRAP_KEYRING} \
>                                "${@get_distro_suite(d)}" \
> @@ -191,6 +194,12 @@ do_bootstrap() {
>   }
>   addtask bootstrap before do_build after do_generate_keyring
>   
> +do_set_locale() {
> +    sudo install -v -m644 "${WORKDIR}/locale" "${ROOTFSDIR}/etc/locale"
> +    sudo install -v -m644 "${WORKDIR}/locale.nopurge" "${ROOTFSDIR}/etc/locale.nopurge"
> +}
> +addtask set_locale after do_bootstrap
> +
>   def get_host_release():
>       import platform
>       rel = platform.release()
> @@ -227,7 +236,7 @@ do_apt_update() {
>       sudo -E chroot "${ROOTFSDIR}" /usr/bin/apt-get dist-upgrade -y \
>                                         -o Debug::pkgProblemResolver=yes
>   }
> -addtask apt_update before do_build after do_apt_config_install
> +addtask apt_update before do_build after do_apt_config_install do_set_locale
>   
>   do_deploy[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}"
>   do_deploy[dirs] = "${DEPLOY_DIR_IMAGE}"
> diff --git a/meta/recipes-devtools/buildchroot/files/configscript.sh b/meta/recipes-devtools/buildchroot/files/configscript.sh
> index c2a599a..d591c2a 100644
> --- a/meta/recipes-devtools/buildchroot/files/configscript.sh
> +++ b/meta/recipes-devtools/buildchroot/files/configscript.sh
> @@ -1,32 +1,10 @@
>   #!/bin/sh
>   #
>   # This software is a part of ISAR.
> -# Copyright (C) 2015-2017 ilbers GmbH
> +# Copyright (C) 2015-2018 ilbers GmbH
>   
>   set -e
>   
> -cat >> /etc/default/locale << EOF
> -LANG=en_US.UTF-8
> -LANGUAGE=en_US.UTF-8
> -LC_ALL=C
> -LC_CTYPE=C
> -EOF
> -
> -## Configuration file for localepurge(8)
> -cat > /etc/locale.nopurge << EOF
> -
> -# Remove localized man pages
> -MANDELETE
> -
> -# Delete new locales which appear on the system without bothering you
> -DONTBOTHERNEWLOCALE
> -
> -# Keep these locales after package installations via apt-get(8)
> -en
> -en_US
> -en_US.UTF-8
> -EOF
> -
>   debconf-set-selections <<END
>   locales locales/locales_to_be_generated multiselect en_US.UTF-8 UTF-8
>   locales locales/default_environment_locale select en_US.UTF-8
> 

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-54 Fax: (+49)-8142-66989-80 Email: ch@denx.de

  reply	other threads:[~2018-05-22  8:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-15 15:30 [PATCH 0/2] Last fixes for locales Alexander Smirnov
2018-05-15 15:30 ` [PATCH 1/2] isar-bootsrtap: Setup locale Alexander Smirnov
2018-05-22  8:04   ` Claudius Heine [this message]
2018-05-15 15:30 ` [PATCH 2/2] isar-bootstrap: Generate en_US.UTF-8 locale Alexander Smirnov
2018-05-23 13:18 ` [PATCH 0/2] Last fixes for locales 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=6795a2f7-77b3-1d35-be67-858995018164@siemens.com \
    --to=claudius.heine.ext@siemens.com \
    --cc=asmirnov@ilbers.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