Hi Marek & list,

> Gesendet: Donnerstag, 19. September 2013 um 14:27 Uhr
> Von: "Marek Vasut" <[email protected]>
> An: [email protected]
> Cc: [email protected], [email protected], "Marek Vasut" <[email protected]>
> Betreff: [PATCH 3/5] META-ELDK: Use regular test command
>
> Instead of using [[ ... ]] command as a 'test', which is unportable
> BASH-specific thing, use the regular 'test' command. The former breaks
> on Debian Jessie, since the default /bin/sh shell on Debian is DASH.
> The later works as expected.

Great news, to have some feedback! Sry for the delay in my answers, since I'm 
currently quite busy. Generally I hope that the patches still were somehow 
helpful. About the [[ ]] (we already talked about it, and Marek is right), I 
based my approach on the following facts

1) I also use debian, but I configured Bash instead of Dash, thus I did not 
experience any effect

2) [Spoiler:] by the Advanced Bash Scripting Guide 
[http://tldp.org/LDP/abs/html/abs-guide.html#LEFTBRACKET]:
"Note that [ is part of the shell builtin test (and a synonym for it), not a 
link to the external command /usr/bin/test."
So I read it as "test" still being an external tool. Anyway in Bash you also 
have the "Test expression between [[ ]]" which is "more flexible than the 
single-bracket [ ] test". And less compatible, though. Interesting for me, 
since I was quite used to the convenience of [[ ]], especially when you do more 
scripting, and probably thus forgot about incompatibilities.

Thank you for fixing.
Best,
L

> Signed-off-by: Marek Vasut <[email protected]>
> ---
>  meta-eldk/classes/image_types_m28evk.bbclass     | 8 ++++----
>  meta-eldk/classes/image_types_m53evk.bbclass     | 8 ++++----
>  meta-eldk/recipes-kernel/linux/linux-eldk_3.8.bb | 2 +-
>  meta-eldk/recipes-kernel/linux/linux-eldk_3.9.bb | 4 ++--
>  4 files changed, 11 insertions(+), 11 deletions(-)
> 
> diff --git a/meta-eldk/classes/image_types_m28evk.bbclass 
> b/meta-eldk/classes/image_types_m28evk.bbclass
> index 2f8d0f6..7643ab1 100644
> --- a/meta-eldk/classes/image_types_m28evk.bbclass
> +++ b/meta-eldk/classes/image_types_m28evk.bbclass
> @@ -30,7 +30,7 @@ IMAGE_CMD_uboot.mxsboot-sdcard = "mxsboot sd 
> ${DEPLOY_DIR_IMAGE}/u-boot-${MACHIN
>  ## .sdcard image with one bootpartition for uImage and FDT, and one rootfs 
> partition
>  IMAGE_DEPENDS_sdcard = "parted-native dosfstools-native mtools-native 
> virtual/kernel ${IMAGE_BOOTLOADER}"
>  IMAGE_CMD_sdcard(){
> -    if [[ -z "${SDCARD_ROOTFS}" ]]; then
> +    if test -z "${SDCARD_ROOTFS}" ; then
>       bberror "SDCARD_ROOTFS is undefined. To use sdcard image from 
> Freescale's BSP it needs to be defined."
>       exit 1
>      fi
> @@ -74,7 +74,7 @@ IMAGE_CMD_sdcard(){
>  
>      ## boot image
>      IMAGE_BOOTFS="${WORKDIR}/boot-$(date +%Y%m%d%H%M%S)"
> -    [[ ! -e "${IMAGE_BOOTFS}" ]] && mkdir -p "${IMAGE_BOOTFS}"
> +    test ! -e "${IMAGE_BOOTFS}" && mkdir -p "${IMAGE_BOOTFS}"
>  
>      ## uImage
>      cp "${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${MACHINE}.bin" 
> "${IMAGE_BOOTFS}/${KERNEL_IMAGETYPE}"
> @@ -82,10 +82,10 @@ IMAGE_CMD_sdcard(){
>      ## uImage, dtb
>      for dts in ${KERNEL_DEVICETREE}; do
>          local dts_basename=$(basename ${dts} | awk -F "." '{print $1}')
> -        if [[ -e "${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${MACHINE}.dtb" 
> ]]; then
> +        if test -e "${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${MACHINE}.dtb" 
> ; then
>              local kernel_bin="$(readlink 
> ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${MACHINE}.bin)"
>              local kernel_dtb="$(readlink 
> ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${MACHINE}.dtb)"
> -            if [[ "${kernel_bin%-${MACHINE}*.bin}" == 
> "${kernel_dtb%-${MACHINE}*.dtb}" ]]; then
> +            if test "${kernel_bin%-${MACHINE}*.bin}" == 
> "${kernel_dtb%-${MACHINE}*.dtb}" ; then
>                  cp "${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${MACHINE}.dtb" 
> "${IMAGE_BOOTFS}/${dts_basename}.dtb"
>              fi
>          else
> diff --git a/meta-eldk/classes/image_types_m53evk.bbclass 
> b/meta-eldk/classes/image_types_m53evk.bbclass
> index 946dc77..d78d670 100644
> --- a/meta-eldk/classes/image_types_m53evk.bbclass
> +++ b/meta-eldk/classes/image_types_m53evk.bbclass
> @@ -23,7 +23,7 @@ IMAGE_DEPENDS_sdcard = "parted-native dosfstools-native 
> mtools-native \
>                          virtual/kernel u-boot"
>  
>  IMAGE_CMD_sdcard(){
> -    if [[ -z "${SDCARD_ROOTFS}" ]]; then
> +    if test -z "${SDCARD_ROOTFS}" ; then
>       bberror "SDCARD_ROOTFS is undefined. To use sdcard image from 
> Freescale's BSP it needs to be defined."
>       exit 1
>      fi
> @@ -75,7 +75,7 @@ IMAGE_CMD_sdcard(){
>      local boot_blocks=$(LC_ALL=C parted -s ${SDCARD} unit b print | awk '/ 1 
> / { print substr($4, 1, length($4 -1)) / 1024 }')
>  
>      IMAGE_BOOTFS="${WORKDIR}/boot-$(date +%Y%m%d%H%M%S)"
> -    [[ ! -e "${IMAGE_BOOTFS}" ]] && mkdir -p "${IMAGE_BOOTFS}"
> +    test ! -e "${IMAGE_BOOTFS}"  && mkdir -p "${IMAGE_BOOTFS}"
>  
>      ## uImage
>      cp "${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${MACHINE}.bin" 
> "${IMAGE_BOOTFS}/${KERNEL_IMAGETYPE}"
> @@ -83,10 +83,10 @@ IMAGE_CMD_sdcard(){
>      ## uImage, dtb
>      for dts in ${KERNEL_DEVICETREE}; do
>          local dts_basename=$(basename ${dts} | awk -F "." '{print $1}')
> -        if [[ -e "${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${MACHINE}.dtb" 
> ]]; then
> +        if test -e "${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${MACHINE}.dtb" 
> ; then
>              local kernel_bin="$(readlink 
> ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${MACHINE}.bin)"
>              local kernel_dtb="$(readlink 
> ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${MACHINE}.dtb)"
> -            if [[ "${kernel_bin%-${MACHINE}*.bin}" == 
> "${kernel_dtb%-${MACHINE}*.dtb}" ]]; then
> +            if test "${kernel_bin%-${MACHINE}*.bin}" == 
> "${kernel_dtb%-${MACHINE}*.dtb}" ; then
>                  cp "${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${MACHINE}.dtb" 
> "${IMAGE_BOOTFS}/${dts_basename}.dtb"
>              fi
>          else
> diff --git a/meta-eldk/recipes-kernel/linux/linux-eldk_3.8.bb 
> b/meta-eldk/recipes-kernel/linux/linux-eldk_3.8.bb
> index d454c6c..6ac2041 100644
> --- a/meta-eldk/recipes-kernel/linux/linux-eldk_3.8.bb
> +++ b/meta-eldk/recipes-kernel/linux/linux-eldk_3.8.bb
> @@ -48,5 +48,5 @@ SRC_URI_m28evk = 
> "git://kernel.ubuntu.com/ubuntu/linux.git;protocol=git   \
>  
>  do_compile_append_m28evk(){
>      ## linux.inc copies Image to uImage if it is present, this may be a bug 
> in linux.inc
> -    [[ -e ${WORKDIR}/git/arch/arm/boot/Image ]] && rm 
> ${WORKDIR}/git/arch/arm/boot/Image
> +    test -e ${WORKDIR}/git/arch/arm/boot/Image && rm 
> ${WORKDIR}/git/arch/arm/boot/Image
>  }
> diff --git a/meta-eldk/recipes-kernel/linux/linux-eldk_3.9.bb 
> b/meta-eldk/recipes-kernel/linux/linux-eldk_3.9.bb
> index b2db136..2714cf2 100644
> --- a/meta-eldk/recipes-kernel/linux/linux-eldk_3.9.bb
> +++ b/meta-eldk/recipes-kernel/linux/linux-eldk_3.9.bb
> @@ -37,7 +37,7 @@ SRCREV_m28evk = "c1be5a5b1b355d40e6cf79cc979eb66dafa24ad1"
>  LOCALVERSION_m28evk = "-denx"
>  
>  do_compile_append_m28evk(){
> -    [[ -e ${WORKDIR}/git/arch/arm/boot/Image ]] && rm 
> ${WORKDIR}/git/arch/arm/boot/Image
> +    test -e ${WORKDIR}/git/arch/arm/boot/Image && rm 
> ${WORKDIR}/git/arch/arm/boot/Image
>  }
>  
>  
> @@ -59,7 +59,7 @@ do_configure_prepend_m53evk(){
>  
>  do_compile_append_m53evk(){
>      ## linux.inc would overwrite uImage with Image
> -    [[ -e ${WORKDIR}/git/arch/arm/boot/Image ]] && rm 
> ${WORKDIR}/git/arch/arm/boot/Image
> +    test -e ${WORKDIR}/git/arch/arm/boot/Image && rm 
> ${WORKDIR}/git/arch/arm/boot/Image
>  }
>  
>  
> -- 
> 1.8.4.rc3
> 
> 
_______________________________________________
eldk mailing list
[email protected]
http://lists.denx.de/mailman/listinfo/eldk

Reply via email to