public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Henning Schild <henning.schild@siemens.com>
To: isar-users@googlegroups.com
Cc: Henning Schild <henning.schild@siemens.com>
Subject: [PATCH] wic-img: allow wic to find bitbake binary
Date: Mon, 27 Jan 2020 10:50:19 +0100	[thread overview]
Message-ID: <20200127095019.16567-1-henning.schild@siemens.com> (raw)

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


             reply	other threads:[~2020-01-27  9:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-27  9:50 Henning Schild [this message]
2020-01-27  9:52 ` Henning Schild
2020-03-09 11:01 ` Baurzhan Ismagulov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200127095019.16567-1-henning.schild@siemens.com \
    --to=henning.schild@siemens.com \
    --cc=isar-users@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox