* [PATCH] tzdata: Make /etc/timezone optional
@ 2015-12-23 23:51 Haris Okanovic
2016-01-05 13:03 ` Burton, Ross
0 siblings, 1 reply; 7+ messages in thread
From: Haris Okanovic @ 2015-12-23 23:51 UTC (permalink / raw)
To: openembedded-core; +Cc: Haris Okanovic
Add INSTALL_TIMEZONE_FILE config variable to enable/disable installation
of ${sysconfdir}/timezone (/etc/timezone) by tzdata packages. Defaults
to "1" to maintain previous behavior.
Most libc implementations can be configured to retrieve system's
defaults timezone from /etc/localtime, and don't need a second file
(/etc/timezone) to express this configuration. Maintaining this file is
an unnecessary burden on sysadmins unless there's software using
/etc/timezone directly (I.e. outside of libc). Some distributions may
choose not to provide it.
Testing: Built tzdata under default config and verified CONFFILES_tzdata
still has both /etc/timezone and /etc/localtime and both are in the
image. Built with INSTALL_TIMEZONE_FILE = "0" and verified /etc/timezone
is removed from CONFFILES_tzdata and the image. Successfully installed
package to an x64 target.
Signed-off-by: Haris Okanovic <haris.okanovic@ni.com>
Natinst-ReviewBoard-ID: 121628
---
meta/recipes-extended/tzdata/tzdata_2015g.bb | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/meta/recipes-extended/tzdata/tzdata_2015g.bb b/meta/recipes-extended/tzdata/tzdata_2015g.bb
index 5b2afa6..ce1f5c2 100644
--- a/meta/recipes-extended/tzdata/tzdata_2015g.bb
+++ b/meta/recipes-extended/tzdata/tzdata_2015g.bb
@@ -21,6 +21,7 @@ RCONFLICTS_${PN} = "timezones timezone-africa timezone-america timezone-antarcti
S = "${WORKDIR}"
DEFAULT_TIMEZONE ?= "Universal"
+INSTALL_TIMEZONE_FILE ?= "1"
TZONES= "africa antarctica asia australasia europe northamerica southamerica \
factory etcetera backward systemv \
@@ -48,7 +49,9 @@ do_install () {
# Install default timezone
if [ -e ${D}${datadir}/zoneinfo/${DEFAULT_TIMEZONE} ]; then
install -d ${D}${sysconfdir}
- echo ${DEFAULT_TIMEZONE} > ${D}${sysconfdir}/timezone
+ if [ "${INSTALL_TIMEZONE_FILE}" == "1" ]; then
+ echo ${DEFAULT_TIMEZONE} > ${D}${sysconfdir}/timezone
+ fi
ln -s ${datadir}/zoneinfo/${DEFAULT_TIMEZONE} ${D}${sysconfdir}/localtime
else
bberror "DEFAULT_TIMEZONE is set to an invalid value."
@@ -205,4 +208,5 @@ FILES_${PN} += "${datadir}/zoneinfo/Pacific/Honolulu \
${datadir}/zoneinfo/iso3166.tab \
${datadir}/zoneinfo/Etc/*"
-CONFFILES_${PN} += "${sysconfdir}/timezone ${sysconfdir}/localtime"
+CONFFILES_${PN} += "${@['','${sysconfdir}/timezone'][d.getVar('INSTALL_TIMEZONE_FILE', True) == '1']}"
+CONFFILES_${PN} += "${sysconfdir}/localtime"
--
2.6.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] tzdata: Make /etc/timezone optional
2015-12-23 23:51 [PATCH] tzdata: Make /etc/timezone optional Haris Okanovic
@ 2016-01-05 13:03 ` Burton, Ross
2016-01-05 19:03 ` Haris Okanovic
2016-01-05 19:04 ` [PATCH v2] " Haris Okanovic
0 siblings, 2 replies; 7+ messages in thread
From: Burton, Ross @ 2016-01-05 13:03 UTC (permalink / raw)
To: Haris Okanovic; +Cc: OE-core
[-- Attachment #1: Type: text/plain, Size: 524 bytes --]
On 23 December 2015 at 23:51, Haris Okanovic <haris.okanovic@ni.com> wrote:
> +CONFFILES_${PN} +=
> "${@['','${sysconfdir}/timezone'][d.getVar('INSTALL_TIMEZONE_FILE', True)
> == '1']}"
>
This idiom (indexing an array by a coerced boolean) is pretty difficult to
read and bitbake has a helper function to turn a string into a bool, so I
find something like this a lot easier to read:
${@"${sysconfdir}/timezone" if
bb.utils.to_boolean(d.getVar("INSTALL_TIMEZONE_FILE", True)) else ""}
(untested!)
Ross
[-- Attachment #2: Type: text/html, Size: 1119 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] tzdata: Make /etc/timezone optional
2016-01-05 13:03 ` Burton, Ross
@ 2016-01-05 19:03 ` Haris Okanovic
2016-01-05 19:04 ` [PATCH v2] " Haris Okanovic
1 sibling, 0 replies; 7+ messages in thread
From: Haris Okanovic @ 2016-01-05 19:03 UTC (permalink / raw)
To: Burton, Ross; +Cc: OE-core
On 01/05/2016 07:03 AM, Burton, Ross wrote:
>
> On 23 December 2015 at 23:51, Haris Okanovic <haris.okanovic@ni.com
> <mailto:haris.okanovic@ni.com>> wrote:
>
> +CONFFILES_${PN} +=
> "${@['','${sysconfdir}/timezone'][d.getVar('INSTALL_TIMEZONE_FILE',
> True) == '1']}"
>
>
> This idiom (indexing an array by a coerced boolean) is pretty difficult
> to read and bitbake has a helper function to turn a string into a bool,
> so I find something like this a lot easier to read:
>
> ${@"${sysconfdir}/timezone" if
> bb.utils.to_boolean(d.getVar("INSTALL_TIMEZONE_FILE", True)) else ""}
>
> (untested!)
I agree the alternative is much easier to read, and verified it works as
expected. Posting V2 shortly.
Thanks for looking into it!
-- Haris
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2] tzdata: Make /etc/timezone optional
2016-01-05 13:03 ` Burton, Ross
2016-01-05 19:03 ` Haris Okanovic
@ 2016-01-05 19:04 ` Haris Okanovic
2016-01-12 4:03 ` Andre McCurdy
1 sibling, 1 reply; 7+ messages in thread
From: Haris Okanovic @ 2016-01-05 19:04 UTC (permalink / raw)
To: openembedded-core; +Cc: Haris Okanovic
Add INSTALL_TIMEZONE_FILE config variable to enable/disable installation
of ${sysconfdir}/timezone (/etc/timezone) by tzdata packages. Defaults
to "1" to maintain previous behavior.
Most libc implementations can be configured to retrieve system's
defaults timezone from /etc/localtime, and don't need a second file
(/etc/timezone) to express this configuration. Maintaining this file is
an unnecessary burden on sysadmins unless there's software using
/etc/timezone directly (I.e. outside of libc). Some distributions may
choose not to provide it.
Testing: Built tzdata under default config and verified CONFFILES_tzdata
still has both /etc/timezone and /etc/localtime and both are in the
image. Built with INSTALL_TIMEZONE_FILE = "0" and verified /etc/timezone
is removed from CONFFILES_tzdata and the image. Successfully installed
package to an x64 target.
Signed-off-by: Haris Okanovic <haris.okanovic@ni.com>
Reviewed-by: Brad Mouring <brad.mouring@ni.com>
Reviewed-by: Rich Tollerton <rich.tollerton@ni.com>
Reviewed-by: Ken Sharp <ken.sharp@ni.com>
Reviewed-by: Ross Burton <ross.burton@intel.com>
Natinst-ReviewBoard-ID: 121628
---
meta/recipes-extended/tzdata/tzdata_2015g.bb | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/meta/recipes-extended/tzdata/tzdata_2015g.bb b/meta/recipes-extended/tzdata/tzdata_2015g.bb
index 5b2afa6..a6faa1d 100644
--- a/meta/recipes-extended/tzdata/tzdata_2015g.bb
+++ b/meta/recipes-extended/tzdata/tzdata_2015g.bb
@@ -21,6 +21,7 @@ RCONFLICTS_${PN} = "timezones timezone-africa timezone-america timezone-antarcti
S = "${WORKDIR}"
DEFAULT_TIMEZONE ?= "Universal"
+INSTALL_TIMEZONE_FILE ?= "1"
TZONES= "africa antarctica asia australasia europe northamerica southamerica \
factory etcetera backward systemv \
@@ -48,7 +49,9 @@ do_install () {
# Install default timezone
if [ -e ${D}${datadir}/zoneinfo/${DEFAULT_TIMEZONE} ]; then
install -d ${D}${sysconfdir}
- echo ${DEFAULT_TIMEZONE} > ${D}${sysconfdir}/timezone
+ if [ "${INSTALL_TIMEZONE_FILE}" == "1" ]; then
+ echo ${DEFAULT_TIMEZONE} > ${D}${sysconfdir}/timezone
+ fi
ln -s ${datadir}/zoneinfo/${DEFAULT_TIMEZONE} ${D}${sysconfdir}/localtime
else
bberror "DEFAULT_TIMEZONE is set to an invalid value."
@@ -205,4 +208,5 @@ FILES_${PN} += "${datadir}/zoneinfo/Pacific/Honolulu \
${datadir}/zoneinfo/iso3166.tab \
${datadir}/zoneinfo/Etc/*"
-CONFFILES_${PN} += "${sysconfdir}/timezone ${sysconfdir}/localtime"
+CONFFILES_${PN} += "${@ "${sysconfdir}/timezone" if bb.utils.to_boolean(d.getVar('INSTALL_TIMEZONE_FILE', True)) else "" }"
+CONFFILES_${PN} += "${sysconfdir}/localtime"
--
2.6.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2] tzdata: Make /etc/timezone optional
2016-01-05 19:04 ` [PATCH v2] " Haris Okanovic
@ 2016-01-12 4:03 ` Andre McCurdy
2016-01-12 10:24 ` Burton, Ross
0 siblings, 1 reply; 7+ messages in thread
From: Andre McCurdy @ 2016-01-12 4:03 UTC (permalink / raw)
To: Haris Okanovic; +Cc: OE Core mailing list
On Tue, Jan 5, 2016 at 11:04 AM, Haris Okanovic <haris.okanovic@ni.com> wrote:
> Add INSTALL_TIMEZONE_FILE config variable to enable/disable installation
> of ${sysconfdir}/timezone (/etc/timezone) by tzdata packages. Defaults
> to "1" to maintain previous behavior.
>
> Most libc implementations can be configured to retrieve system's
> defaults timezone from /etc/localtime, and don't need a second file
> (/etc/timezone) to express this configuration. Maintaining this file is
> an unnecessary burden on sysadmins unless there's software using
> /etc/timezone directly (I.e. outside of libc). Some distributions may
> choose not to provide it.
>
> Testing: Built tzdata under default config and verified CONFFILES_tzdata
> still has both /etc/timezone and /etc/localtime and both are in the
> image. Built with INSTALL_TIMEZONE_FILE = "0" and verified /etc/timezone
> is removed from CONFFILES_tzdata and the image. Successfully installed
> package to an x64 target.
>
> Signed-off-by: Haris Okanovic <haris.okanovic@ni.com>
> Reviewed-by: Brad Mouring <brad.mouring@ni.com>
> Reviewed-by: Rich Tollerton <rich.tollerton@ni.com>
> Reviewed-by: Ken Sharp <ken.sharp@ni.com>
> Reviewed-by: Ross Burton <ross.burton@intel.com>
> Natinst-ReviewBoard-ID: 121628
> ---
> meta/recipes-extended/tzdata/tzdata_2015g.bb | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/meta/recipes-extended/tzdata/tzdata_2015g.bb b/meta/recipes-extended/tzdata/tzdata_2015g.bb
> index 5b2afa6..a6faa1d 100644
> --- a/meta/recipes-extended/tzdata/tzdata_2015g.bb
> +++ b/meta/recipes-extended/tzdata/tzdata_2015g.bb
> @@ -21,6 +21,7 @@ RCONFLICTS_${PN} = "timezones timezone-africa timezone-america timezone-antarcti
> S = "${WORKDIR}"
>
> DEFAULT_TIMEZONE ?= "Universal"
> +INSTALL_TIMEZONE_FILE ?= "1"
>
> TZONES= "africa antarctica asia australasia europe northamerica southamerica \
> factory etcetera backward systemv \
> @@ -48,7 +49,9 @@ do_install () {
> # Install default timezone
> if [ -e ${D}${datadir}/zoneinfo/${DEFAULT_TIMEZONE} ]; then
> install -d ${D}${sysconfdir}
> - echo ${DEFAULT_TIMEZONE} > ${D}${sysconfdir}/timezone
> + if [ "${INSTALL_TIMEZONE_FILE}" == "1" ]; then
You lose a style point for == in a shell script...
> + echo ${DEFAULT_TIMEZONE} > ${D}${sysconfdir}/timezone
> + fi
> ln -s ${datadir}/zoneinfo/${DEFAULT_TIMEZONE} ${D}${sysconfdir}/localtime
> else
> bberror "DEFAULT_TIMEZONE is set to an invalid value."
> @@ -205,4 +208,5 @@ FILES_${PN} += "${datadir}/zoneinfo/Pacific/Honolulu \
> ${datadir}/zoneinfo/iso3166.tab \
> ${datadir}/zoneinfo/Etc/*"
>
> -CONFFILES_${PN} += "${sysconfdir}/timezone ${sysconfdir}/localtime"
> +CONFFILES_${PN} += "${@ "${sysconfdir}/timezone" if bb.utils.to_boolean(d.getVar('INSTALL_TIMEZONE_FILE', True)) else "" }"
> +CONFFILES_${PN} += "${sysconfdir}/localtime"
> --
> 2.6.2
>
> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2] tzdata: Make /etc/timezone optional
2016-01-12 4:03 ` Andre McCurdy
@ 2016-01-12 10:24 ` Burton, Ross
2016-01-12 16:25 ` Haris Okanovic
0 siblings, 1 reply; 7+ messages in thread
From: Burton, Ross @ 2016-01-12 10:24 UTC (permalink / raw)
To: Andre McCurdy; +Cc: Haris Okanovic, OE Core mailing list
[-- Attachment #1: Type: text/plain, Size: 216 bytes --]
On 12 January 2016 at 04:03, Andre McCurdy <armccurdy@gmail.com> wrote:
> You lose a style point for == in a shell script...
>
Patch sent. We really need to scan for bashisms in our shell fragments.
Ross
[-- Attachment #2: Type: text/html, Size: 603 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2] tzdata: Make /etc/timezone optional
2016-01-12 10:24 ` Burton, Ross
@ 2016-01-12 16:25 ` Haris Okanovic
0 siblings, 0 replies; 7+ messages in thread
From: Haris Okanovic @ 2016-01-12 16:25 UTC (permalink / raw)
To: Burton, Ross, Andre McCurdy; +Cc: OE Core mailing list
On 01/12/2016 04:24 AM, Burton, Ross wrote:
>
> On 12 January 2016 at 04:03, Andre McCurdy <armccurdy@gmail.com
> <mailto:armccurdy@gmail.com>> wrote:
>
> You lose a style point for == in a shell script...
>
> Patch sent. We really need to scan for bashisms in our shell fragments.
Bah, my bad. Perhaps we can run checkbashisms in QA.
http://linux.die.net/man/1/checkbashisms
-- Haris
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2016-01-12 16:26 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-23 23:51 [PATCH] tzdata: Make /etc/timezone optional Haris Okanovic
2016-01-05 13:03 ` Burton, Ross
2016-01-05 19:03 ` Haris Okanovic
2016-01-05 19:04 ` [PATCH v2] " Haris Okanovic
2016-01-12 4:03 ` Andre McCurdy
2016-01-12 10:24 ` Burton, Ross
2016-01-12 16:25 ` Haris Okanovic
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.