public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH] wic-img: allow wic to find bitbake binary
@ 2020-01-27  9:50 Henning Schild
  2020-01-27  9:52 ` Henning Schild
  2020-03-09 11:01 ` Baurzhan Ismagulov
  0 siblings, 2 replies; 3+ messages in thread
From: Henning Schild @ 2020-01-27  9:50 UTC (permalink / raw)
  To: isar-users; +Cc: Henning Schild

From: Henning Schild <henning.schild@siemens.com>

Some code paths/plugins use bitbake libraries. Those are found relative
to the bitbake binary.
Mount bitbake into the buildchroot and rewrite the sudo statement so
that bitbake will be found in PATH.

One example to trigger the original problem would be to use the
"--exclude-path" argument for the "part" command of wic.

Signed-off-by: Henning Schild <henning.schild@siemens.com>
---
 meta/classes/wic-img.bbclass | 24 +++++++++++++++++++-----
 1 file changed, 19 insertions(+), 5 deletions(-)

diff --git a/meta/classes/wic-img.bbclass b/meta/classes/wic-img.bbclass
index 7d30e45e..afab3941 100644
--- a/meta/classes/wic-img.bbclass
+++ b/meta/classes/wic-img.bbclass
@@ -132,7 +132,7 @@ do_wic_image() {
     buildchroot_do_mounts
     sudo -s <<'EOSUDO'
         ( flock 9
-        for dir in ${BBLAYERS} ${STAGING_DIR} ${ISARROOT}/scripts; do
+        for dir in ${BBLAYERS} ${STAGING_DIR} ${ISARROOT}/scripts ${ISARROOT}/bitbake; do
             mkdir -p ${BUILDCHROOT_DIR}/$dir
             if ! mountpoint ${BUILDCHROOT_DIR}/$dir >/dev/null 2>&1; then
                 mount --bind --make-private $dir ${BUILDCHROOT_DIR}/$dir
@@ -148,11 +148,25 @@ EOSUDO
     WICTMP=$(cd ${BUILDCHROOT_DIR}; mktemp -d -p tmp)
 
     sudo -E chroot ${BUILDCHROOT_DIR} \
-        ${ISARROOT}/scripts/wic create ${WKS_FULL_PATH} \
-            --vars "${STAGING_DIR}/${MACHINE}/imgdata/" \
-            -o /$WICTMP/${IMAGE_FULLNAME}.wic/ \
+        sh -c ' \
+          ISARROOT="$1"
+          WKS_FULL_PATH="$2"
+          STAGING_DIR="$3"
+          MACHINE="$4"
+          WICTMP="$5"
+          IMAGE_FULLNAME="$6"
+          IMAGE_BASENAME="$7"
+          shift 7
+
+          export PATH="$ISARROOT/bitbake/bin:$PATH"
+          "$ISARROOT"/scripts/wic create "$WKS_FULL_PATH" \
+            --vars "$STAGING_DIR/$MACHINE/imgdata/" \
+            -o "/$WICTMP/${IMAGE_FULLNAME}.wic/" \
             --bmap \
-            -e ${IMAGE_BASENAME} ${WIC_CREATE_EXTRA_ARGS}
+            -e "$IMAGE_BASENAME" $@' \
+              my_script "${ISARROOT}" "${WKS_FULL_PATH}" "${STAGING_DIR}" \
+              "${MACHINE}" "${WICTMP}" "${IMAGE_FULLNAME}" "${IMAGE_BASENAME}" \
+              ${WIC_CREATE_EXTRA_ARGS}
     sudo chown -R $(stat -c "%U" ${ISARROOT}) ${ISARROOT}/meta ${ISARROOT}/meta-isar ${ISARROOT}/scripts || true
     WIC_DIRECT=$(ls -t -1 ${BUILDCHROOT_DIR}/$WICTMP/${IMAGE_FULLNAME}.wic/*.direct | head -1)
     sudo chown -R $(id -u):$(id -g) ${BUILDCHROOT_DIR}/${WICTMP}
-- 
2.24.1


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

* Re: [PATCH] wic-img: allow wic to find bitbake binary
  2020-01-27  9:50 [PATCH] wic-img: allow wic to find bitbake binary Henning Schild
@ 2020-01-27  9:52 ` Henning Schild
  2020-03-09 11:01 ` Baurzhan Ismagulov
  1 sibling, 0 replies; 3+ messages in thread
From: Henning Schild @ 2020-01-27  9:52 UTC (permalink / raw)
  To: isar-users

On Mon, 27 Jan 2020 10:50:19 +0100
Henning Schild <henning.schild@siemens.com> wrote:

> From: Henning Schild <henning.schild@siemens.com>
> 
> Some code paths/plugins use bitbake libraries. Those are found
> relative to the bitbake binary.
> Mount bitbake into the buildchroot and rewrite the sudo statement so
> that bitbake will be found in PATH.
> 
> One example to trigger the original problem would be to use the
> "--exclude-path" argument for the "part" command of wic.

Unfortunately that fix on the Isar side is just part of the story for
this example.

Still let us run wic in an environment where it can find bitbake and
its libs. After all that is what wic is used to.

Henning

> Signed-off-by: Henning Schild <henning.schild@siemens.com>
> ---
>  meta/classes/wic-img.bbclass | 24 +++++++++++++++++++-----
>  1 file changed, 19 insertions(+), 5 deletions(-)
> 
> diff --git a/meta/classes/wic-img.bbclass
> b/meta/classes/wic-img.bbclass index 7d30e45e..afab3941 100644
> --- a/meta/classes/wic-img.bbclass
> +++ b/meta/classes/wic-img.bbclass
> @@ -132,7 +132,7 @@ do_wic_image() {
>      buildchroot_do_mounts
>      sudo -s <<'EOSUDO'
>          ( flock 9
> -        for dir in ${BBLAYERS} ${STAGING_DIR} ${ISARROOT}/scripts; do
> +        for dir in ${BBLAYERS} ${STAGING_DIR} ${ISARROOT}/scripts
> ${ISARROOT}/bitbake; do mkdir -p ${BUILDCHROOT_DIR}/$dir
>              if ! mountpoint ${BUILDCHROOT_DIR}/$dir >/dev/null 2>&1;
> then mount --bind --make-private $dir ${BUILDCHROOT_DIR}/$dir
> @@ -148,11 +148,25 @@ EOSUDO
>      WICTMP=$(cd ${BUILDCHROOT_DIR}; mktemp -d -p tmp)
>  
>      sudo -E chroot ${BUILDCHROOT_DIR} \
> -        ${ISARROOT}/scripts/wic create ${WKS_FULL_PATH} \
> -            --vars "${STAGING_DIR}/${MACHINE}/imgdata/" \
> -            -o /$WICTMP/${IMAGE_FULLNAME}.wic/ \
> +        sh -c ' \
> +          ISARROOT="$1"
> +          WKS_FULL_PATH="$2"
> +          STAGING_DIR="$3"
> +          MACHINE="$4"
> +          WICTMP="$5"
> +          IMAGE_FULLNAME="$6"
> +          IMAGE_BASENAME="$7"
> +          shift 7
> +
> +          export PATH="$ISARROOT/bitbake/bin:$PATH"
> +          "$ISARROOT"/scripts/wic create "$WKS_FULL_PATH" \
> +            --vars "$STAGING_DIR/$MACHINE/imgdata/" \
> +            -o "/$WICTMP/${IMAGE_FULLNAME}.wic/" \
>              --bmap \
> -            -e ${IMAGE_BASENAME} ${WIC_CREATE_EXTRA_ARGS}
> +            -e "$IMAGE_BASENAME" $@' \
> +              my_script "${ISARROOT}" "${WKS_FULL_PATH}"
> "${STAGING_DIR}" \
> +              "${MACHINE}" "${WICTMP}" "${IMAGE_FULLNAME}"
> "${IMAGE_BASENAME}" \
> +              ${WIC_CREATE_EXTRA_ARGS}
>      sudo chown -R $(stat -c "%U" ${ISARROOT}) ${ISARROOT}/meta
> ${ISARROOT}/meta-isar ${ISARROOT}/scripts || true WIC_DIRECT=$(ls -t
> -1 ${BUILDCHROOT_DIR}/$WICTMP/${IMAGE_FULLNAME}.wic/*.direct | head
> -1) sudo chown -R $(id -u):$(id -g) ${BUILDCHROOT_DIR}/${WICTMP}


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

* Re: [PATCH] wic-img: allow wic to find bitbake binary
  2020-01-27  9:50 [PATCH] wic-img: allow wic to find bitbake binary Henning Schild
  2020-01-27  9:52 ` Henning Schild
@ 2020-03-09 11:01 ` Baurzhan Ismagulov
  1 sibling, 0 replies; 3+ messages in thread
From: Baurzhan Ismagulov @ 2020-03-09 11:01 UTC (permalink / raw)
  To: isar-users

On Mon, Jan 27, 2020 at 10:50:19AM +0100, Henning Schild wrote:
> Some code paths/plugins use bitbake libraries. Those are found relative
> to the bitbake binary.
> Mount bitbake into the buildchroot and rewrite the sudo statement so
> that bitbake will be found in PATH.
> 
> One example to trigger the original problem would be to use the
> "--exclude-path" argument for the "part" command of wic.

Applied to next, thanks.

With kind regards,
Baurzhan.

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

end of thread, other threads:[~2020-03-09 11:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-27  9:50 [PATCH] wic-img: allow wic to find bitbake binary Henning Schild
2020-01-27  9:52 ` Henning Schild
2020-03-09 11:01 ` Baurzhan Ismagulov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox