All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tzdata_2011n: provide pkg_postinst and timezone defaults
@ 2012-01-14 13:07 Andrea Adami
  2012-01-14 15:10 ` Koen Kooi
  2012-01-28  7:57 ` [PATCH v2] " Andrea Adami
  0 siblings, 2 replies; 13+ messages in thread
From: Andrea Adami @ 2012-01-14 13:07 UTC (permalink / raw)
  To: openembedded-core

* Take the extra bits in do_install from meta-openembedded
* and add pkg_postinst script (adapted from Gentoo).
* Default to 'Universal' timezone, present in the base package
* and allow override using DEFAULT_TIMEZONE variable.
* /etc/localtime and /etc/timezone are purposedly not packaged.
* Bump PR

Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
---
 meta/recipes-extended/tzdata/tzdata_2011n.bb |   55 +++++++++++++++++++++++++-
 1 files changed, 53 insertions(+), 2 deletions(-)

diff --git a/meta/recipes-extended/tzdata/tzdata_2011n.bb b/meta/recipes-extended/tzdata/tzdata_2011n.bb
index de9281a..862a196 100644
--- a/meta/recipes-extended/tzdata/tzdata_2011n.bb
+++ b/meta/recipes-extended/tzdata/tzdata_2011n.bb
@@ -5,7 +5,7 @@ LICENSE = "PD"
 LIC_FILES_CHKSUM = "file://asia;beginline=2;endline=3;md5=06468c0e84ef4d4c97045a4a29b08234"
 DEPENDS = "tzcode-native"
 
-PR = "r0"
+PR = "r1"
 
 RCONFLICTS= "timezones timezone-africa timezone-america timezone-antarctica \
              timezone-arctic timezone-asia timezone-atlantic \
@@ -19,6 +19,8 @@ SRC_URI[tzdata.sha256sum] = "a343e542486b2b8ebdeca474eed79f1c04f69420ca943c2b9bd
 
 S = "${WORKDIR}"
 
+DEFAULT_TIMEZONE ?= "Universal"
+
 TZONES= "africa antarctica asia australasia europe northamerica southamerica  \
          factory solar87 solar88 solar89 etcetera backward systemv \
         "
@@ -41,7 +43,56 @@ do_install () {
         # libc is removing zoneinfo files from package
         cp -pP "${S}/zone.tab" ${D}${datadir}/zoneinfo
         cp -pP "${S}/iso3166.tab" ${D}${datadir}/zoneinfo
-	chown -R root:root ${D}
+
+        # Install defaults
+        install -d ${D}${sysconfdir}
+        echo ${DEFAULT_TIMEZONE} > ${D}${sysconfdir}/timezone
+        cp -pP ${S}/${datadir}/zoneinfo/${DEFAULT_TIMEZONE} ${D}${sysconfdir}/localtime
+
+        chown -R root:root ${D}
+}
+
+pkg_postinst_${PN} () {
+
+# code taken from Gentoo's tzdata ebuild
+
+	etc_lt="${sysconfdir}/localtime"
+	src="${sysconfdir}/timezone"
+
+	if [[ -e ${src} ]] ; then
+		tz=$(sed -e 's:#.*::' -e 's:[[:space:]]*::g' -e '/^$/d' "${src}")
+	else
+		tz="FUBAR"
+	fi
+	
+	[[ -z ${tz} ]] && return 0
+
+	if [[ ${tz} == "FUBAR" ]] ; then
+		echo "You do not have TIMEZONE set in ${src}."
+
+		if [[ ! -e ${etc_lt} ]] ; then
+			# if /etc/localtime is a symlink somewhere, assume they
+			# know what they're doing and they're managing it themselves
+			if [[ ! -L ${etc_lt} ]] ; then
+				cp -f "${datadir}/zoneinfo/Universal" "${etc_lt}"
+				echo "Setting ${etc_lt} to Universal."
+			else
+				echo "Assuming your ${etc_lt} symlink is what you want; skipping update."
+			fi
+		else
+			echo "Skipping auto-update of ${etc_lt}."
+		fi
+		return 0
+	fi
+
+	if [[ ! -e "${datadir}/zoneinfo/${tz}" ]] ; then
+		echo "You have an invalid TIMEZONE setting in ${src}"
+		echo "Your ${etc_lt} has been reset to Universal; enjoy!"
+		tz="Universal"
+	fi
+	echo "Updating ${etc_lt} with ${datadir}/zoneinfo/${tz}"
+	[[ -L ${etc_lt} ]] && rm -f "${etc_lt}"
+	cp -f "${datadir}/zoneinfo/${tz}" "${etc_lt}"
 }
 
 # Packages primarily organized by directory with a major city
-- 
1.7.3.4




^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH] tzdata_2011n: provide pkg_postinst and timezone defaults
  2012-01-14 13:07 [PATCH] tzdata_2011n: provide pkg_postinst and timezone defaults Andrea Adami
@ 2012-01-14 15:10 ` Koen Kooi
  2012-01-14 15:54   ` Eric Bénard
  2012-01-15 11:17   ` Andrea Adami
  2012-01-28  7:57 ` [PATCH v2] " Andrea Adami
  1 sibling, 2 replies; 13+ messages in thread
From: Koen Kooi @ 2012-01-14 15:10 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer


Op 14 jan. 2012, om 14:07 heeft Andrea Adami het volgende geschreven:

> * Take the extra bits in do_install from meta-openembedded
> * and add pkg_postinst script (adapted from Gentoo).
> * Default to 'Universal' timezone, present in the base package
> * and allow override using DEFAULT_TIMEZONE variable.
> * /etc/localtime and /etc/timezone are purposedly not packaged.
> * Bump PR
> 
> Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
> ---
> meta/recipes-extended/tzdata/tzdata_2011n.bb |   55 +++++++++++++++++++++++++-
> 1 files changed, 53 insertions(+), 2 deletions(-)
> 
> diff --git a/meta/recipes-extended/tzdata/tzdata_2011n.bb b/meta/recipes-extended/tzdata/tzdata_2011n.bb
> index de9281a..862a196 100644
> --- a/meta/recipes-extended/tzdata/tzdata_2011n.bb
> +++ b/meta/recipes-extended/tzdata/tzdata_2011n.bb
> @@ -5,7 +5,7 @@ LICENSE = "PD"
> LIC_FILES_CHKSUM = "file://asia;beginline=2;endline=3;md5=06468c0e84ef4d4c97045a4a29b08234"
> DEPENDS = "tzcode-native"
> 
> -PR = "r0"
> +PR = "r1"
> 
> RCONFLICTS= "timezones timezone-africa timezone-america timezone-antarctica \
>              timezone-arctic timezone-asia timezone-atlantic \
> @@ -19,6 +19,8 @@ SRC_URI[tzdata.sha256sum] = "a343e542486b2b8ebdeca474eed79f1c04f69420ca943c2b9bd
> 
> S = "${WORKDIR}"
> 
> +DEFAULT_TIMEZONE ?= "Universal"
> +
> TZONES= "africa antarctica asia australasia europe northamerica southamerica  \
>          factory solar87 solar88 solar89 etcetera backward systemv \
>         "
> @@ -41,7 +43,56 @@ do_install () {
>         # libc is removing zoneinfo files from package
>         cp -pP "${S}/zone.tab" ${D}${datadir}/zoneinfo
>         cp -pP "${S}/iso3166.tab" ${D}${datadir}/zoneinfo
> -	chown -R root:root ${D}
> +
> +        # Install defaults
> +        install -d ${D}${sysconfdir}
> +        echo ${DEFAULT_TIMEZONE} > ${D}${sysconfdir}/timezone
> +        cp -pP ${S}/${datadir}/zoneinfo/${DEFAULT_TIMEZONE} ${D}${sysconfdir}/localtime

Shouldn't that be an 'ln -sf' instead of a 'cp'?




^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] tzdata_2011n: provide pkg_postinst and timezone defaults
  2012-01-14 15:10 ` Koen Kooi
@ 2012-01-14 15:54   ` Eric Bénard
  2012-01-14 19:16     ` Koen Kooi
  2012-01-15 11:17   ` Andrea Adami
  1 sibling, 1 reply; 13+ messages in thread
From: Eric Bénard @ 2012-01-14 15:54 UTC (permalink / raw)
  To: openembedded-core

Le Sat, 14 Jan 2012 16:10:55 +0100,
Koen Kooi <koen@dominion.thruhere.net> a écrit :
> > +        # Install defaults
> > +        install -d ${D}${sysconfdir}
> > +        echo ${DEFAULT_TIMEZONE} > ${D}${sysconfdir}/timezone
> > +        cp -pP ${S}/${datadir}/zoneinfo/${DEFAULT_TIMEZONE} ${D}${sysconfdir}/localtime
> 
> Shouldn't that be an 'ln -sf' instead of a 'cp'?
> 
that would make a link from ${D} to ${S}

Eric



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] tzdata_2011n: provide pkg_postinst and timezone defaults
  2012-01-14 15:54   ` Eric Bénard
@ 2012-01-14 19:16     ` Koen Kooi
  0 siblings, 0 replies; 13+ messages in thread
From: Koen Kooi @ 2012-01-14 19:16 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer


Op 14 jan. 2012, om 16:54 heeft Eric Bénard het volgende geschreven:

> Le Sat, 14 Jan 2012 16:10:55 +0100,
> Koen Kooi <koen@dominion.thruhere.net> a écrit :
>>> +        # Install defaults
>>> +        install -d ${D}${sysconfdir}
>>> +        echo ${DEFAULT_TIMEZONE} > ${D}${sysconfdir}/timezone
>>> +        cp -pP ${S}/${datadir}/zoneinfo/${DEFAULT_TIMEZONE} ${D}${sysconfdir}/localtime
>> 
>> Shouldn't that be an 'ln -sf' instead of a 'cp'?
>> 
> that would make a link from ${D} to ${S}

How about this one:

if [ -e ${S}/${datadir}/zoneinfo/${DEFAULT_TIMEZONE} ] ; then
	ln -sf ${datadir}/zoneinfo/${DEFAULT_TIMEZONE} ${D}${sysconfdir}/localtime
else
	echo "Timezone ${DEFAULT_TIMEZONE} not found, exiting"
	exit 1
fi




^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] tzdata_2011n: provide pkg_postinst and timezone defaults
  2012-01-14 15:10 ` Koen Kooi
  2012-01-14 15:54   ` Eric Bénard
@ 2012-01-15 11:17   ` Andrea Adami
  2012-01-15 11:22     ` Koen Kooi
  1 sibling, 1 reply; 13+ messages in thread
From: Andrea Adami @ 2012-01-15 11:17 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer

On Sat, Jan 14, 2012 at 4:10 PM, Koen Kooi <koen@dominion.thruhere.net> wrote:
>
> Op 14 jan. 2012, om 14:07 heeft Andrea Adami het volgende geschreven:
>
>> * Take the extra bits in do_install from meta-openembedded
>> * and add pkg_postinst script (adapted from Gentoo).
>> * Default to 'Universal' timezone, present in the base package
>> * and allow override using DEFAULT_TIMEZONE variable.
>> * /etc/localtime and /etc/timezone are purposedly not packaged.
>> * Bump PR
>>
>> Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
>> ---
>> meta/recipes-extended/tzdata/tzdata_2011n.bb |   55 +++++++++++++++++++++++++-
>> 1 files changed, 53 insertions(+), 2 deletions(-)
>>
>> diff --git a/meta/recipes-extended/tzdata/tzdata_2011n.bb b/meta/recipes-extended/tzdata/tzdata_2011n.bb
>> index de9281a..862a196 100644
>> --- a/meta/recipes-extended/tzdata/tzdata_2011n.bb
>> +++ b/meta/recipes-extended/tzdata/tzdata_2011n.bb
>> @@ -5,7 +5,7 @@ LICENSE = "PD"
>> LIC_FILES_CHKSUM = "file://asia;beginline=2;endline=3;md5=06468c0e84ef4d4c97045a4a29b08234"
>> DEPENDS = "tzcode-native"
>>
>> -PR = "r0"
>> +PR = "r1"
>>
>> RCONFLICTS= "timezones timezone-africa timezone-america timezone-antarctica \
>>              timezone-arctic timezone-asia timezone-atlantic \
>> @@ -19,6 +19,8 @@ SRC_URI[tzdata.sha256sum] = "a343e542486b2b8ebdeca474eed79f1c04f69420ca943c2b9bd
>>
>> S = "${WORKDIR}"
>>
>> +DEFAULT_TIMEZONE ?= "Universal"
>> +
>> TZONES= "africa antarctica asia australasia europe northamerica southamerica  \
>>          factory solar87 solar88 solar89 etcetera backward systemv \
>>         "
>> @@ -41,7 +43,56 @@ do_install () {
>>         # libc is removing zoneinfo files from package
>>         cp -pP "${S}/zone.tab" ${D}${datadir}/zoneinfo
>>         cp -pP "${S}/iso3166.tab" ${D}${datadir}/zoneinfo
>> -     chown -R root:root ${D}
>> +
>> +        # Install defaults
>> +        install -d ${D}${sysconfdir}
>> +        echo ${DEFAULT_TIMEZONE} > ${D}${sysconfdir}/timezone
>> +        cp -pP ${S}/${datadir}/zoneinfo/${DEFAULT_TIMEZONE} ${D}${sysconfdir}/localtime
>
> Shouldn't that be an 'ln -sf' instead of a 'cp'?
>
No, I don't think so.First reason is /usr may not be mounted, maybe
living on another device..
See first Google link about this:
http://www.redhat.com/archives/rhl-devel-list/2006-April/msg00017.html
Then, as you see, the postinst takes care of both cases.

Thanks for reviewing

Regards

Andrea


P.S. I have indeed a doubt, about  " # libc is removing zoneinfo files
from package ". This will be a second patch maybe.


>
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] tzdata_2011n: provide pkg_postinst and timezone defaults
  2012-01-15 11:17   ` Andrea Adami
@ 2012-01-15 11:22     ` Koen Kooi
  2012-01-23 14:21       ` Andrea Adami
  0 siblings, 1 reply; 13+ messages in thread
From: Koen Kooi @ 2012-01-15 11:22 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer


Op 15 jan. 2012, om 12:17 heeft Andrea Adami het volgende geschreven:

> On Sat, Jan 14, 2012 at 4:10 PM, Koen Kooi <koen@dominion.thruhere.net> wrote:
>> 
>> Op 14 jan. 2012, om 14:07 heeft Andrea Adami het volgende geschreven:
>> 
>>> * Take the extra bits in do_install from meta-openembedded
>>> * and add pkg_postinst script (adapted from Gentoo).
>>> * Default to 'Universal' timezone, present in the base package
>>> * and allow override using DEFAULT_TIMEZONE variable.
>>> * /etc/localtime and /etc/timezone are purposedly not packaged.
>>> * Bump PR
>>> 
>>> Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
>>> ---
>>> meta/recipes-extended/tzdata/tzdata_2011n.bb |   55 +++++++++++++++++++++++++-
>>> 1 files changed, 53 insertions(+), 2 deletions(-)
>>> 
>>> diff --git a/meta/recipes-extended/tzdata/tzdata_2011n.bb b/meta/recipes-extended/tzdata/tzdata_2011n.bb
>>> index de9281a..862a196 100644
>>> --- a/meta/recipes-extended/tzdata/tzdata_2011n.bb
>>> +++ b/meta/recipes-extended/tzdata/tzdata_2011n.bb
>>> @@ -5,7 +5,7 @@ LICENSE = "PD"
>>> LIC_FILES_CHKSUM = "file://asia;beginline=2;endline=3;md5=06468c0e84ef4d4c97045a4a29b08234"
>>> DEPENDS = "tzcode-native"
>>> 
>>> -PR = "r0"
>>> +PR = "r1"
>>> 
>>> RCONFLICTS= "timezones timezone-africa timezone-america timezone-antarctica \
>>>              timezone-arctic timezone-asia timezone-atlantic \
>>> @@ -19,6 +19,8 @@ SRC_URI[tzdata.sha256sum] = "a343e542486b2b8ebdeca474eed79f1c04f69420ca943c2b9bd
>>> 
>>> S = "${WORKDIR}"
>>> 
>>> +DEFAULT_TIMEZONE ?= "Universal"
>>> +
>>> TZONES= "africa antarctica asia australasia europe northamerica southamerica  \
>>>          factory solar87 solar88 solar89 etcetera backward systemv \
>>>         "
>>> @@ -41,7 +43,56 @@ do_install () {
>>>         # libc is removing zoneinfo files from package
>>>         cp -pP "${S}/zone.tab" ${D}${datadir}/zoneinfo
>>>         cp -pP "${S}/iso3166.tab" ${D}${datadir}/zoneinfo
>>> -     chown -R root:root ${D}
>>> +
>>> +        # Install defaults
>>> +        install -d ${D}${sysconfdir}
>>> +        echo ${DEFAULT_TIMEZONE} > ${D}${sysconfdir}/timezone
>>> +        cp -pP ${S}/${datadir}/zoneinfo/${DEFAULT_TIMEZONE} ${D}${sysconfdir}/localtime
>> 
>> Shouldn't that be an 'ln -sf' instead of a 'cp'?
>> 
> No, I don't think so.First reason is /usr may not be mounted, maybe
> living on another device..
> See first Google link about this:
> http://www.redhat.com/archives/rhl-devel-list/2006-April/msg00017.html
> Then, as you see, the postinst takes care of both cases.

That only applies to non-UTC times in RTC, which we don't use. And furthermore, no machine has /usr on a seperate partition since support for that is broken.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] tzdata_2011n: provide pkg_postinst and timezone defaults
  2012-01-15 11:22     ` Koen Kooi
@ 2012-01-23 14:21       ` Andrea Adami
  2012-01-23 16:49         ` Mark Hatle
  0 siblings, 1 reply; 13+ messages in thread
From: Andrea Adami @ 2012-01-23 14:21 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer

On Sun, Jan 15, 2012 at 12:22 PM, Koen Kooi <koen@dominion.thruhere.net> wrote:
>
> Op 15 jan. 2012, om 12:17 heeft Andrea Adami het volgende geschreven:
>
>> On Sat, Jan 14, 2012 at 4:10 PM, Koen Kooi <koen@dominion.thruhere.net> wrote:
>>>
>>> Op 14 jan. 2012, om 14:07 heeft Andrea Adami het volgende geschreven:
>>>
>>>> * Take the extra bits in do_install from meta-openembedded
>>>> * and add pkg_postinst script (adapted from Gentoo).
>>>> * Default to 'Universal' timezone, present in the base package
>>>> * and allow override using DEFAULT_TIMEZONE variable.
>>>> * /etc/localtime and /etc/timezone are purposedly not packaged.
>>>> * Bump PR
>>>>
>>>> Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
>>>> ---
>>>> meta/recipes-extended/tzdata/tzdata_2011n.bb |   55 +++++++++++++++++++++++++-
>>>> 1 files changed, 53 insertions(+), 2 deletions(-)
>>>>
>>>> diff --git a/meta/recipes-extended/tzdata/tzdata_2011n.bb b/meta/recipes-extended/tzdata/tzdata_2011n.bb
>>>> index de9281a..862a196 100644
>>>> --- a/meta/recipes-extended/tzdata/tzdata_2011n.bb
>>>> +++ b/meta/recipes-extended/tzdata/tzdata_2011n.bb
>>>> @@ -5,7 +5,7 @@ LICENSE = "PD"
>>>> LIC_FILES_CHKSUM = "file://asia;beginline=2;endline=3;md5=06468c0e84ef4d4c97045a4a29b08234"
>>>> DEPENDS = "tzcode-native"
>>>>
>>>> -PR = "r0"
>>>> +PR = "r1"
>>>>
>>>> RCONFLICTS= "timezones timezone-africa timezone-america timezone-antarctica \
>>>>              timezone-arctic timezone-asia timezone-atlantic \
>>>> @@ -19,6 +19,8 @@ SRC_URI[tzdata.sha256sum] = "a343e542486b2b8ebdeca474eed79f1c04f69420ca943c2b9bd
>>>>
>>>> S = "${WORKDIR}"
>>>>
>>>> +DEFAULT_TIMEZONE ?= "Universal"
>>>> +
>>>> TZONES= "africa antarctica asia australasia europe northamerica southamerica  \
>>>>          factory solar87 solar88 solar89 etcetera backward systemv \
>>>>         "
>>>> @@ -41,7 +43,56 @@ do_install () {
>>>>         # libc is removing zoneinfo files from package
>>>>         cp -pP "${S}/zone.tab" ${D}${datadir}/zoneinfo
>>>>         cp -pP "${S}/iso3166.tab" ${D}${datadir}/zoneinfo
>>>> -     chown -R root:root ${D}
>>>> +
>>>> +        # Install defaults
>>>> +        install -d ${D}${sysconfdir}
>>>> +        echo ${DEFAULT_TIMEZONE} > ${D}${sysconfdir}/timezone
>>>> +        cp -pP ${S}/${datadir}/zoneinfo/${DEFAULT_TIMEZONE} ${D}${sysconfdir}/localtime
>>>
>>> Shouldn't that be an 'ln -sf' instead of a 'cp'?
>>>
>> No, I don't think so.First reason is /usr may not be mounted, maybe
>> living on another device..
>> See first Google link about this:
>> http://www.redhat.com/archives/rhl-devel-list/2006-April/msg00017.html
>> Then, as you see, the postinst takes care of both cases.
>
> That only applies to non-UTC times in RTC, which we don't use. And furthermore, no machine has /usr on a seperate partition since support for that is broken.

I try to bump the thread before the sources get renamed ;)

About separation of exec_prefix, pls see

http://lists.linuxtogo.org/pipermail/openembedded-core/2012-January/015672.html
http://lists.linuxtogo.org/pipermail/openembedded-core/2012-January/015771.html

So, what is the position to take?  Symlink or copy?

Regards

Andrea


> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] tzdata_2011n: provide pkg_postinst and timezone defaults
  2012-01-23 14:21       ` Andrea Adami
@ 2012-01-23 16:49         ` Mark Hatle
  2012-01-27  8:56           ` Andrea Adami
  0 siblings, 1 reply; 13+ messages in thread
From: Mark Hatle @ 2012-01-23 16:49 UTC (permalink / raw)
  To: openembedded-core

On 1/23/12 8:21 AM, Andrea Adami wrote:
> On Sun, Jan 15, 2012 at 12:22 PM, Koen Kooi<koen@dominion.thruhere.net>  wrote:
>>
>> Op 15 jan. 2012, om 12:17 heeft Andrea Adami het volgende geschreven:
>>
>>> On Sat, Jan 14, 2012 at 4:10 PM, Koen Kooi<koen@dominion.thruhere.net>  wrote:
>>>>
>>>> Op 14 jan. 2012, om 14:07 heeft Andrea Adami het volgende geschreven:
>>>>
>>>>> * Take the extra bits in do_install from meta-openembedded
>>>>> * and add pkg_postinst script (adapted from Gentoo).
>>>>> * Default to 'Universal' timezone, present in the base package
>>>>> * and allow override using DEFAULT_TIMEZONE variable.
>>>>> * /etc/localtime and /etc/timezone are purposedly not packaged.
>>>>> * Bump PR
>>>>>
>>>>> Signed-off-by: Andrea Adami<andrea.adami@gmail.com>
>>>>> ---
>>>>> meta/recipes-extended/tzdata/tzdata_2011n.bb |   55 +++++++++++++++++++++++++-
>>>>> 1 files changed, 53 insertions(+), 2 deletions(-)
>>>>>
>>>>> diff --git a/meta/recipes-extended/tzdata/tzdata_2011n.bb b/meta/recipes-extended/tzdata/tzdata_2011n.bb
>>>>> index de9281a..862a196 100644
>>>>> --- a/meta/recipes-extended/tzdata/tzdata_2011n.bb
>>>>> +++ b/meta/recipes-extended/tzdata/tzdata_2011n.bb
>>>>> @@ -5,7 +5,7 @@ LICENSE = "PD"
>>>>> LIC_FILES_CHKSUM = "file://asia;beginline=2;endline=3;md5=06468c0e84ef4d4c97045a4a29b08234"
>>>>> DEPENDS = "tzcode-native"
>>>>>
>>>>> -PR = "r0"
>>>>> +PR = "r1"
>>>>>
>>>>> RCONFLICTS= "timezones timezone-africa timezone-america timezone-antarctica \
>>>>>               timezone-arctic timezone-asia timezone-atlantic \
>>>>> @@ -19,6 +19,8 @@ SRC_URI[tzdata.sha256sum] = "a343e542486b2b8ebdeca474eed79f1c04f69420ca943c2b9bd
>>>>>
>>>>> S = "${WORKDIR}"
>>>>>
>>>>> +DEFAULT_TIMEZONE ?= "Universal"
>>>>> +
>>>>> TZONES= "africa antarctica asia australasia europe northamerica southamerica  \
>>>>>           factory solar87 solar88 solar89 etcetera backward systemv \
>>>>>          "
>>>>> @@ -41,7 +43,56 @@ do_install () {
>>>>>          # libc is removing zoneinfo files from package
>>>>>          cp -pP "${S}/zone.tab" ${D}${datadir}/zoneinfo
>>>>>          cp -pP "${S}/iso3166.tab" ${D}${datadir}/zoneinfo
>>>>> -     chown -R root:root ${D}
>>>>> +
>>>>> +        # Install defaults
>>>>> +        install -d ${D}${sysconfdir}
>>>>> +        echo ${DEFAULT_TIMEZONE}>  ${D}${sysconfdir}/timezone
>>>>> +        cp -pP ${S}/${datadir}/zoneinfo/${DEFAULT_TIMEZONE} ${D}${sysconfdir}/localtime
>>>>
>>>> Shouldn't that be an 'ln -sf' instead of a 'cp'?
>>>>
>>> No, I don't think so.First reason is /usr may not be mounted, maybe
>>> living on another device..
>>> See first Google link about this:
>>> http://www.redhat.com/archives/rhl-devel-list/2006-April/msg00017.html
>>> Then, as you see, the postinst takes care of both cases.
>>
>> That only applies to non-UTC times in RTC, which we don't use. And furthermore, no machine has /usr on a seperate partition since support for that is broken.
>
> I try to bump the thread before the sources get renamed ;)
>
> About separation of exec_prefix, pls see
>
> http://lists.linuxtogo.org/pipermail/openembedded-core/2012-January/015672.html
> http://lists.linuxtogo.org/pipermail/openembedded-core/2012-January/015771.html
>
> So, what is the position to take?  Symlink or copy?

On other systems I've used.. the rule has been: hardlink (same disk) or copy. 
Since the symlink would point into /usr and that should usually be avoided (as 
mentioned above).

I thought there used to be a tool that would do the hardlink, if possible and 
then copy if not.. but I'm not sure if that is even reasonable with our image 
creation... (so copy is likely best answer then)

--Mark

> Regards
>
> Andrea
>
>
>> _______________________________________________
>> Openembedded-core mailing list
>> Openembedded-core@lists.openembedded.org
>> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
>
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core




^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] tzdata_2011n: provide pkg_postinst and timezone defaults
  2012-01-23 16:49         ` Mark Hatle
@ 2012-01-27  8:56           ` Andrea Adami
  2012-01-27  9:59             ` Richard Purdie
  0 siblings, 1 reply; 13+ messages in thread
From: Andrea Adami @ 2012-01-27  8:56 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer

On Mon, Jan 23, 2012 at 5:49 PM, Mark Hatle <mark.hatle@windriver.com> wrote:
> On 1/23/12 8:21 AM, Andrea Adami wrote:
>>
>> On Sun, Jan 15, 2012 at 12:22 PM, Koen Kooi<koen@dominion.thruhere.net>
>>  wrote:
>>>
>>>
>>> Op 15 jan. 2012, om 12:17 heeft Andrea Adami het volgende geschreven:
>>>
>>>> On Sat, Jan 14, 2012 at 4:10 PM, Koen Kooi<koen@dominion.thruhere.net>
>>>>  wrote:
>>>>>
>>>>>
>>>>> Op 14 jan. 2012, om 14:07 heeft Andrea Adami het volgende geschreven:
>>>>>
>>>>>> * Take the extra bits in do_install from meta-openembedded
>>>>>> * and add pkg_postinst script (adapted from Gentoo).
>>>>>> * Default to 'Universal' timezone, present in the base package
>>>>>> * and allow override using DEFAULT_TIMEZONE variable.
>>>>>> * /etc/localtime and /etc/timezone are purposedly not packaged.
>>>>>> * Bump PR
>>>>>>
>>>>>> Signed-off-by: Andrea Adami<andrea.adami@gmail.com>
>>>>>> ---
>>>>>> meta/recipes-extended/tzdata/tzdata_2011n.bb |   55
>>>>>> +++++++++++++++++++++++++-
>>>>>> 1 files changed, 53 insertions(+), 2 deletions(-)
>>>>>>
>>>>>> diff --git a/meta/recipes-extended/tzdata/tzdata_2011n.bb
>>>>>> b/meta/recipes-extended/tzdata/tzdata_2011n.bb
>>>>>> index de9281a..862a196 100644
>>>>>> --- a/meta/recipes-extended/tzdata/tzdata_2011n.bb
>>>>>> +++ b/meta/recipes-extended/tzdata/tzdata_2011n.bb
>>>>>> @@ -5,7 +5,7 @@ LICENSE = "PD"
>>>>>> LIC_FILES_CHKSUM =
>>>>>> "file://asia;beginline=2;endline=3;md5=06468c0e84ef4d4c97045a4a29b08234"
>>>>>> DEPENDS = "tzcode-native"
>>>>>>
>>>>>> -PR = "r0"
>>>>>> +PR = "r1"
>>>>>>
>>>>>> RCONFLICTS= "timezones timezone-africa timezone-america
>>>>>> timezone-antarctica \
>>>>>>              timezone-arctic timezone-asia timezone-atlantic \
>>>>>> @@ -19,6 +19,8 @@ SRC_URI[tzdata.sha256sum] =
>>>>>> "a343e542486b2b8ebdeca474eed79f1c04f69420ca943c2b9bd
>>>>>>
>>>>>> S = "${WORKDIR}"
>>>>>>
>>>>>> +DEFAULT_TIMEZONE ?= "Universal"
>>>>>> +
>>>>>> TZONES= "africa antarctica asia australasia europe northamerica
>>>>>> southamerica  \
>>>>>>          factory solar87 solar88 solar89 etcetera backward systemv \
>>>>>>         "
>>>>>> @@ -41,7 +43,56 @@ do_install () {
>>>>>>         # libc is removing zoneinfo files from package
>>>>>>         cp -pP "${S}/zone.tab" ${D}${datadir}/zoneinfo
>>>>>>         cp -pP "${S}/iso3166.tab" ${D}${datadir}/zoneinfo
>>>>>> -     chown -R root:root ${D}
>>>>>> +
>>>>>> +        # Install defaults
>>>>>> +        install -d ${D}${sysconfdir}
>>>>>> +        echo ${DEFAULT_TIMEZONE}>  ${D}${sysconfdir}/timezone
>>>>>> +        cp -pP ${S}/${datadir}/zoneinfo/${DEFAULT_TIMEZONE}
>>>>>> ${D}${sysconfdir}/localtime
>>>>>
>>>>>
>>>>> Shouldn't that be an 'ln -sf' instead of a 'cp'?
>>>>>
>>>> No, I don't think so.First reason is /usr may not be mounted, maybe
>>>> living on another device..
>>>> See first Google link about this:
>>>> http://www.redhat.com/archives/rhl-devel-list/2006-April/msg00017.html
>>>> Then, as you see, the postinst takes care of both cases.
>>>
>>>
>>> That only applies to non-UTC times in RTC, which we don't use. And
>>> furthermore, no machine has /usr on a seperate partition since support for
>>> that is broken.
>>
>>
>> I try to bump the thread before the sources get renamed ;)
>>
>> About separation of exec_prefix, pls see
>>
>>
>> http://lists.linuxtogo.org/pipermail/openembedded-core/2012-January/015672.html
>>
>> http://lists.linuxtogo.org/pipermail/openembedded-core/2012-January/015771.html
>>
>> So, what is the position to take?  Symlink or copy?
>
>
> On other systems I've used.. the rule has been: hardlink (same disk) or
> copy. Since the symlink would point into /usr and that should usually be
> avoided (as mentioned above).
>
> I thought there used to be a tool that would do the hardlink, if possible
> and then copy if not.. but I'm not sure if that is even reasonable with our
> image creation... (so copy is likely best answer then)
>
> --Mark
>
>
>> Regards
>>
>> Andrea
>>
>>
>>> _______________________________________________
>>> Openembedded-core mailing list
>>> Openembedded-core@lists.openembedded.org
>>> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
>>
>>
>> _______________________________________________
>> Openembedded-core mailing list
>> Openembedded-core@lists.openembedded.org
>> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
>
>
>
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core

Please take on hold this patch.
Further inspection of do_rootfs logs reveals that the postinst is run
during that task and the code tries to write /etc/localtime on host,
fails and exits 1.

I'll add a check like

pkg_postinst_${PN}() {
if test "x$D" != "x"; then
	exit 1
else

and send a revised patch in a few hours.

Regards

Andrea

P.S.
This is a low hanging fruit wrt recipes duplication between oe-core and meta-oe.
Please add your review/comments, thanks.



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] tzdata_2011n: provide pkg_postinst and timezone defaults
  2012-01-27  8:56           ` Andrea Adami
@ 2012-01-27  9:59             ` Richard Purdie
  0 siblings, 0 replies; 13+ messages in thread
From: Richard Purdie @ 2012-01-27  9:59 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer

On Fri, 2012-01-27 at 09:56 +0100, Andrea Adami wrote:
> Please take on hold this patch.
> Further inspection of do_rootfs logs reveals that the postinst is run
> during that task and the code tries to write /etc/localtime on host,
> fails and exits 1.
> 
> I'll add a check like
> 
> pkg_postinst_${PN}() {
> if test "x$D" != "x"; then
> 	exit 1
> else
> 
> and send a revised patch in a few hours.

How about prefixing the paths with $D instead of forcing this onto the
target? (note, not ${D})

Cheers,

Richard






^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v2] tzdata_2011n: provide pkg_postinst and timezone defaults
  2012-01-14 13:07 [PATCH] tzdata_2011n: provide pkg_postinst and timezone defaults Andrea Adami
  2012-01-14 15:10 ` Koen Kooi
@ 2012-01-28  7:57 ` Andrea Adami
  2012-01-28  8:26   ` Koen Kooi
  2012-02-01 15:24   ` Richard Purdie
  1 sibling, 2 replies; 13+ messages in thread
From: Andrea Adami @ 2012-01-28  7:57 UTC (permalink / raw)
  To: openembedded-core

* Introduce DEFAULT_TIMEZONE variable ('Universal', present in base package)
* and add /etc/timezone during do_install.
* While there, fix hardcoded references to $exec_prefix (/usr).
* Add the pkg_postinst script (adapted from Gentoo).
* Create /etc/localtime during postinst.
* Bump PR

Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
---
 meta/recipes-extended/tzdata/tzdata_2011n.bb |   62 ++++++++++++++++++++++++--
 1 files changed, 58 insertions(+), 4 deletions(-)

diff --git a/meta/recipes-extended/tzdata/tzdata_2011n.bb b/meta/recipes-extended/tzdata/tzdata_2011n.bb
index de9281a..9a41131 100644
--- a/meta/recipes-extended/tzdata/tzdata_2011n.bb
+++ b/meta/recipes-extended/tzdata/tzdata_2011n.bb
@@ -5,7 +5,7 @@ LICENSE = "PD"
 LIC_FILES_CHKSUM = "file://asia;beginline=2;endline=3;md5=06468c0e84ef4d4c97045a4a29b08234"
 DEPENDS = "tzcode-native"
 
-PR = "r0"
+PR = "r1"
 
 RCONFLICTS= "timezones timezone-africa timezone-america timezone-antarctica \
              timezone-arctic timezone-asia timezone-atlantic \
@@ -19,6 +19,8 @@ SRC_URI[tzdata.sha256sum] = "a343e542486b2b8ebdeca474eed79f1c04f69420ca943c2b9bd
 
 S = "${WORKDIR}"
 
+DEFAULT_TIMEZONE ?= "Universal"
+
 TZONES= "africa antarctica asia australasia europe northamerica southamerica  \
          factory solar87 solar88 solar89 etcetera backward systemv \
         "
@@ -36,12 +38,64 @@ do_compile () {
 }
 
 do_install () {
-        install -d ${D}/usr ${D}${datadir}/zoneinfo
-        cp -pPR ${S}/usr ${D}/
+        install -d ${D}/$exec_prefix ${D}${datadir}/zoneinfo
+        cp -pPR ${S}/$exec_prefix ${D}/
         # libc is removing zoneinfo files from package
         cp -pP "${S}/zone.tab" ${D}${datadir}/zoneinfo
         cp -pP "${S}/iso3166.tab" ${D}${datadir}/zoneinfo
-	chown -R root:root ${D}
+
+        # Install default timezone
+        install -d ${D}${sysconfdir}
+        echo ${DEFAULT_TIMEZONE} > ${D}${sysconfdir}/timezone
+
+        chown -R root:root ${D}
+}
+
+pkg_postinst_${PN} () {
+
+# code taken from Gentoo's tzdata ebuild
+
+	etc_lt="$D${sysconfdir}/localtime"
+	src="$D${sysconfdir}/timezone"
+
+	if [ -e ${src} ] ; then
+		tz=$(sed -e 's:#.*::' -e 's:[[:space:]]*::g' -e '/^$/d' "${src}")
+	else
+		tz="FUBAR"
+	fi
+	
+	if [ -z ${tz} ] ; then
+		return 0
+	fi
+	
+	if [ ${tz} = "FUBAR" ] ; then
+		echo "You do not have TIMEZONE set in ${src}."
+
+		if [ ! -e ${etc_lt} ] ; then
+			# if /etc/localtime is a symlink somewhere, assume they
+			# know what they're doing and they're managing it themselves
+			if [ ! -L ${etc_lt} ] ; then
+				cp -f "$D${datadir}/zoneinfo/Universal" "${etc_lt}"
+				echo "Setting ${etc_lt} to Universal."
+			else
+				echo "Assuming your ${etc_lt} symlink is what you want; skipping update."
+			fi
+		else
+			echo "Skipping auto-update of ${etc_lt}."
+		fi
+		return 0
+	fi
+
+	if [ ! -e "$D${datadir}/zoneinfo/${tz}" ] ; then
+		echo "You have an invalid TIMEZONE setting in ${src}"
+		echo "Your ${etc_lt} has been reset to Universal; enjoy!"
+		tz="Universal"
+	fi
+	echo "Updating ${etc_lt} with $D${datadir}/zoneinfo/${tz}"
+	if [ -L ${etc_lt} ] ; then
+		rm -f "${etc_lt}"
+	fi
+	cp -f "$D${datadir}/zoneinfo/${tz}" "${etc_lt}"
 }
 
 # Packages primarily organized by directory with a major city
-- 
1.7.3.4




^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH v2] tzdata_2011n: provide pkg_postinst and timezone defaults
  2012-01-28  7:57 ` [PATCH v2] " Andrea Adami
@ 2012-01-28  8:26   ` Koen Kooi
  2012-02-01 15:24   ` Richard Purdie
  1 sibling, 0 replies; 13+ messages in thread
From: Koen Kooi @ 2012-01-28  8:26 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer


Op 28 jan. 2012, om 08:57 heeft Andrea Adami het volgende geschreven:

> * Introduce DEFAULT_TIMEZONE variable ('Universal', present in base package)
> * and add /etc/timezone during do_install.
> * While there, fix hardcoded references to $exec_prefix (/usr).
> * Add the pkg_postinst script (adapted from Gentoo).
> * Create /etc/localtime during postinst.
> * Bump PR
> 
> Signed-off-by: Andrea Adami <andrea.adami@gmail.com>

A quick look makes me think this patch is a lot better than the current situation.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2] tzdata_2011n: provide pkg_postinst and timezone defaults
  2012-01-28  7:57 ` [PATCH v2] " Andrea Adami
  2012-01-28  8:26   ` Koen Kooi
@ 2012-02-01 15:24   ` Richard Purdie
  1 sibling, 0 replies; 13+ messages in thread
From: Richard Purdie @ 2012-02-01 15:24 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer

On Sat, 2012-01-28 at 08:57 +0100, Andrea Adami wrote:
> * Introduce DEFAULT_TIMEZONE variable ('Universal', present in base package)
> * and add /etc/timezone during do_install.
> * While there, fix hardcoded references to $exec_prefix (/usr).
> * Add the pkg_postinst script (adapted from Gentoo).
> * Create /etc/localtime during postinst.
> * Bump PR
> 
> Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
> ---
>  meta/recipes-extended/tzdata/tzdata_2011n.bb |   62 ++++++++++++++++++++++++--
>  1 files changed, 58 insertions(+), 4 deletions(-)

Merged to master, thanks.

Richard




^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2012-02-01 15:32 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-14 13:07 [PATCH] tzdata_2011n: provide pkg_postinst and timezone defaults Andrea Adami
2012-01-14 15:10 ` Koen Kooi
2012-01-14 15:54   ` Eric Bénard
2012-01-14 19:16     ` Koen Kooi
2012-01-15 11:17   ` Andrea Adami
2012-01-15 11:22     ` Koen Kooi
2012-01-23 14:21       ` Andrea Adami
2012-01-23 16:49         ` Mark Hatle
2012-01-27  8:56           ` Andrea Adami
2012-01-27  9:59             ` Richard Purdie
2012-01-28  7:57 ` [PATCH v2] " Andrea Adami
2012-01-28  8:26   ` Koen Kooi
2012-02-01 15:24   ` Richard Purdie

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.