All of lore.kernel.org
 help / color / mirror / Atom feed
* [meta-oe][PATCH] android-tools: fix do_install
@ 2016-11-18 10:26 Koen Kooi
  2016-11-18 10:59 ` André Draszik
  2016-11-18 11:08 ` Nicolas Dechesne
  0 siblings, 2 replies; 3+ messages in thread
From: Koen Kooi @ 2016-11-18 10:26 UTC (permalink / raw)
  To: openembedded-devel; +Cc: Koen Kooi

The previous patch introduced 2 bugs that made packaging fail:

1) Always failing grep
2) Conditionally install systemd files

Systemd.bbclass doesn't handle conditional installation and will throw an error.

Tested with -native and regular cross builds.

Signed-off-by: Koen Kooi <koen.kooi@linaro.org>
---
 .../android-tools/android-tools_5.1.1.r37.bb          | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/meta-oe/recipes-devtools/android-tools/android-tools_5.1.1.r37.bb b/meta-oe/recipes-devtools/android-tools/android-tools_5.1.1.r37.bb
index 1769b6a..5041465 100644
--- a/meta-oe/recipes-devtools/android-tools/android-tools_5.1.1.r37.bb
+++ b/meta-oe/recipes-devtools/android-tools/android-tools_5.1.1.r37.bb
@@ -108,7 +108,10 @@ do_compile() {
 }
 
 do_install() {
-    if [ grep -q "ext4_utils" "${TOOLS}" ] ; then
+    export TOOLSFILE="${WORKDIR}/tools.txt"
+    echo ${TOOLS} > ${TOOLSFILE}
+
+    if grep -q "ext4_utils" ${TOOLSFILE} ; then
         install -D -p -m0755 ${S}/system/core/libsparse/simg_dump.py ${D}${bindir}/simg_dump
         install -D -p -m0755 ${S}/system/extras/ext4_utils/mkuserimg.sh ${D}${bindir}/mkuserimg
 
@@ -120,21 +123,23 @@ do_install() {
         install -m0755 ${B}/ext4_utils/simg2simg ${D}${bindir}
     fi
 
-    if [ grep -q "adb " "${TOOLS}" ] ; then
+    if grep -q "adb " ${TOOLSFILE} ; then
         install -m0755 ${B}/adb/adb ${D}${bindir}i
     fi
 
-    if [ grep -q "adbd" "${TOOLS}" ] ; then
+    if grep -q "adbd" ${TOOLSFILE} ; then
         install -m0755 ${B}/adbd/adbd ${D}${bindir}
-        install -D -p -m0644 ${WORKDIR}/android-tools-adbd.service \
-          ${D}${systemd_unitdir}/system/android-tools-adbd.service
     fi
 
-    if [ grep -q "fastboot" "${TOOLS}" ] ; then
+    # Outside the if statement to avoid errors during do_package
+    install -D -p -m0644 ${WORKDIR}/android-tools-adbd.service \
+      ${D}${systemd_unitdir}/system/android-tools-adbd.service
+
+    if grep -q "fastboot" ${TOOLSFILE} ; then
         install -m0755 ${B}/fastboot/fastboot ${D}${bindir}
     fi
 
-    if [ grep -q "mkbootimg" "${TOOLS}" ] ; then
+    if grep -q "mkbootimg" ${TOOLSFILE} ; then
          install -m0755 ${B}/mkbootimg/mkbootimg ${D}${bindir}
     fi
 }
-- 
2.4.11



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [meta-oe][PATCH] android-tools: fix do_install
  2016-11-18 10:26 [meta-oe][PATCH] android-tools: fix do_install Koen Kooi
@ 2016-11-18 10:59 ` André Draszik
  2016-11-18 11:08 ` Nicolas Dechesne
  1 sibling, 0 replies; 3+ messages in thread
From: André Draszik @ 2016-11-18 10:59 UTC (permalink / raw)
  To: openembedded-devel; +Cc: Koen Kooi

On Fri, 2016-11-18 at 11:26 +0100, Koen Kooi wrote:
> The previous patch introduced 2 bugs that made packaging fail:
> 
> 1) Always failing grep
> 2) Conditionally install systemd files
> 
> Systemd.bbclass doesn't handle conditional installation and will throw an
> error.
> 
> Tested with -native and regular cross builds.
> 
> Signed-off-by: Koen Kooi <koen.kooi@linaro.org>
> ---
>  .../android-tools/android-tools_5.1.1.r37.bb          | 19 ++++++++++++
> -------
>  1 file changed, 12 insertions(+), 7 deletions(-)
> 
> diff --git a/meta-oe/recipes-devtools/android-tools/android-
> tools_5.1.1.r37.bb b/meta-oe/recipes-devtools/android-tools/android-
> tools_5.1.1.r37.bb
> index 1769b6a..5041465 100644
> --- a/meta-oe/recipes-devtools/android-tools/android-tools_5.1.1.r37.bb
> +++ b/meta-oe/recipes-devtools/android-tools/android-tools_5.1.1.r37.bb
> @@ -108,7 +108,10 @@ do_compile() {
>  }
>  
>  do_install() {
> -    if [ grep -q "ext4_utils" "${TOOLS}" ] ; then
> +    export TOOLSFILE="${WORKDIR}/tools.txt"
> +    echo ${TOOLS} > ${TOOLSFILE}
> +
> +    if grep -q "ext4_utils" ${TOOLSFILE} ; then

Why not simply echo instead of doing file i/o:
if echo ${TOOLS} | grep ....


>          install -D -p -m0755 ${S}/system/core/libsparse/simg_dump.py
> ${D}${bindir}/simg_dump
>          install -D -p -m0755 ${S}/system/extras/ext4_utils/mkuserimg.sh
> ${D}${bindir}/mkuserimg

BTW, if ext4_utils is not in TOOLS, then none of the following TOOLS will
install correctly, because ${D}${bindir} is created only in this block here.

>  
> @@ -120,21 +123,23 @@ do_install() {
>          install -m0755 ${B}/ext4_utils/simg2simg ${D}${bindir}
>      fi
>  
> -    if [ grep -q "adb " "${TOOLS}" ] ; then
> +    if grep -q "adb " ${TOOLSFILE} ; then
>          install -m0755 ${B}/adb/adb ${D}${bindir}i
                                                    ^

This doesn't look right.


>      fi
>  
> -    if [ grep -q "adbd" "${TOOLS}" ] ; then
> +    if grep -q "adbd" ${TOOLSFILE} ; then
>          install -m0755 ${B}/adbd/adbd ${D}${bindir}
> -        install -D -p -m0644 ${WORKDIR}/android-tools-adbd.service \
> -          ${D}${systemd_unitdir}/system/android-tools-adbd.service
>      fi
>  
> -    if [ grep -q "fastboot" "${TOOLS}" ] ; then
> +    # Outside the if statement to avoid errors during do_package
> +    install -D -p -m0644 ${WORKDIR}/android-tools-adbd.service \
> +      ${D}${systemd_unitdir}/system/android-tools-adbd.service
> +
> +    if grep -q "fastboot" ${TOOLSFILE} ; then
>          install -m0755 ${B}/fastboot/fastboot ${D}${bindir}
>      fi
>  
> -    if [ grep -q "mkbootimg" "${TOOLS}" ] ; then
> +    if grep -q "mkbootimg" ${TOOLSFILE} ; then
>           install -m0755 ${B}/mkbootimg/mkbootimg ${D}${bindir}
>      fi
>  }
> -- 
> 2.4.11
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [meta-oe][PATCH] android-tools: fix do_install
  2016-11-18 10:26 [meta-oe][PATCH] android-tools: fix do_install Koen Kooi
  2016-11-18 10:59 ` André Draszik
@ 2016-11-18 11:08 ` Nicolas Dechesne
  1 sibling, 0 replies; 3+ messages in thread
From: Nicolas Dechesne @ 2016-11-18 11:08 UTC (permalink / raw)
  To: openembedded-devel; +Cc: Koen Kooi

On Fri, Nov 18, 2016 at 11:26 AM, Koen Kooi <koen.kooi@linaro.org> wrote:
> -    if [ grep -q "ext4_utils" "${TOOLS}" ] ; then
> +    export TOOLSFILE="${WORKDIR}/tools.txt"
> +    echo ${TOOLS} > ${TOOLSFILE}
> +
> +    if grep -q "ext4_utils" ${TOOLSFILE} ; then


how about this instead?

echo  "${TOOLS}" | grep -q "ext4_utils"

it looks simpler and more readable to me.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-11-18 11:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-18 10:26 [meta-oe][PATCH] android-tools: fix do_install Koen Kooi
2016-11-18 10:59 ` André Draszik
2016-11-18 11:08 ` Nicolas Dechesne

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.