aboutsummaryrefslogtreecommitdiffstats
path: root/meta/classes
diff options
context:
space:
mode:
authorAndrei Gherzan <andrei@gherzan.ro>2012-09-20 12:56:59 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-09-20 13:18:19 +0100
commita19880ad10ccb5d7d909dcf9de5c3dc58a0ebcd3 (patch)
treedf84bd192b722295630191c120d7bf65101d2134 /meta/classes
parent6d8aeb0c9b939082cc8d54a940d615b33d81348d (diff)
downloadopenembedded-core-contrib-a19880ad10ccb5d7d909dcf9de5c3dc58a0ebcd3.tar.gz
Replace "echo -e" with "printf" to have the same behavior in dash or bash
oe-core removed the prerequisite to have sh as bash. POSIX doesn't define any options and furthermore allows 'echo -e' to be the default behavior. This means that in dash 'echo -e' will actually print '-e' and interpret backslashes by default. We use instead 'printf' builtin command with or without '\n' to simulate 'echo -e' or 'echo -n'. 'printf' needs format while 'echo' can be used without any arguments. So 'echo >' was replaced by 'printf "" >'. 'echo' without '-n' flag adds a new line by default so to keep the same behavior of two new lines while using 'echo "\n"', 'printf "\n\n"' is used. [YOCTO #3138] Signed-off-by: Andrei Gherzan <andrei@gherzan.ro> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r--meta/classes/buildhistory.bbclass6
-rw-r--r--meta/classes/cml1.bbclass2
-rw-r--r--meta/classes/license.bbclass6
-rw-r--r--meta/classes/package_deb.bbclass2
-rw-r--r--meta/classes/package_ipk.bbclass2
-rw-r--r--meta/classes/package_rpm.bbclass6
-rw-r--r--meta/classes/populate_sdk_base.bbclass8
7 files changed, 16 insertions, 16 deletions
diff --git a/meta/classes/buildhistory.bbclass b/meta/classes/buildhistory.bbclass
index e121088d597..49f2ea5b7c1 100644
--- a/meta/classes/buildhistory.bbclass
+++ b/meta/classes/buildhistory.bbclass
@@ -293,13 +293,13 @@ buildhistory_get_image_installed() {
# Change delimiter from pipe to -> and set style for recommend lines
sed -i -e 's:|: -> :' -e 's:\[REC\]:[style=dotted]:' -e 's:$:;:' ${BUILDHISTORY_DIR_IMAGE}/depends.tmp
# Add header, sorted and de-duped contents and footer and then delete the temp file
- echo -e "digraph depends {\n node [shape=plaintext]" > ${BUILDHISTORY_DIR_IMAGE}/depends.dot
+ printf "digraph depends {\n node [shape=plaintext]\n" > ${BUILDHISTORY_DIR_IMAGE}/depends.dot
cat ${BUILDHISTORY_DIR_IMAGE}/depends.tmp | sort | uniq >> ${BUILDHISTORY_DIR_IMAGE}/depends.dot
echo "}" >> ${BUILDHISTORY_DIR_IMAGE}/depends.dot
rm ${BUILDHISTORY_DIR_IMAGE}/depends.tmp
# Produce installed package sizes list
- echo -n > ${BUILDHISTORY_DIR_IMAGE}/installed-package-sizes.tmp
+ printf "" > ${BUILDHISTORY_DIR_IMAGE}/installed-package-sizes.tmp
cat $pkgcache | while read pkg pkgfile
do
if [ -f $pkgfile ] ; then
@@ -330,7 +330,7 @@ buildhistory_get_imageinfo() {
( cd ${IMAGE_ROOTFS} && find . -ls | awk '{ if ( $7 ~ /[0-9]/ ) printf "%s %10-s %10-s %10s %s %s %s\n", $3, $5, $6, $7, $11, $12, $13 ; else printf "%s %10-s %10-s %10s %s %s %s\n", $3, $5, $6, 0, $10, $11, $12 }' | sort -k5 > ${BUILDHISTORY_DIR_IMAGE}/files-in-image.txt )
# Record some machine-readable meta-information about the image
- echo -n > ${BUILDHISTORY_DIR_IMAGE}/image-info.txt
+ printf "" > ${BUILDHISTORY_DIR_IMAGE}/image-info.txt
cat >> ${BUILDHISTORY_DIR_IMAGE}/image-info.txt <<END
${@buildhistory_get_imagevars(d)}
END
diff --git a/meta/classes/cml1.bbclass b/meta/classes/cml1.bbclass
index 67f17ad77e0..37ed792b7c1 100644
--- a/meta/classes/cml1.bbclass
+++ b/meta/classes/cml1.bbclass
@@ -20,7 +20,7 @@ python do_menuconfig() {
except OSError:
mtime = 0
- oe_terminal("${SHELL} -c \"make menuconfig; if [ $? -ne 0 ]; then echo 'Command failed.'; echo -n 'Press any key to continue... '; read r; fi\"", '${PN} Configuration', d)
+ oe_terminal("${SHELL} -c \"make menuconfig; if [ $? -ne 0 ]; then echo 'Command failed.'; printf 'Press any key to continue... '; read r; fi\"", '${PN} Configuration', d)
# FIXME this check can be removed when the minimum bitbake version has been bumped
if hasattr(bb.build, 'write_taint'):
diff --git a/meta/classes/license.bbclass b/meta/classes/license.bbclass
index 29fe93843fb..ffcaf93c538 100644
--- a/meta/classes/license.bbclass
+++ b/meta/classes/license.bbclass
@@ -112,16 +112,16 @@ license_create_manifest() {
echo "PACKAGE NAME:" ${pkg} >> ${LICENSE_MANIFEST}
echo "PACKAGE VERSION:" ${pkged_pv} >> ${LICENSE_MANIFEST}
echo "RECIPE NAME:" ${pkged_pn} >> ${LICENSE_MANIFEST}
- echo -n "LICENSE:" >> ${LICENSE_MANIFEST}
+ printf "LICENSE:" >> ${LICENSE_MANIFEST}
for lic in ${pkged_lic}; do
# to reference a license file trim trailing + symbol
if [ -e "${LICENSE_DIRECTORY}/${pkged_pn}/generic_${lic%+}" ]; then
- echo -n " ${lic}" >> ${LICENSE_MANIFEST}
+ printf " ${lic}" >> ${LICENSE_MANIFEST}
else
echo "WARNING: The license listed ${lic} was not in the licenses collected for ${pkged_pn}"
fi
done
- echo -e "\n" >> ${LICENSE_MANIFEST}
+ printf "\n\n" >> ${LICENSE_MANIFEST}
done
# Two options here:
diff --git a/meta/classes/package_deb.bbclass b/meta/classes/package_deb.bbclass
index 48511dfe90b..3b42d3b1942 100644
--- a/meta/classes/package_deb.bbclass
+++ b/meta/classes/package_deb.bbclass
@@ -192,7 +192,7 @@ deb_log_check() {
if (echo "$lf_txt" | grep -v log_check | grep "$keyword_die") >/dev/null 2>&1
then
echo "log_check: There were error messages in the logfile"
- echo -e "log_check: Matched keyword: [$keyword_die]\n"
+ printf "log_check: Matched keyword: [$keyword_die]\n\n"
echo "$lf_txt" | grep -v log_check | grep -C 5 -i "$keyword_die"
echo ""
do_exit=1
diff --git a/meta/classes/package_ipk.bbclass b/meta/classes/package_ipk.bbclass
index e94586e6caf..efe299eec89 100644
--- a/meta/classes/package_ipk.bbclass
+++ b/meta/classes/package_ipk.bbclass
@@ -181,7 +181,7 @@ ipk_log_check() {
if (echo "$lf_txt" | grep -v log_check | grep "$keyword_die") >/dev/null 2>&1
then
echo "log_check: There were error messages in the logfile"
- echo -e "log_check: Matched keyword: [$keyword_die]\n"
+ printf "log_check: Matched keyword: [$keyword_die]\n\n"
echo "$lf_txt" | grep -v log_check | grep -C 5 -i "$keyword_die"
echo ""
do_exit=1
diff --git a/meta/classes/package_rpm.bbclass b/meta/classes/package_rpm.bbclass
index 61f01172162..64689d8d721 100644
--- a/meta/classes/package_rpm.bbclass
+++ b/meta/classes/package_rpm.bbclass
@@ -110,7 +110,7 @@ rpm_log_check() {
if (echo "$lf_txt" | grep -v log_check | grep "$keyword_die") >/dev/null 2>&1
then
echo "log_check: There were error messages in the logfile"
- echo -e "log_check: Matched keyword: [$keyword_die]\n"
+ printf "log_check: Matched keyword: [$keyword_die]\n\n"
echo "$lf_txt" | grep -v log_check | grep -C 5 -i "$keyword_die"
echo ""
do_exit=1
@@ -211,8 +211,8 @@ process_pkg_list_rpm() {
pkgs="$@"
local confbase=${INSTALL_CONFBASE_RPM}
- echo -n > ${target_rootfs}/install/base_archs.pkglist
- echo -n > ${target_rootfs}/install/ml_archs.pkglist
+ printf "" > ${target_rootfs}/install/base_archs.pkglist
+ printf "" > ${target_rootfs}/install/ml_archs.pkglist
for pkg in $pkgs; do
echo "Processing $pkg..."
diff --git a/meta/classes/populate_sdk_base.bbclass b/meta/classes/populate_sdk_base.bbclass
index 1c151d71863..2bff41f9e6c 100644
--- a/meta/classes/populate_sdk_base.bbclass
+++ b/meta/classes/populate_sdk_base.bbclass
@@ -118,7 +118,7 @@ fakeroot create_shar() {
DEFAULT_INSTALL_DIR="${SDKPATH}"
-echo -n "Enter target directory for Poky SDK (default: $DEFAULT_INSTALL_DIR): "
+printf "Enter target directory for Poky SDK (default: $DEFAULT_INSTALL_DIR): "
read target_sdk_dir
if [ "$target_sdk_dir" = "" ]; then
@@ -128,7 +128,7 @@ fi
eval target_sdk_dir=$target_sdk_dir
target_sdk_dir=$(readlink -m $target_sdk_dir)
-echo -n "You are about to install Poky SDK to \"$target_sdk_dir\". Proceed[Y/n]?"
+printf "You are about to install Poky SDK to \"$target_sdk_dir\". Proceed[Y/n]?"
read answer
if [ "$answer" = "" ]; then
@@ -148,11 +148,11 @@ fi
payload_offset=$(($(grep -na -m1 "^MARKER:$" $(basename $0)|cut -d':' -f1) + 1))
-echo -n "Extracting SDK..."
+printf "Extracting SDK..."
tail -n +$payload_offset $(basename $0) | tar xj --strip-components=4 -C $target_sdk_dir
echo "done"
-echo -n "Setting it up..."
+printf "Setting it up..."
# fix environment paths
env_setup_script=$(find $target_sdk_dir -name "environment-setup-${REAL_MULTIMACH_TARGET_SYS}")
sed -e "s:$DEFAULT_INSTALL_DIR:$target_sdk_dir:g" -i $env_setup_script