public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: claudius.heine.ext@siemens.com
To: isar-users@googlegroups.com
Cc: Claudius Heine <ch@denx.de>
Subject: [PATCH v2 2/2] meta-isar/isar-image-base and meta/buildchroot: Use fetcher for files
Date: Thu, 21 Sep 2017 13:19:11 +0200	[thread overview]
Message-ID: <20170921111911.8133-3-claudius.heine.ext@siemens.com> (raw)
In-Reply-To: <20170921111911.8133-1-claudius.heine.ext@siemens.com>

From: Claudius Heine <ch@denx.de>

Issue:
Copying from the recipe directory is currently done by copying from it
using the "THISDIR" variable. This variable points to the wrong
directory when recipes are 'required' by other recipes.

Change:
Use the bitbake fetchers for these files.

Impact:
No negative impact known.

Signed-off-by: Claudius Heine <ch@denx.de>
---
 meta-isar/recipes-core/images/isar-image-base.bb | 38 +++++++++++++-----------
 meta/recipes-devtools/buildchroot/buildchroot.bb | 31 ++++++++++---------
 2 files changed, 38 insertions(+), 31 deletions(-)

diff --git a/meta-isar/recipes-core/images/isar-image-base.bb b/meta-isar/recipes-core/images/isar-image-base.bb
index ccbece0..f4b0125 100644
--- a/meta-isar/recipes-core/images/isar-image-base.bb
+++ b/meta-isar/recipes-core/images/isar-image-base.bb
@@ -8,6 +8,12 @@ DESCRIPTION = "Multistrap target filesystem"
 LICENSE = "gpl-2.0"
 LIC_FILES_CHKSUM = "file://${LAYERDIR_isar}/licenses/COPYING.GPLv2;md5=751419260aa954499f7abaabaa882bbe"
 
+FILESPATH =. "${LAYERDIR_isar}/recipes-core/images/files:"
+SRC_URI = "file://multistrap.conf.in \
+	   file://${DISTRO_CONFIG_SCRIPT} \
+	   file://setup.sh \
+	   file://download_dev-random"
+
 PV = "1.0"
 
 inherit image
@@ -23,34 +29,32 @@ do_rootfs[stamp-extra-info] = "${MACHINE}-${DISTRO}"
 do_rootfs[dirs] = "${WORKDIR}/hooks_multistrap"
 
 do_rootfs() {
-    # Copy config file
-    install -m 644 ${THISDIR}/files/multistrap.conf.in ${WORKDIR}/multistrap.conf
-    install -m 755 ${THISDIR}/files/${DISTRO_CONFIG_SCRIPT} ${WORKDIR}/configscript.sh
-    install -m 755 ${THISDIR}/files/setup.sh ${WORKDIR}
-    install -m 755 ${THISDIR}/files/download_dev-random ${WORKDIR}/hooks_multistrap/
+    chmod +x "${WORKDIR}/${DISTRO_CONFIG_SCRIPT}"
+    chmod +x "${WORKDIR}/setup.sh"
+    install -m 755 "${WORKDIR}/download_dev-random" "${WORKDIR}/hooks_multistrap/"
 
     # Multistrap accepts only relative path in configuration files, so get it:
     cd ${TOPDIR}
     WORKDIR_REL=${@ os.path.relpath(d.getVar("WORKDIR", True))}
 
     # Adjust multistrap config
-    sed -i -e 's|##IMAGE_PREINSTALL##|${IMAGE_PREINSTALL}|g' \
-           -e 's|##DISTRO##|${DISTRO}|g' \
-           -e 's|##DISTRO_APT_SOURCE##|${DISTRO_APT_SOURCE}|g' \
-           -e 's|##DISTRO_SUITE##|${DISTRO_SUITE}|g' \
-           -e 's|##DISTRO_COMPONENTS##|${DISTRO_COMPONENTS}|g' \
-           -e 's|##CONFIG_SCRIPT##|./'"$WORKDIR_REL"'/configscript.sh|g' \
-           -e 's|##SETUP_SCRIPT##|./'"$WORKDIR_REL"'/setup.sh|g' \
-           -e 's|##DIR_HOOKS##|./'"$WORKDIR_REL"'/hooks_multistrap|g' \
-              ${WORKDIR}/multistrap.conf
+    sed -e 's|##IMAGE_PREINSTALL##|${IMAGE_PREINSTALL}|g' \
+        -e 's|##DISTRO##|${DISTRO}|g' \
+        -e 's|##DISTRO_APT_SOURCE##|${DISTRO_APT_SOURCE}|g' \
+        -e 's|##DISTRO_SUITE##|${DISTRO_SUITE}|g' \
+        -e 's|##DISTRO_COMPONENTS##|${DISTRO_COMPONENTS}|g' \
+        -e 's|##CONFIG_SCRIPT##|./'"$WORKDIR_REL"'/${DISTRO_CONFIG_SCRIPT}|g' \
+        -e 's|##SETUP_SCRIPT##|./'"$WORKDIR_REL"'/setup.sh|g' \
+        -e 's|##DIR_HOOKS##|./'"$WORKDIR_REL"'/hooks_multistrap|g' \
+           "${WORKDIR}/multistrap.conf.in" > "${WORKDIR}/multistrap.conf"
 
     # Create root filesystem
     sudo multistrap -a ${DISTRO_ARCH} -d "${IMAGE_ROOTFS}" -f "${WORKDIR}/multistrap.conf" || true
 
     # Configure root filesystem
-    sudo chroot ${IMAGE_ROOTFS} /configscript.sh ${MACHINE_SERIAL} ${BAUDRATE_TTY} \
+    sudo chroot ${IMAGE_ROOTFS} /${DISTRO_CONFIG_SCRIPT} ${MACHINE_SERIAL} ${BAUDRATE_TTY} \
         ${ROOTFS_DEV}
-    sudo rm ${IMAGE_ROOTFS}/configscript.sh
+    sudo rm "${IMAGE_ROOTFS}/${DISTRO_CONFIG_SCRIPT}"
 }
 
-addtask rootfs before do_populate
+addtask rootfs before do_populate after do_unpack
diff --git a/meta/recipes-devtools/buildchroot/buildchroot.bb b/meta/recipes-devtools/buildchroot/buildchroot.bb
index af9f3a8..a5a1896 100644
--- a/meta/recipes-devtools/buildchroot/buildchroot.bb
+++ b/meta/recipes-devtools/buildchroot/buildchroot.bb
@@ -8,6 +8,11 @@ DESCRIPTION = "Multistrap development filesystem"
 LICENSE = "gpl-2.0"
 LIC_FILES_CHKSUM = "file://${LAYERDIR_isar}/licenses/COPYING.GPLv2;md5=751419260aa954499f7abaabaa882bbe"
 
+FILESPATH =. "${LAYERDIR_core}/recipes-devtools/buildchroot/files:"
+SRC_URI = "file://multistrap.conf.in \
+           file://configscript.sh \
+           file://setup.sh \
+           file://download_dev-random"
 PV = "1.0"
 
 BUILDCHROOT_PREINSTALL ?= "gcc \
@@ -27,26 +32,24 @@ do_build[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}"
 do_build[dirs] = "${WORKDIR}/hooks_multistrap"
 
 do_build() {
-    # Copy config files
-    install -m 644 ${THISDIR}/files/multistrap.conf.in ${WORKDIR}/multistrap.conf
-    install -m 755 ${THISDIR}/files/configscript.sh ${WORKDIR}
-    install -m 755 ${THISDIR}/files/setup.sh ${WORKDIR}
-    install -m 755 ${THISDIR}/files/download_dev-random ${WORKDIR}/hooks_multistrap/
+    chmod +x "${WORKDIR}/setup.sh"
+    chmod +x "${WORKDIR}/configscript.sh"
+    install -m 755 "${WORKDIR}/download_dev-random" "${WORKDIR}/hooks_multistrap/"
 
     # Multistrap accepts only relative path in configuration files, so get it:
     cd ${TOPDIR}
     WORKDIR_REL=${@ os.path.relpath(d.getVar("WORKDIR", True))}
 
     # Adjust multistrap config
-    sed -i -e 's|##BUILDCHROOT_PREINSTALL##|${BUILDCHROOT_PREINSTALL}|g' \
-           -e 's|##DISTRO##|${DISTRO}|g' \
-           -e 's|##DISTRO_APT_SOURCE##|${DISTRO_APT_SOURCE}|g' \
-           -e 's|##DISTRO_SUITE##|${DISTRO_SUITE}|g' \
-           -e 's|##DISTRO_COMPONENTS##|${DISTRO_COMPONENTS}|g' \
-           -e 's|##CONFIG_SCRIPT##|./'"$WORKDIR_REL"'/configscript.sh|g' \
-           -e 's|##SETUP_SCRIPT##|./'"$WORKDIR_REL"'/setup.sh|g' \
-           -e 's|##DIR_HOOKS##|./'"$WORKDIR_REL"'/hooks_multistrap|g' \
-              ${WORKDIR}/multistrap.conf
+    sed -e 's|##BUILDCHROOT_PREINSTALL##|${BUILDCHROOT_PREINSTALL}|g' \
+        -e 's|##DISTRO##|${DISTRO}|g' \
+        -e 's|##DISTRO_APT_SOURCE##|${DISTRO_APT_SOURCE}|g' \
+        -e 's|##DISTRO_SUITE##|${DISTRO_SUITE}|g' \
+        -e 's|##DISTRO_COMPONENTS##|${DISTRO_COMPONENTS}|g' \
+        -e 's|##CONFIG_SCRIPT##|./'"$WORKDIR_REL"'/configscript.sh|g' \
+        -e 's|##SETUP_SCRIPT##|./'"$WORKDIR_REL"'/setup.sh|g' \
+        -e 's|##DIR_HOOKS##|./'"$WORKDIR_REL"'/hooks_multistrap|g' \
+           "${WORKDIR}/multistrap.conf.in" > "${WORKDIR}/multistrap.conf"
 
     # Create root filesystem
     sudo multistrap -a ${DISTRO_ARCH} -d "${BUILDCHROOT_DIR}" -f "${WORKDIR}/multistrap.conf" || true
-- 
2.14.1


  parent reply	other threads:[~2017-09-21 11:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-21 11:19 [PATCH v2 0/2] Use fetcher for images claudius.heine.ext
2017-09-21 11:19 ` [PATCH v2 1/2] isar-image-base & buildchroot: create hooks_multistrap dir with bb flag claudius.heine.ext
2017-09-21 11:19 ` claudius.heine.ext [this message]
2017-09-21 12:25 ` [PATCH v2 0/2] Use fetcher for images Henning Schild
2017-09-25 12:32 ` Alexander Smirnov

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=20170921111911.8133-3-claudius.heine.ext@siemens.com \
    --to=claudius.heine.ext@siemens.com \
    --cc=ch@denx.de \
    --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