public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH 0/1] Use fetcher for images
@ 2017-09-20 10:46 claudius.heine.ext
  2017-09-20 10:46 ` [PATCH 1/1] meta-isar/isar-image-base and meta/buildchroot: Use fetcher for files claudius.heine.ext
  0 siblings, 1 reply; 3+ messages in thread
From: claudius.heine.ext @ 2017-09-20 10:46 UTC (permalink / raw)
  To: isar-users; +Cc: Claudius Heine

From: Claudius Heine <ch@denx.de>

Hi,

here is a patch that replaces the copying of the image files with using the bitbake fetcher.

Cheers,
Claudius

Claudius Heine (1):
  meta-isar/isar-image-base and meta/buildchroot: Use fetcher for files

 meta-isar/recipes-core/images/isar-image-base.bb | 41 +++++++++++++-----------
 meta/recipes-devtools/buildchroot/buildchroot.bb | 34 +++++++++++---------
 2 files changed, 40 insertions(+), 35 deletions(-)

-- 
2.14.1


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

* [PATCH 1/1] meta-isar/isar-image-base and meta/buildchroot: Use fetcher for files
  2017-09-20 10:46 [PATCH 0/1] Use fetcher for images claudius.heine.ext
@ 2017-09-20 10:46 ` claudius.heine.ext
  2017-09-21  9:09   ` Henning Schild
  0 siblings, 1 reply; 3+ messages in thread
From: claudius.heine.ext @ 2017-09-20 10:46 UTC (permalink / raw)
  To: isar-users; +Cc: Claudius Heine

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 | 41 +++++++++++++-----------
 meta/recipes-devtools/buildchroot/buildchroot.bb | 34 +++++++++++---------
 2 files changed, 40 insertions(+), 35 deletions(-)

diff --git a/meta-isar/recipes-core/images/isar-image-base.bb b/meta-isar/recipes-core/images/isar-image-base.bb
index 5cb8b1c..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
@@ -20,38 +26,35 @@ IMAGE_PREINSTALL += "apt \
 WORKDIR = "${TMPDIR}/work/${DISTRO}-${DISTRO_ARCH}/${PN}"
 
 do_rootfs[stamp-extra-info] = "${MACHINE}-${DISTRO}"
+do_rootfs[dirs] = "${WORKDIR}/hooks_multistrap"
 
 do_rootfs() {
-    install -d -m 755 ${WORKDIR}/hooks_multistrap
-
-    # 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 30039f2..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 \
@@ -24,30 +29,27 @@ BUILDCHROOT_PREINSTALL ?= "gcc \
 WORKDIR = "${TMPDIR}/work/${DISTRO}-${DISTRO_ARCH}/${PN}"
 
 do_build[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}"
+do_build[dirs] = "${WORKDIR}/hooks_multistrap"
 
 do_build() {
-    install -d -m 755 ${WORKDIR}/hooks_multistrap
-
-    # 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


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

* Re: [PATCH 1/1] meta-isar/isar-image-base and meta/buildchroot: Use fetcher for files
  2017-09-20 10:46 ` [PATCH 1/1] meta-isar/isar-image-base and meta/buildchroot: Use fetcher for files claudius.heine.ext
@ 2017-09-21  9:09   ` Henning Schild
  0 siblings, 0 replies; 3+ messages in thread
From: Henning Schild @ 2017-09-21  9:09 UTC (permalink / raw)
  To: [ext] claudius.heine.ext@siemens.com; +Cc: isar-users, Claudius Heine

Am Wed, 20 Sep 2017 12:46:45 +0200
schrieb "[ext] claudius.heine.ext@siemens.com"
<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.

Looks good, that will enable layering where i still have a few local
patches. But that one is better than mine.

> 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 | 41
> +++++++++++++-----------
> meta/recipes-devtools/buildchroot/buildchroot.bb | 34
> +++++++++++--------- 2 files changed, 40 insertions(+), 35
> deletions(-)
> 
> diff --git a/meta-isar/recipes-core/images/isar-image-base.bb
> b/meta-isar/recipes-core/images/isar-image-base.bb index
> 5cb8b1c..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
> @@ -20,38 +26,35 @@ IMAGE_PREINSTALL += "apt \
>  WORKDIR = "${TMPDIR}/work/${DISTRO}-${DISTRO_ARCH}/${PN}"
>  
>  do_rootfs[stamp-extra-info] = "${MACHINE}-${DISTRO}"
> +do_rootfs[dirs] = "${WORKDIR}/hooks_multistrap"

I think moving from mkdir to this could be a seperate patch. Same for
buildchroot. The rest looks good.

Henning

>  do_rootfs() {
> -    install -d -m 755 ${WORKDIR}/hooks_multistrap
> -
> -    # 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
> 30039f2..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 \
> @@ -24,30 +29,27 @@ BUILDCHROOT_PREINSTALL ?= "gcc \
>  WORKDIR = "${TMPDIR}/work/${DISTRO}-${DISTRO_ARCH}/${PN}"
>  
>  do_build[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}"
> +do_build[dirs] = "${WORKDIR}/hooks_multistrap"
>  
>  do_build() {
> -    install -d -m 755 ${WORKDIR}/hooks_multistrap
> -
> -    # 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


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

end of thread, other threads:[~2017-09-21  9:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-20 10:46 [PATCH 0/1] Use fetcher for images claudius.heine.ext
2017-09-20 10:46 ` [PATCH 1/1] meta-isar/isar-image-base and meta/buildchroot: Use fetcher for files claudius.heine.ext
2017-09-21  9:09   ` Henning Schild

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