public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
* [PATCH v3 1/2] tzdata: We shouldn't override the localtime if it is valid
@ 2013-02-08 14:52 Otavio Salvador
  2013-02-08 14:52 ` [PATCH v3 2/2] tzdata: Simplify code removing not used cases Otavio Salvador
  2013-02-08 22:55 ` [PATCH v3 1/2] tzdata: We shouldn't override the localtime if it is valid Andrea Adami
  0 siblings, 2 replies; 4+ messages in thread
From: Otavio Salvador @ 2013-02-08 14:52 UTC (permalink / raw)
  To: openembedded-core; +Cc: Otavio Salvador

The code where mistakenly replacing the localtime file setting so we
end with a copy of file instead of a symbolic link. This fixes it so
now, we'll only do that in case the link is pointing to invalid data.

Change-Id: I16dfa5ea4f293c48bb396f4e23a2ea53e6c9e745
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
---
 meta/recipes-extended/tzdata/tzdata_2012d.bb |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/meta/recipes-extended/tzdata/tzdata_2012d.bb b/meta/recipes-extended/tzdata/tzdata_2012d.bb
index 9741101..9ec6715 100644
--- a/meta/recipes-extended/tzdata/tzdata_2012d.bb
+++ b/meta/recipes-extended/tzdata/tzdata_2012d.bb
@@ -5,7 +5,7 @@ LICENSE = "PD"
 LIC_FILES_CHKSUM = "file://asia;beginline=2;endline=3;md5=06468c0e84ef4d4c97045a4a29b08234"
 DEPENDS = "tzcode-native"
 
-PR = "r2"
+PR = "r3"
 
 inherit allarch
 
@@ -93,12 +93,12 @@ pkg_postinst_${PN} () {
 		echo "You have an invalid TIMEZONE setting in ${src}"
 		echo "Your ${etc_lt} has been reset to Universal; enjoy!"
 		tz="Universal"
+		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}"
 	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.2.5




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

* [PATCH v3 2/2] tzdata: Simplify code removing not used cases
  2013-02-08 14:52 [PATCH v3 1/2] tzdata: We shouldn't override the localtime if it is valid Otavio Salvador
@ 2013-02-08 14:52 ` Otavio Salvador
  2013-02-08 22:55 ` [PATCH v3 1/2] tzdata: We shouldn't override the localtime if it is valid Andrea Adami
  1 sibling, 0 replies; 4+ messages in thread
From: Otavio Salvador @ 2013-02-08 14:52 UTC (permalink / raw)
  To: openembedded-core; +Cc: Otavio Salvador

We shouldn't have an use-case where we'd use 'FUBAR' timezone so
instead of adding postinst handling for this use case we handle it at
install time and keep the Universal as fallback if user did something
wrong.

This also ensure the /etc/localtime file is kept as a symbolic link.
This will make timezone not available when /usr is in separated
partition (and not mounted) however the applications ought to fallback
to GMT timezone in this case and when /usr is made availble timezone
will work fine.

Change-Id: I9a4f05db7a0bdc06511deb5693d1d16569d2fc63
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
---
 meta/recipes-extended/tzdata/tzdata_2012d.bb |   36 ++++++-------------------
 1 files changed, 9 insertions(+), 27 deletions(-)

diff --git a/meta/recipes-extended/tzdata/tzdata_2012d.bb b/meta/recipes-extended/tzdata/tzdata_2012d.bb
index 9ec6715..4811072 100644
--- a/meta/recipes-extended/tzdata/tzdata_2012d.bb
+++ b/meta/recipes-extended/tzdata/tzdata_2012d.bb
@@ -47,48 +47,30 @@ do_install () {
         cp -pP "${S}/iso3166.tab" ${D}${datadir}/zoneinfo
 
         # Install default timezone
-        install -d ${D}${sysconfdir}
-        echo ${DEFAULT_TIMEZONE} > ${D}${sysconfdir}/timezone
-        ln -s ${datadir}/zoneinfo/${DEFAULT_TIMEZONE} ${D}${sysconfdir}/localtime
+        if [ -e ${D}${datadir}/zoneinfo/${DEFAULT_TIMEZONE} ]; then
+            install -d ${D}${sysconfdir}
+            echo ${DEFAULT_TIMEZONE} > ${D}${sysconfdir}/timezone
+            ln -s ${datadir}/zoneinfo/${DEFAULT_TIMEZONE} ${D}${sysconfdir}/localtime
+        else
+            bberror "DEFAULT_TIMEZONE is set to an invalid value."
+            exit 1
+        fi
 
         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!"
@@ -97,7 +79,7 @@ pkg_postinst_${PN} () {
 		if [ -L ${etc_lt} ] ; then
 			rm -f "${etc_lt}"
 		fi
-		cp -f "$D${datadir}/zoneinfo/${tz}" "${etc_lt}"
+		ln -s "${datadir}/zoneinfo/${tz}" "${etc_lt}"
 	fi
 }
 
-- 
1.7.2.5




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

* Re: [PATCH v3 1/2] tzdata: We shouldn't override the localtime if it is valid
  2013-02-08 14:52 [PATCH v3 1/2] tzdata: We shouldn't override the localtime if it is valid Otavio Salvador
  2013-02-08 14:52 ` [PATCH v3 2/2] tzdata: Simplify code removing not used cases Otavio Salvador
@ 2013-02-08 22:55 ` Andrea Adami
  2013-02-09  2:19   ` Otavio Salvador
  1 sibling, 1 reply; 4+ messages in thread
From: Andrea Adami @ 2013-02-08 22:55 UTC (permalink / raw)
  To: openembedded-core

On Fri, Feb 8, 2013 at 3:52 PM, Otavio Salvador <otavio@ossystems.com.br> wrote:
> The code where mistakenly replacing the localtime file setting so we
> end with a copy of file instead of a symbolic link. This fixes it so
> now, we'll only do that in case the link is pointing to invalid data.
>

Hi,

there was the same discussion when I first proposed the Gentoo script:
it wasn't a mistake. it's the old issue /usr not mounted at boot.

See thread: http://lists.linuxtogo.org/pipermail/openembedded-core/2012-January/016237.html

Cheers

Andrea


> Change-Id: I16dfa5ea4f293c48bb396f4e23a2ea53e6c9e745
> Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
> ---
>  meta/recipes-extended/tzdata/tzdata_2012d.bb |   12 ++++++------
>  1 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/meta/recipes-extended/tzdata/tzdata_2012d.bb b/meta/recipes-extended/tzdata/tzdata_2012d.bb
> index 9741101..9ec6715 100644
> --- a/meta/recipes-extended/tzdata/tzdata_2012d.bb
> +++ b/meta/recipes-extended/tzdata/tzdata_2012d.bb
> @@ -5,7 +5,7 @@ LICENSE = "PD"
>  LIC_FILES_CHKSUM = "file://asia;beginline=2;endline=3;md5=06468c0e84ef4d4c97045a4a29b08234"
>  DEPENDS = "tzcode-native"
>
> -PR = "r2"
> +PR = "r3"
>
>  inherit allarch
>
> @@ -93,12 +93,12 @@ pkg_postinst_${PN} () {
>                 echo "You have an invalid TIMEZONE setting in ${src}"
>                 echo "Your ${etc_lt} has been reset to Universal; enjoy!"
>                 tz="Universal"
> +               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}"
>         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.2.5
>
>
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core



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

* Re: [PATCH v3 1/2] tzdata: We shouldn't override the localtime if it is valid
  2013-02-08 22:55 ` [PATCH v3 1/2] tzdata: We shouldn't override the localtime if it is valid Andrea Adami
@ 2013-02-09  2:19   ` Otavio Salvador
  0 siblings, 0 replies; 4+ messages in thread
From: Otavio Salvador @ 2013-02-09  2:19 UTC (permalink / raw)
  To: Andrea Adami; +Cc: Patches and discussions about the oe-core layer

On Fri, Feb 8, 2013 at 8:55 PM, Andrea Adami <andrea.adami@gmail.com> wrote:
> On Fri, Feb 8, 2013 at 3:52 PM, Otavio Salvador <otavio@ossystems.com.br> wrote:
>> The code where mistakenly replacing the localtime file setting so we
>> end with a copy of file instead of a symbolic link. This fixes it so
>> now, we'll only do that in case the link is pointing to invalid data.
>>
>
> Hi,
>
> there was the same discussion when I first proposed the Gentoo script:
> it wasn't a mistake. it's the old issue /usr not mounted at boot.
>
> See thread: http://lists.linuxtogo.org/pipermail/openembedded-core/2012-January/016237.html

As far as I know we stopped to worry about /usr not mounted at boot.
In either case the symbolic link is how it is managed in most
distributions and expected by many softwares available so I think we
ought to follow the standard here.

-- 
Otavio Salvador                             O.S. Systems
E-mail: otavio@ossystems.com.br  http://www.ossystems.com.br
Mobile: +55 53 9981-7854              http://projetos.ossystems.com.br



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

end of thread, other threads:[~2013-02-09  2:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-08 14:52 [PATCH v3 1/2] tzdata: We shouldn't override the localtime if it is valid Otavio Salvador
2013-02-08 14:52 ` [PATCH v3 2/2] tzdata: Simplify code removing not used cases Otavio Salvador
2013-02-08 22:55 ` [PATCH v3 1/2] tzdata: We shouldn't override the localtime if it is valid Andrea Adami
2013-02-09  2:19   ` Otavio Salvador

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox