[OE-core] [PATCH] bash2dash conversion
Peter Kjellerstedt
peter.kjellerstedt at axis.com
Mon Sep 19 11:57:09 UTC 2016
> -----Original Message-----
> From: openembedded-core-bounces at lists.openembedded.org
> [mailto:openembedded-core-bounces at lists.openembedded.org] On Behalf Of
> zhe.he at windriver.com
> Sent: den 18 september 2016 04:52
> To: openembedded-core at lists.openembedded.org
> Subject: [OE-core] [PATCH] bash2dash conversion
^^^^^^^^^
Typically this is referred to as "Remove bashisms"...
> From: "Tim K. Chan" <nirvanatk at gmail.com>
>
> Change bash style to dash style
>
> Signed-off-by: Tim K. Chan <nirvanatk at gmail.com>
> [Adjust context]
> Signed-off-by: He Zhe <zhe.he at windriver.com>
> ---
> meta/classes/systemd.bbclass | 4 ++--
> meta/classes/update-rc.d.bbclass | 6 +++---
> meta/classes/useradd_base.bbclass | 4 ++--
> meta/recipes-connectivity/resolvconf/resolvconf_1.79.bb | 2 +-
> meta/recipes-core/glibc/glibc-package.inc | 2 +-
> meta/recipes-devtools/guile/guile_2.0.12.bb | 6 ++++--
> meta/recipes-devtools/rpm/rpm_5.4.16.bb | 13 +++++++++++--
> 7 files changed, 24 insertions(+), 13 deletions(-)
[cut]
> diff --git a/meta/classes/useradd_base.bbclass
> b/meta/classes/useradd_base.bbclass
> index f4dc713..35d5f06 100644
> --- a/meta/classes/useradd_base.bbclass
> +++ b/meta/classes/useradd_base.bbclass
> @@ -59,10 +59,10 @@ perform_groupmems () {
> gshadow="no"
> touch $rootdir${sysconfdir}/gshadow
> fi
> - local mem_exists="`grep "^$groupname:[^:]*:[^:]*:\([^,]*,\)*$username\(,[^,]*\)*"$rootdir/etc/group || true`"
> + local mem_exists="`grep "^$groupname:[!:]*:[!:]*:\([!,]*,\)*$username\(,[!,]*\)*"$rootdir/etc/group || true`"
> if test "x$mem_exists" = "x"; then
> eval flock -x $rootdir${sysconfdir} -c \"$PSEUDO groupmems \$opts\" || true
> - mem_exists="`grep "^$groupname:[^:]*:[^:]*:\([^,]*,\)*$username\(,[^,]*\)*"$rootdir/etc/group || true`"
> ++ mem_exists="`grep "^$groupname:[!:]*:[!:]*:\([!,]*,\)*$username\(,[!,]*\)*"$rootdir/etc/group || true`"
> if test "x$mem_exists" = "x"; then
> bbfatal "${PN}: groupmems command did not succeed."
> fi
The above change cannot be correct. Changing the expression "[^:]"
(which means "anything but :") to "[!:]" (which means "! or :") is
definitely not the same....
> diff --git a/meta/recipes-devtools/guile/guile_2.0.12.bb
> b/meta/recipes-devtools/guile/guile_2.0.12.bb
> index d2fe511..3ada0f1 100644
> --- a/meta/recipes-devtools/guile/guile_2.0.12.bb
> +++ b/meta/recipes-devtools/guile/guile_2.0.12.bb
> @@ -91,8 +91,10 @@ guile_cross_config() {
> then
> # Create guile-config returning target values instead of native values
> install -d ${SYSROOT_DESTDIR}${STAGING_BINDIR_CROSS}
> - echo '#!'`which ${BUILD_SYS}-guile`$' \\\n--no-auto-compile -e main -s\n!#\n(define %guile-build-info '\'\( \
> - > ${B}/guile-config.cross
> + echo -n '#!' > ${B}/guile-config.cross
> + echo -n `which x86_64-linux-guile` >> ${B}/guile-config.cross
> + printf ' \\\n--no-auto-compile -e main -s\n!#\n(define %%guile-build-info ' >> ${B}/guile-config.cross
> + echo "'(" >> ${B}/guile-config.cross
> sed -n -e 's:^[ \t]*{[ \t]*": (:' \
> -e 's:",[ \t]*": . ":' \
> -e 's:" *}, *\\:"):' \
I suggest to replace the entire guile_cross_config() function with this:
guile_cross_config() {
# this is only for target recipe
[ "${PN}" = "${BPN}" ] || return 0
vars=$(sed -n -e 's:^[ \t]*{[ \t]*": (:' \
-e 's:",[ \t]*": . ":' \
-e 's:" *}, *\\:"):' \
-e 's:^.*cachedir.*$::' \
-e '/^ (/p' \
< ${B}/libguile/libpath.h)
# Create guile-config returning target values instead of native values
install -d ${SYSROOT_DESTDIR}${bindir_crossscripts}
cat <<EOF >${B}/guile-config.cross
#!$(which ${BUILD_SYS}-guile) \\
--no-auto-compile -e main -s
!#
(define %guile-build-info '(
$vars
))
EOF
cat ${B}/meta/guile-config >> ${B}/guile-config.cross
install ${B}/guile-config.cross ${SYSROOT_DESTDIR}${bindir_crossscripts}/guile-config
}
That should make it a lot simpler to see what is going on.
Please note that I have corrected the installation path as well.
//Peter
More information about the Openembedded-core
mailing list