rewrite eglibc-utils/usr/bin/tzselect as a posix sh and let it work
cover rewrite eglibc-utils/usr/bin/tzselect as a posix sh and let it work
[YOCTO #6544]
Test Steps:
1. Vim local.conf
The tzdata supplyed timezone info.
...
MACHINE ?= "qemuarm"IMAGE_FEATURES += "ssh-server-dropbear"IMAGE_INSTALL_append = " tzcode tzdata"
...
2. bitbake core-image-minimal
3. start qemu and ssh target
4. Use busybox as default shell(bash not installed any more)
root@qemuarm:~# ls /bin/sh -al lrwxrwxrwx 1 root root 19 Jul 17 03:45 /bin/sh -> /bin/busybox.nosuid
5. Use busybox's awk by default
root@qemuarm:~# which awk /usr/bin/awk root@qemuarm:~# ls -al /usr/bin/awk lrwxrwxrwx 1 root root 19 Jul 17 03:45 /usr/bin/awk -> /bin/busybox.nosuid
6. test case 1: set timezone directly
...
root@qemuarm:~# tzselect -c +4852+00220 Please identify a location so that time zone rules can be set correctly. Please select one of the following time zone regions, listed roughly in increasing order of distance from +4852+00220. 1) France 2) Belgium 3) Luxembourg 4) Jersey 5) Britain (UK) 6) Guernsey 7) Netherlands 8) Germany - Busingen 9) Switzerland 10) Liechtenstein #? 1
The following information has been given:
coord +4852+00220 France
Therefore TZ='Europe/Paris' will be used.
Local time is now: Wed Jul 16 13:42:29 CEST 2014.
Universal Time is now: Wed Jul 16 11:42:29 UTC 2014.
Is the above information OK?
1) Yes
2) No
#?
1) Yes
2) No
#? 1
You can make this change permanent for yourself by appending the line
TZ='Europe/Paris'; export TZ
to the file '.profile' in your home directory; then log out and log in again.
Here is that TZ value again, this time on standard output so that you can use the /usr/bin/tzselect command in shell scripts:
Europe/Paris
....
7. test case 2: set timezone interactively
...
root@qemuarm:~# tzselect Please identify a location so that time zone rules can be set correctly. Please select a continent, ocean, "coord", or "TZ". 1) Africa 2) Americas 3) Antarctica 4) Arctic Ocean 5) Asia 6) Atlantic Ocean 7) Australia 8) Europe 9) Indian Ocean 10) Pacific Ocean 11) coord - I want to use geographical coordinates. 12) TZ - I want to specify the time zone using the Posix TZ format. #? 2 Please select a country whose clocks agree with yours. 1) Anguilla 2) Antigua & Barbuda 3) Argentina 4) Aruba 5) Bahamas 6) Barbados 7) Belize 8) Bolivia 9) Brazil 10) Canada 11) Caribbean Netherlands 12) Cayman Islands 13) Chile 14) Colombia 15) Costa Rica 16) Cuba 17) Curacao 18) Dominica 19) Dominican Republic 20) Ecuador 21) El Salvador 22) French Guiana 23) Greenland 24) Grenada 25) Guadeloupe 26) Guatemala 27) Guyana 28) Haiti 29) Honduras 30) Jamaica 31) Martinique 32) Mexico 33) Montserrat 34) Nicaragua 35) Panama 36) Paraguay 37) Peru 38) Puerto Rico 39) St Barthelemy 40) St Kitts & Nevis 41) St Lucia 42) St Maarten (Dutch part) 43) St Martin (French part) 44) St Pierre & Miquelon 45) St Vincent 46) Suriname 47) Trinidad & Tobago 48) Turks & Caicos Is 49) United States 50) Uruguay 51) Venezuela 52) Virgin Islands (UK) 53) Virgin Islands (US) #? 49 Please select one of the following time zone regions. 1) Eastern Time 2) Eastern Time - Michigan - most locations 3) Eastern Time - Kentucky - Louisville area 4) Eastern Time - Kentucky - Wayne County 5) Eastern Time - Indiana - most locations 6) Eastern Time - Indiana - Daviess, Dubois, Knox & Martin Counties 7) Eastern Time - Indiana - Pulaski County 8) Eastern Time - Indiana - Crawford County 9) Eastern Time - Indiana - Pike County 10) Eastern Time - Indiana - Switzerland County 11) Central Time 12) Central Time - Indiana - Perry County 13) Central Time - Indiana - Starke County 14) Central Time - Michigan - Dickinson, Gogebic, Iron & Menominee Counties 15) Central Time - North Dakota - Oliver County 16) Central Time - North Dakota - Morton County (except Mandan area) 17) Central Time - North Dakota - Mercer County 18) Mountain Time 19) Mountain Time - south Idaho & east Oregon 20) Mountain Standard Time - Arizona (except Navajo) 21) Pacific Time 22) Alaska Time 23) Alaska Time - Alaska panhandle 24) Alaska Time - southeast Alaska panhandle 25) Alaska Time - Alaska panhandle neck 26) Alaska Time - west Alaska 27) Aleutian Islands 28) Metlakatla Time - Annette Island 29) Hawaii #? 1
The following information has been given:
United States
Eastern Time
Therefore TZ='America/New_York' will be used.
Local time is now: Thu Jul 17 00:33:16 EDT 2014.
Universal Time is now: Thu Jul 17 04:33:16 UTC 2014.
Is the above information OK?
1) Yes
2) No
#? 1
You can make this change permanent for yourself by appending the line
TZ='America/New_York'; export TZ
to the file '.profile' in your home directory; then log out and log in again.
Here is that TZ value again, this time on standard output so that you can use the /usr/bin/tzselect command in shell scripts:
America/New_York
...
//Hongxu
The following changes since commit 1dcdd877c7946be4c0b1203deb14e2f842f9d0c2:
bitbake: toasterui: fix build - project identification (2014-07-14 14:10:03 +0100)
are available in the git repository at:
git://git.pokylinux.org/poky-contrib hongxu/fix-eglibc-tzselect
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=hongxu/fix-eglibc-tzselect
Hongxu Jia (2):
busybox: enable CONFIG_FEATURE_AWK_LIBM by default
eglibc: rewritten tzselect as posix sh and move it to tzcode package
meta/recipes-core/busybox/busybox/defconfig | 2 +- .../timezone-re-written-tzselect-as-posix-sh.patch | 40 ++++++++++++++++++++++ meta/recipes-core/eglibc/eglibc-package.inc | 6 ++-- meta/recipes-core/eglibc/eglibc_2.19.bb | 1 + 4 files changed, 46 insertions(+), 3 deletions(-) create mode 100644 meta/recipes-core/eglibc/eglibc-2.19/timezone-re-written-tzselect-as-posix-sh.patch
Signature · 1 line
1.8.1.2
PATCH 1/2 busybox: enable CONFIG_FEATURE_AWK_LIBM by default
It was required by tzselect which is provided by eglibc utils. The eglibc is a fundamental package, so enable math functions of awk is reasonable.
Here is the error if we not enable that:
...
root@qemuarm:~# tzselect -c +4852+00220 awk: cmd. line:39: Math support is not compiled in ...
[YOCTO #6544]
--- meta/recipes-core/busybox/busybox/defconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-core/busybox/busybox/defconfig +1 -1
@@ -377,7 +377,7 @@ CONFIG_FEATURE_VI_WIN_RESIZE=y # CONFIG_FEATURE_VI_ASK_TERMINAL is not set CONFIG_FEATURE_VI_OPTIMIZE_CURSOR=y CONFIG_AWK=y -# CONFIG_FEATURE_AWK_LIBM is not set +CONFIG_FEATURE_AWK_LIBM=y CONFIG_CMP=y CONFIG_DIFF=y # CONFIG_FEATURE_DIFF_LONG_OPTIONS is not set
Signature · 1 line
1.8.1.2
PATCH 2/2 eglibc: rewritten tzselect as posix sh and move it to tzcode package
In reply to Hongxu JiaThe problem is that this would cause bash installed to meta-toolchain, the dependencies chain is:
meta-toolchain -> eglibc-utils -> bash
We should eliminate bash dependencies in anything core to a tiny system.
The eglibc-utils also provides eglibc-utils/usr/bin/zdump, eglibc-utils/usr/bin/zic which all of them belonged to tzcode, so we should split these three utils as tzcode package.
[YOCTO #6544]
--- .../timezone-re-written-tzselect-as-posix-sh.patch | 40 ++++++++++++++++++++++ meta/recipes-core/eglibc/eglibc-package.inc | 6 ++-- meta/recipes-core/eglibc/eglibc_2.19.bb | 1 + 3 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 meta/recipes-core/eglibc/eglibc-2.19/timezone-re-written-tzselect-as-posix-sh.patch
meta/recipes-core/eglibc/eglibc-2.19/timezone-re-written-tzselect-as-posix-sh.patch new file +40 -0
@@ -0,0 +1,40 @@ +timezone: re-written tzselect as posix sh + +To avoid the bash dependency. + +Upstream-Status: Pending + +Signed-off-by: Hongxu Jia <[email protected]> +--- + timezone/Makefile | 2 +- + timezone/tzselect.ksh | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/timezone/Makefile b/timezone/Makefile +--- a/timezone/Makefile ++++ b/timezone/Makefile +@@ -113,7 +113,7 @@ $(testdata)/Asia/Tokyo: asia $(zic-deps) + + + $(objpfx)tzselect: tzselect.ksh $(common-objpfx)config.make +- sed -e 's|/bin/bash|$(KSH)|g' \ ++ sed -e 's|/bin/bash|/bin/sh|g' \ + -e '/TZDIR=/s|\$$(pwd)|$(zonedir)|' \ + -e '/TZVERSION=/s|see_Makefile|"$(version)"|' \ + -e '/PKGVERSION=/s|=.*|="$(PKGVERSION)"|' \ +diff --git a/timezone/tzselect.ksh b/timezone/tzselect.ksh +index 9d70691..25f45a8 100644 +--- a/timezone/tzselect.ksh ++++ b/timezone/tzselect.ksh +@@ -35,7 +35,7 @@ [email protected] + + # Specify default values for environment variables if they are unset. + : ${AWK=awk} +-: ${TZDIR=`pwd`} ++: ${TZDIR=$(pwd)} + + # Check for awk Posix compliance. + ($AWK -v x=y 'BEGIN { exit 123 }') </dev/null >/dev/null 2>&1 +-- +1.8.1.2 +
meta/recipes-core/eglibc/eglibc-package.inc +4 -2
@@ -17,7 +17,7 @@ python __anonymous () { # Set this to zero if you don't want ldconfig in the output package USE_LDCONFIG ?= "1" -PACKAGES = "${PN}-dbg catchsegv sln nscd ldd ${PN}-utils eglibc-thread-db ${PN}-pic libcidn libmemusage libsegfault ${PN}-pcprofile libsotruss ${PN} eglibc-extra-nss ${PN}-dev ${PN}-staticdev ${PN}-doc" +PACKAGES = "${PN}-dbg catchsegv sln nscd ldd tzcode ${PN}-utils eglibc-thread-db ${PN}-pic libcidn libmemusage libsegfault ${PN}-pcprofile libsotruss ${PN} eglibc-extra-nss ${PN}-dev ${PN}-staticdev ${PN}-doc" # The ld.so in this eglibc supports the GNU_HASH RPROVIDES_${PN} = "glibc rtld(GNU_HASH)"
@@ -47,6 +47,7 @@ FILES_${PN}-dev += "${bindir}/rpcgen ${libdir}/*_nonshared.a ${base_libdir}/*_no FILES_${PN}-staticdev += "${libdir}/*.a ${base_libdir}/*.a" FILES_nscd = "${sbindir}/nscd*" FILES_${PN}-mtrace = "${bindir}/mtrace" +FILES_tzcode = "${bindir}/tzselect ${sbindir}/zic ${sbindir}/zdump" FILES_${PN}-utils = "${bindir}/* ${sbindir}/*" FILES_${PN}-dbg += "${libexecdir}/*/.debug ${libdir}/audit/.debug" FILES_catchsegv = "${bindir}/catchsegv"
@@ -65,8 +66,9 @@ DESCRIPTION_eglibc-extra-nss = "eglibc: nis, nisplus and hesiod search services. SUMMARY_ldd = "print shared library dependencies" DESCRIPTION_ldd = "${bindir}/ldd prints shared library dependencies for each program or shared library specified on the command line." SUMMARY_${PN}-utils = "Miscellaneous utilities provided by eglibc" -DESCRIPTION_${PN}-utils = "Miscellaneous utilities including getconf, iconf, locale, gencat, tzselect, zic, rpcinfo, ..." +DESCRIPTION_${PN}-utils = "Miscellaneous utilities including getconf, iconf, locale, gencat, rpcinfo, ..." DESCRIPTION_libsotruss = "Library to support sotruss which traces calls through PLTs" +DESCRIPTION_tzcode = "tzcode, timezone zoneinfo utils -- zic, zdump, tzselect" inherit libc-common multilib_header
meta/recipes-core/eglibc/eglibc_2.19.bb +1 -0
@@ -27,6 +27,7 @@ SRC_URI = "http://downloads.yoctoproject.org/releases/eglibc/eglibc-${PV}-svnr25 file://ppce6500-32b_slow_ieee754_sqrt.patch \ file://grok_gold.patch \ file://fix_am_rootsbindir.patch;striplevel=2 \ + file://timezone-re-written-tzselect-as-posix-sh.patch \ " SRC_URI[md5sum] = "197836c2ba42fb146e971222647198dd" SRC_URI[sha256sum] = "baaa030531fc308f7820c46acdf8e1b2f8e3c1f40bcd28b6e440d1c95d170d4c"
Signature · 1 line
1.8.1.2