[oe-commits] Richard Purdie : image-mklibs/package_ipk: Remove bashisms

git at git.openembedded.org git at git.openembedded.org
Thu Jan 5 22:34:12 UTC 2012


Module: openembedded-core.git
Branch: master
Commit: 4a85312568a6bb052cc511c15b4ae842ff7f8e59
URL:    http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=4a85312568a6bb052cc511c15b4ae842ff7f8e59

Author: Richard Purdie <richard.purdie at linuxfoundation.org>
Date:   Thu Jan  5 12:50:11 2012 +0000

image-mklibs/package_ipk: Remove bashisms

We now support using dash but these bashisms triggered build failures for me
when using it. This replaces the code with something which works on dash.

Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>

---

 meta/classes/image-mklibs.bbclass |    2 +-
 meta/classes/package_ipk.bbclass  |    8 ++++++--
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/meta/classes/image-mklibs.bbclass b/meta/classes/image-mklibs.bbclass
index 69dac2f..7623815 100644
--- a/meta/classes/image-mklibs.bbclass
+++ b/meta/classes/image-mklibs.bbclass
@@ -60,7 +60,7 @@ mklibs_optimize_image_doit() {
 mklibs_optimize_image() {
 	for img in ${MKLIBS_OPTIMIZED_IMAGES}
 	do
-		if [ "${img}" == "${PN}" ] || [ "${img}" == "all" ]
+		if [ "${img}" = "${PN}" ] || [ "${img}" = "all" ]
 		then
 			mklibs_optimize_image_doit
 			break
diff --git a/meta/classes/package_ipk.bbclass b/meta/classes/package_ipk.bbclass
index aeabc11..36dedb9 100644
--- a/meta/classes/package_ipk.bbclass
+++ b/meta/classes/package_ipk.bbclass
@@ -72,8 +72,10 @@ package_tryout_install_multilib_ipk() {
 		local ipkg_args="-f ${INSTALL_CONF_IPK} -o ${target_rootfs} --force_overwrite"
 		local selected_pkg=""
 		local pkgname_prefix="${item}-"
+		local pkgname_len=${#pkgname_prefix}
 		for pkg in ${INSTALL_PACKAGES_MULTILIB_IPK}; do
-			if [ ${pkg:0:${#pkgname_prefix}} == ${pkgname_prefix} ]; then
+			local pkgname=$(echo $pkg | awk -v var=$pkgname_len '{ pkgname=substr($1, 1, var - 1); print pkgname; }' )
+			if [ ${pkgname} = ${pkgname_prefix} ]; then
 			    selected_pkg="${selected_pkg} ${pkg}"
 			fi
 		done
@@ -94,7 +96,9 @@ split_multilib_packages() {
 		is_multilib=0
 		for item in ${MULTILIB_VARIANTS}; do
 			local pkgname_prefix="${item}-"
-			if [ ${pkg:0:${#pkgname_prefix}} == ${pkgname_prefix} ]; then
+			local pkgname_len=${#pkgname_prefix}
+			local pkgname=$(echo $pkg | awk -v var=$pkgname_len '{ pkgname=substr($1, 1, var - 1); print pkgname; }' )
+			if [ ${pkgname} = ${pkgname_prefix} ]; then
 				is_multilib=1
 				break
 			fi





More information about the Openembedded-commits mailing list