public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH v2 0/2] Use fetcher for images
@ 2017-09-21 11:19 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
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: claudius.heine.ext @ 2017-09-21 11:19 UTC (permalink / raw)
  To: isar-users; +Cc: Claudius Heine

From: Claudius Heine <ch@denx.de>

Hi,

I splitted those patches up.

Now the first patch addresses the 'install -d' style issue and the second is the main patch that changes the tasks to use the bitbake fetchers.

Cheers,
Claudius

Claudius Heine (2):
  isar-image-base & buildchroot: create hooks_multistrap dir with bb
    flag
  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] 5+ messages in thread

* [PATCH v2 1/2] isar-image-base & buildchroot: create hooks_multistrap dir with bb flag
  2017-09-21 11:19 [PATCH v2 0/2] Use fetcher for images claudius.heine.ext
@ 2017-09-21 11:19 ` claudius.heine.ext
  2017-09-21 11:19 ` [PATCH v2 2/2] meta-isar/isar-image-base and meta/buildchroot: Use fetcher for files claudius.heine.ext
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: claudius.heine.ext @ 2017-09-21 11:19 UTC (permalink / raw)
  To: isar-users; +Cc: Claudius Heine

From: Claudius Heine <ch@denx.de>

Issue:
Bitbake provides a mechanism to create required directories with the
'dirs' flag of the tasks. This feature should be prefered instead of
depending on the shell.

Change:
Use the 'dirs' flag to create the hooks_multistrap directory instead of
using the 'install' shell command in the build task.

Impact:
No negative impact known.

Signed-off-by: Claudius Heine <ch@denx.de>
---
 meta-isar/recipes-core/images/isar-image-base.bb | 3 +--
 meta/recipes-devtools/buildchroot/buildchroot.bb | 3 +--
 2 files changed, 2 insertions(+), 4 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..ccbece0 100644
--- a/meta-isar/recipes-core/images/isar-image-base.bb
+++ b/meta-isar/recipes-core/images/isar-image-base.bb
@@ -20,10 +20,9 @@ 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
diff --git a/meta/recipes-devtools/buildchroot/buildchroot.bb b/meta/recipes-devtools/buildchroot/buildchroot.bb
index 30039f2..af9f3a8 100644
--- a/meta/recipes-devtools/buildchroot/buildchroot.bb
+++ b/meta/recipes-devtools/buildchroot/buildchroot.bb
@@ -24,10 +24,9 @@ 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}
-- 
2.14.1


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

* [PATCH v2 2/2] meta-isar/isar-image-base and meta/buildchroot: Use fetcher for files
  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
  2017-09-21 12:25 ` [PATCH v2 0/2] Use fetcher for images Henning Schild
  2017-09-25 12:32 ` Alexander Smirnov
  3 siblings, 0 replies; 5+ messages in thread
From: claudius.heine.ext @ 2017-09-21 11:19 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 | 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


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

* Re: [PATCH v2 0/2] Use fetcher for images
  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 ` [PATCH v2 2/2] meta-isar/isar-image-base and meta/buildchroot: Use fetcher for files claudius.heine.ext
@ 2017-09-21 12:25 ` Henning Schild
  2017-09-25 12:32 ` Alexander Smirnov
  3 siblings, 0 replies; 5+ messages in thread
From: Henning Schild @ 2017-09-21 12:25 UTC (permalink / raw)
  To: [ext] claudius.heine.ext@siemens.com; +Cc: isar-users, Claudius Heine

Looks good to me.

Henning

Am Thu, 21 Sep 2017 13:19:09 +0200
schrieb "[ext] claudius.heine.ext@siemens.com"
<claudius.heine.ext@siemens.com>:

> From: Claudius Heine <ch@denx.de>
> 
> Hi,
> 
> I splitted those patches up.
> 
> Now the first patch addresses the 'install -d' style issue and the
> second is the main patch that changes the tasks to use the bitbake
> fetchers.
> 
> Cheers,
> Claudius
> 
> Claudius Heine (2):
>   isar-image-base & buildchroot: create hooks_multistrap dir with bb
>     flag
>   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(-)
> 


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

* Re: [PATCH v2 0/2] Use fetcher for images
  2017-09-21 11:19 [PATCH v2 0/2] Use fetcher for images claudius.heine.ext
                   ` (2 preceding siblings ...)
  2017-09-21 12:25 ` [PATCH v2 0/2] Use fetcher for images Henning Schild
@ 2017-09-25 12:32 ` Alexander Smirnov
  3 siblings, 0 replies; 5+ messages in thread
From: Alexander Smirnov @ 2017-09-25 12:32 UTC (permalink / raw)
  To: claudius.heine.ext, isar-users; +Cc: Claudius Heine

On 09/21/2017 02:19 PM, claudius.heine.ext@siemens.com wrote:
> From: Claudius Heine <ch@denx.de>
> 
> Hi,
> 
> I splitted those patches up.
> 
> Now the first patch addresses the 'install -d' style issue and the second is the main patch that changes the tasks to use the bitbake fetchers.
> 
> Cheers,
> Claudius
> 
> Claudius Heine (2):
>    isar-image-base & buildchroot: create hooks_multistrap dir with bb
>      flag
>    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(-)
> 

Applied to next, thanks.

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

end of thread, other threads:[~2017-09-25 12:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH v2 2/2] meta-isar/isar-image-base and meta/buildchroot: Use fetcher for files claudius.heine.ext
2017-09-21 12:25 ` [PATCH v2 0/2] Use fetcher for images Henning Schild
2017-09-25 12:32 ` Alexander Smirnov

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