public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH 0/2] Unify work space for packages
@ 2017-09-08  9:48 Alexander Smirnov
  2017-09-08  9:48 ` [PATCH 1/2] isar: Change build folders tree Alexander Smirnov
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Alexander Smirnov @ 2017-09-08  9:48 UTC (permalink / raw)
  To: isar-users; +Cc: Alexander Smirnov

Hi all,

this small series simplifies folders structure for multiconfig
and unifies work space for packages.

These patches intended to supply series:
  "v3 of getting the custom debian package in"
on the list.

Any comments are welcome!

Alexander Smirnov (2):
  isar: Change build folders tree
  class/dpkg: Unify workplace for packages

 meta-isar/classes/rpi-sdimg.bbclass              |  2 +-
 meta-isar/recipes-core/images/isar-image-base.bb | 19 ++++++++-----------
 meta/classes/dpkg.bbclass                        | 15 +++++++++------
 meta/classes/ext4-img.bbclass                    | 10 +++++-----
 meta/classes/image.bbclass                       | 12 +++++++-----
 meta/conf/isar-bitbake.conf                      |  3 ++-
 meta/recipes-devtools/buildchroot/buildchroot.bb |  9 ++++-----
 7 files changed, 36 insertions(+), 34 deletions(-)

-- 
2.1.4


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

* [PATCH 1/2] isar: Change build folders tree
  2017-09-08  9:48 [PATCH 0/2] Unify work space for packages Alexander Smirnov
@ 2017-09-08  9:48 ` Alexander Smirnov
  2017-09-08 11:47   ` Henning Schild
  2017-09-11  8:27   ` Claudius Heine
  2017-09-08  9:48 ` [PATCH 2/2] class/dpkg: Unify workplace for packages Alexander Smirnov
  2017-09-08 10:01 ` [PATCH 0/2] Unify work space " Alexander Smirnov
  2 siblings, 2 replies; 15+ messages in thread
From: Alexander Smirnov @ 2017-09-08  9:48 UTC (permalink / raw)
  To: isar-users; +Cc: Alexander Smirnov

Differentiate folders tree, that are generated during build on
the highest possible level. So the overal tree now looks like the
following:

 tmp/${DISTRO}-${DISTRO_ARCH}/${PF}

This approach eliminates lots of subfolders to diffirentiate
buildchroot and image for multiconfig builds. Now each configuration
has private tree.

Signed-off-by: Alexander Smirnov <asmirnov@ilbers.de>
---
 meta-isar/classes/rpi-sdimg.bbclass              |  2 +-
 meta-isar/recipes-core/images/isar-image-base.bb | 19 ++++++++-----------
 meta/classes/ext4-img.bbclass                    | 10 +++++-----
 meta/classes/image.bbclass                       | 12 +++++++-----
 meta/conf/isar-bitbake.conf                      |  3 ++-
 meta/recipes-devtools/buildchroot/buildchroot.bb |  9 ++++-----
 6 files changed, 27 insertions(+), 28 deletions(-)

diff --git a/meta-isar/classes/rpi-sdimg.bbclass b/meta-isar/classes/rpi-sdimg.bbclass
index 2614c41..91b09cd 100644
--- a/meta-isar/classes/rpi-sdimg.bbclass
+++ b/meta-isar/classes/rpi-sdimg.bbclass
@@ -47,7 +47,7 @@ do_rpi_sdimg () {
     BOOT_BLOCKS=$(LC_ALL=C parted -s ${SDIMG} unit b print | awk '/ 1 / { print substr($4, 1, length($4 -1)) / 512 /2 }')
     rm -f ${WORKDIR}/boot.img
     mkfs.vfat -n "${BOOTDD_VOLUME_ID}" -S 512 -C ${WORKDIR}/boot.img $BOOT_BLOCKS
-    mcopy -i ${WORKDIR}/boot.img -s ${S}/boot/* ::/
+    mcopy -i ${WORKDIR}/boot.img -s ${IMAGE_ROOTFS}/boot/* ::/
 
     # Burn Partitions
     dd if=${WORKDIR}/boot.img of=${SDIMG} conv=notrunc seek=1 bs=$(expr ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) && sync && sync
diff --git a/meta-isar/recipes-core/images/isar-image-base.bb b/meta-isar/recipes-core/images/isar-image-base.bb
index b679d97..178ac05 100644
--- a/meta-isar/recipes-core/images/isar-image-base.bb
+++ b/meta-isar/recipes-core/images/isar-image-base.bb
@@ -9,6 +9,7 @@ LICENSE = "gpl-2.0"
 LIC_FILES_CHKSUM = "file://${LAYERDIR_isar}/licenses/COPYING.GPLv2;md5=751419260aa954499f7abaabaa882bbe"
 
 PV = "1.0"
+PF = "${PN}"
 
 inherit image
 
@@ -17,11 +18,7 @@ DEPENDS += "${IMAGE_INSTALL}"
 IMAGE_PREINSTALL += "apt \
                      dbus"
 
-WORKDIR = "${TMPDIR}/work/${PN}/${MACHINE}/${DISTRO}"
-S = "${WORKDIR}/rootfs"
-IMAGE_ROOTFS = "${S}"
-
-do_rootfs[stamp-extra-info] = "${MACHINE}-${DISTRO}"
+do_rootfs[stamp-extra-info] = "${DISTRO}-${MACHINE}"
 
 do_rootfs() {
     install -d -m 755 ${WORKDIR}/hooks_multistrap
@@ -38,20 +35,20 @@ do_rootfs() {
     sed -i 's|##DISTRO_APT_SOURCE##|${DISTRO_APT_SOURCE}|' ${WORKDIR}/multistrap.conf
     sed -i 's|##DISTRO_SUITE##|${DISTRO_SUITE}|' ${WORKDIR}/multistrap.conf
     sed -i 's|##DISTRO_COMPONENTS##|${DISTRO_COMPONENTS}|' ${WORKDIR}/multistrap.conf
-    sed -i 's|##CONFIG_SCRIPT##|./tmp/work/${PN}/${MACHINE}/${DISTRO}/configscript.sh|' ${WORKDIR}/multistrap.conf
-    sed -i 's|##SETUP_SCRIPT##|./tmp/work/${PN}/${MACHINE}/${DISTRO}/setup.sh|' ${WORKDIR}/multistrap.conf
-    sed -i 's|##DIR_HOOKS##|./tmp/work/${PN}/${MACHINE}/${DISTRO}/hooks_multistrap|' ${WORKDIR}/multistrap.conf
+    sed -i 's|##CONFIG_SCRIPT##|./tmp/work/${DISTRO}-${DISTRO_ARCH}/${PF}/configscript.sh|' ${WORKDIR}/multistrap.conf
+    sed -i 's|##SETUP_SCRIPT##|./tmp/work/${DISTRO}-${DISTRO_ARCH}/${PF}/setup.sh|' ${WORKDIR}/multistrap.conf
+    sed -i 's|##DIR_HOOKS##|./tmp/work/${DISTRO}-${DISTRO_ARCH}/${PF}/hooks_multistrap|' ${WORKDIR}/multistrap.conf
 
     # Multistrap config use relative paths, so ensure that we are in the right folder
     cd ${TOPDIR}
 
     # Create root filesystem
-    sudo multistrap -a ${DISTRO_ARCH} -d "${S}" -f "${WORKDIR}/multistrap.conf" || true
+    sudo multistrap -a ${DISTRO_ARCH} -d "${IMAGE_ROOTFS}" -f "${WORKDIR}/multistrap.conf" || true
 
     # Configure root filesystem
-    sudo chroot ${S} /configscript.sh ${MACHINE_SERIAL} ${BAUDRATE_TTY} \
+    sudo chroot ${IMAGE_ROOTFS} /configscript.sh ${MACHINE_SERIAL} ${BAUDRATE_TTY} \
         ${ROOTFS_DEV}
-    sudo rm ${S}/configscript.sh
+    sudo rm ${IMAGE_ROOTFS}/configscript.sh
 }
 
 addtask rootfs before do_populate
diff --git a/meta/classes/ext4-img.bbclass b/meta/classes/ext4-img.bbclass
index 8588626..9af781f 100644
--- a/meta/classes/ext4-img.bbclass
+++ b/meta/classes/ext4-img.bbclass
@@ -6,7 +6,7 @@ ROOTFS_EXTRA ?= "64"
 
 EXT4_IMAGE_FILE = "${DEPLOY_DIR_IMAGE}/${PN}-${MACHINE}-${DISTRO}.ext4.img"
 
-do_ext4_image[stamp-extra-info] = "${MACHINE}-${DISTRO}"
+do_ext4_image[stamp-extra-info] = "${DISTRO}-${MACHINE}"
 
 # Generate ext4 filesystem image
 do_ext4_image() {
@@ -14,23 +14,23 @@ do_ext4_image() {
 
     rm -f ${EXT4_IMAGE_FILE}
 
-    ROOTFS_SIZE=`sudo du -sm ${S} |  awk '{print $1 + ${ROOTFS_EXTRA};}'`
+    ROOTFS_SIZE=`sudo du -sm ${IMAGE_ROOTFS} |  awk '{print $1 + ${ROOTFS_EXTRA};}'`
     dd if=/dev/zero of=${EXT4_IMAGE_FILE} bs=1M count=${ROOTFS_SIZE}
 
     sudo mkfs.ext4 -F ${EXT4_IMAGE_FILE}
 
     mkdir -p ${WORKDIR}/mnt
     sudo mount -o loop ${EXT4_IMAGE_FILE} ${WORKDIR}/mnt
-    sudo cp -r ${S}/* ${WORKDIR}/mnt
+    sudo cp -r ${IMAGE_ROOTFS}/* ${WORKDIR}/mnt
     sudo umount ${WORKDIR}/mnt
     rm -r ${WORKDIR}/mnt
 
     if [ -n "${KERNEL_IMAGE}" ]; then
-        cp ${S}/boot/${KERNEL_IMAGE} ${DEPLOY_DIR_IMAGE}
+        cp ${IMAGE_ROOTFS}/boot/${KERNEL_IMAGE} ${DEPLOY_DIR_IMAGE}
     fi
 
     if [ -n "${INITRD_IMAGE}" ]; then
-        cp ${S}/boot/${INITRD_IMAGE} ${DEPLOY_DIR_IMAGE}
+        cp ${IMAGE_ROOTFS}/boot/${INITRD_IMAGE} ${DEPLOY_DIR_IMAGE}
     fi
 }
 
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index a7f0d74..fe06352 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -9,20 +9,22 @@ IMAGE_TYPE    ?= "ext4-img"
 
 inherit ${IMAGE_TYPE}
 
-do_populate[stamp-extra-info] = "${MACHINE}-${DISTRO}"
+IMAGE_ROOTFS = "${WORKDIR}/rootfs"
+
+do_populate[stamp-extra-info] = "${DISTRO}-${MACHINE}"
 
 # Install Debian packages, that were built from sources
 do_populate() {
     if [ -n "${IMAGE_INSTALL}" ]; then
-        sudo mkdir -p ${S}/deb
+        sudo mkdir -p ${IMAGE_ROOTFS}/deb
 
         for p in ${IMAGE_INSTALL}; do
-            sudo cp ${DEPLOY_DIR_DEB}/${p}_*.deb ${S}/deb
+            sudo cp ${DEPLOY_DIR_DEB}/${p}_*.deb ${IMAGE_ROOTFS}/deb
         done
 
-        sudo chroot ${S} /usr/bin/dpkg -i -R /deb
+        sudo chroot ${IMAGE_ROOTFS} /usr/bin/dpkg -i -R /deb
 
-        sudo rm -rf ${S}/deb
+        sudo rm -rf ${IMAGE_ROOTFS}/deb
     fi
 }
 
diff --git a/meta/conf/isar-bitbake.conf b/meta/conf/isar-bitbake.conf
index f85f5cc..5a26743 100644
--- a/meta/conf/isar-bitbake.conf
+++ b/meta/conf/isar-bitbake.conf
@@ -18,9 +18,10 @@
 # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 # OTHER DEALINGS IN THE SOFTWARE.
 
+WORKDIR = "${TMPDIR}/work/${DISTRO}-${DISTRO_ARCH}/${PF}"
 DEPLOY_DIR_DEB = "${TMPDIR}/deploy/deb/${MACHINE}"
 SSTATE_DIR ?= "${TMPDIR}/sstate-cache"
-BUILDCHROOT_DIR = "${TOPDIR}/tmp/work/buildchroot/${DISTRO}-${DISTRO_ARCH}/rootfs"
+BUILDCHROOT_DIR = "${TMPDIR}/work/${DISTRO}-${DISTRO_ARCH}/buildchroot/rootfs"
 
 # Setup our default hash policy
 BB_SIGNATURE_HANDLER ?= "noop"
diff --git a/meta/recipes-devtools/buildchroot/buildchroot.bb b/meta/recipes-devtools/buildchroot/buildchroot.bb
index ccba683..155bd3f 100644
--- a/meta/recipes-devtools/buildchroot/buildchroot.bb
+++ b/meta/recipes-devtools/buildchroot/buildchroot.bb
@@ -9,6 +9,7 @@ LICENSE = "gpl-2.0"
 LIC_FILES_CHKSUM = "file://${LAYERDIR_isar}/licenses/COPYING.GPLv2;md5=751419260aa954499f7abaabaa882bbe"
 
 PV = "1.0"
+PF = "${PN}"
 
 BUILDCHROOT_PREINSTALL ?= "gcc \
                            make \
@@ -21,8 +22,6 @@ BUILDCHROOT_PREINSTALL ?= "gcc \
                            apt \
                            automake"
 
-WORKDIR = "${TMPDIR}/work/${PF}/${DISTRO}"
-
 do_build[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}"
 
 do_build() {
@@ -40,9 +39,9 @@ do_build() {
     sed -i 's|##DISTRO_APT_SOURCE##|${DISTRO_APT_SOURCE}|' ${WORKDIR}/multistrap.conf
     sed -i 's|##DISTRO_SUITE##|${DISTRO_SUITE}|' ${WORKDIR}/multistrap.conf
     sed -i 's|##DISTRO_COMPONENTS##|${DISTRO_COMPONENTS}|' ${WORKDIR}/multistrap.conf
-    sed -i 's|##CONFIG_SCRIPT##|./tmp/work/${PF}/${DISTRO}/configscript.sh|' ${WORKDIR}/multistrap.conf
-    sed -i 's|##SETUP_SCRIPT##|./tmp/work/${PF}/${DISTRO}/setup.sh|' ${WORKDIR}/multistrap.conf
-    sed -i 's|##DIR_HOOKS##|./tmp/work/${PF}/${DISTRO}/hooks_multistrap|' ${WORKDIR}/multistrap.conf
+    sed -i 's|##CONFIG_SCRIPT##|./tmp/work/${DISTRO}-${DISTRO_ARCH}/${PF}/configscript.sh|' ${WORKDIR}/multistrap.conf
+    sed -i 's|##SETUP_SCRIPT##|./tmp/work/${DISTRO}-${DISTRO_ARCH}/${PF}/setup.sh|' ${WORKDIR}/multistrap.conf
+    sed -i 's|##DIR_HOOKS##|./tmp/work/${DISTRO}-${DISTRO_ARCH}/${PF}/hooks_multistrap|' ${WORKDIR}/multistrap.conf
 
     # Multistrap config use relative paths, so ensure that we are in the right folder
     cd ${TOPDIR}
-- 
2.1.4


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

* [PATCH 2/2] class/dpkg: Unify workplace for packages
  2017-09-08  9:48 [PATCH 0/2] Unify work space for packages Alexander Smirnov
  2017-09-08  9:48 ` [PATCH 1/2] isar: Change build folders tree Alexander Smirnov
@ 2017-09-08  9:48 ` Alexander Smirnov
  2017-09-08 11:29   ` Henning Schild
  2017-09-08 10:01 ` [PATCH 0/2] Unify work space " Alexander Smirnov
  2 siblings, 1 reply; 15+ messages in thread
From: Alexander Smirnov @ 2017-09-08  9:48 UTC (permalink / raw)
  To: isar-users; +Cc: Alexander Smirnov

Get rid of splitting package's data between WORKDIR and BUILDCHROOT.
Now everything is stored into WORKDIR, and BUILDCHROOT is used for
compilation only.

Signed-off-by: Alexander Smirnov <asmirnov@ilbers.de>
---
 meta/classes/dpkg.bbclass | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/meta/classes/dpkg.bbclass b/meta/classes/dpkg.bbclass
index 360a95c..f1a29aa 100644
--- a/meta/classes/dpkg.bbclass
+++ b/meta/classes/dpkg.bbclass
@@ -3,12 +3,11 @@
 
 # Add dependency from buildchroot creation
 DEPENDS += "buildchroot"
-do_unpack[deptask] = "do_build"
+do_build[deptask] = "do_build"
 
 # Each package should have its own unique build folder, so use
 # recipe name as identifier
 PP = "/home/builder/${PN}"
-BUILDROOT = "${BUILDCHROOT_DIR}/${PP}"
 
 do_fetch[dirs] = "${DL_DIR}"
 
@@ -27,9 +26,8 @@ python do_fetch() {
 
 addtask fetch before do_unpack
 
-do_unpack[dirs] = "${BUILDROOT}"
+do_unpack[dirs] = "${WORKDIR}"
 do_unpack[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}"
-S ?= "${BUILDROOT}"
 
 # Unpack package and put it into working directory in buildchroot
 python do_unpack() {
@@ -37,7 +35,7 @@ python do_unpack() {
     if len(src_uri) == 0:
         return
 
-    rootdir = d.getVar('BUILDROOT', True)
+    rootdir = d.getVar('WORKDIR', True)
 
     try:
         fetcher = bb.fetch2.Fetch(src_uri, d)
@@ -48,17 +46,22 @@ python do_unpack() {
 
 addtask unpack after do_fetch before do_build
 
+BUILDROOT = "${BUILDCHROOT_DIR}/${PP}"
 do_build[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}"
 
 # Build package from sources using build script
 do_build() {
+    mkdir -p ${BUILDROOT}
+    sudo mount --bind ${WORKDIR} ${BUILDROOT}
     sudo chroot ${BUILDCHROOT_DIR} /build.sh ${PP}/${SRC_DIR}
+    sudo umount ${BUILDROOT}
+    rm -rf ${BUILDROOT}
 }
 
 
 # Install package to dedicated deploy directory
 do_install() {
-    install -m 644 ${BUILDROOT}/*.deb ${DEPLOY_DIR_DEB}/
+    install -m 644 ${WORKDIR}/*.deb ${DEPLOY_DIR_DEB}/
 }
 
 addtask install after do_build
-- 
2.1.4


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

* Re: [PATCH 0/2] Unify work space for packages
  2017-09-08  9:48 [PATCH 0/2] Unify work space for packages Alexander Smirnov
  2017-09-08  9:48 ` [PATCH 1/2] isar: Change build folders tree Alexander Smirnov
  2017-09-08  9:48 ` [PATCH 2/2] class/dpkg: Unify workplace for packages Alexander Smirnov
@ 2017-09-08 10:01 ` Alexander Smirnov
  2 siblings, 0 replies; 15+ messages in thread
From: Alexander Smirnov @ 2017-09-08 10:01 UTC (permalink / raw)
  To: isar-users

On 09/08/2017 12:48 PM, Alexander Smirnov wrote:
> Hi all,
> 
> this small series simplifies folders structure for multiconfig
> and unifies work space for packages.
> 
> These patches intended to supply series:
>    "v3 of getting the custom debian package in"
> on the list.
> 
> Any comments are welcome!
> 

Here is an example of multiconfig build:

$ ls -1 build/tmp/work/

   debian-jessie-amd64
   debian-jessie-armhf
   debian-jessie-i386
   debian-stretch-amd64
   debian-stretch-armhf
   debian-stretch-i386
   debian-wheezy-armhf
   raspbian-jessie-armhf


$ ls -1 build/tmp/work/raspbian-jessie-

   armhf/
   buildchroot
   hello-0.1+g7f35942-1-r0
   isar-image-base

$ ls -1 build/tmp/work/raspbian-jessie-armhf/hello-0.1+g7f35942-1-r0/

   git
   hello_0.1+g7f35942-1_armhf.deb
   hello_0.1+g7f35942-1.dsc
   hello_0.1+g7f35942-1.tar.gz
   temp

Alex

> Alexander Smirnov (2):
>    isar: Change build folders tree
>    class/dpkg: Unify workplace for packages
> 
>   meta-isar/classes/rpi-sdimg.bbclass              |  2 +-
>   meta-isar/recipes-core/images/isar-image-base.bb | 19 ++++++++-----------
>   meta/classes/dpkg.bbclass                        | 15 +++++++++------
>   meta/classes/ext4-img.bbclass                    | 10 +++++-----
>   meta/classes/image.bbclass                       | 12 +++++++-----
>   meta/conf/isar-bitbake.conf                      |  3 ++-
>   meta/recipes-devtools/buildchroot/buildchroot.bb |  9 ++++-----
>   7 files changed, 36 insertions(+), 34 deletions(-)
> 

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

* Re: [PATCH 2/2] class/dpkg: Unify workplace for packages
  2017-09-08  9:48 ` [PATCH 2/2] class/dpkg: Unify workplace for packages Alexander Smirnov
@ 2017-09-08 11:29   ` Henning Schild
  0 siblings, 0 replies; 15+ messages in thread
From: Henning Schild @ 2017-09-08 11:29 UTC (permalink / raw)
  To: Alexander Smirnov; +Cc: isar-users

Am Fri, 8 Sep 2017 12:48:34 +0300
schrieb Alexander Smirnov <asmirnov@ilbers.de>:

> Get rid of splitting package's data between WORKDIR and BUILDCHROOT.
> Now everything is stored into WORKDIR, and BUILDCHROOT is used for
> compilation only.
> 
> Signed-off-by: Alexander Smirnov <asmirnov@ilbers.de>
> ---
>  meta/classes/dpkg.bbclass | 15 +++++++++------
>  1 file changed, 9 insertions(+), 6 deletions(-)
> 
> diff --git a/meta/classes/dpkg.bbclass b/meta/classes/dpkg.bbclass
> index 360a95c..f1a29aa 100644
> --- a/meta/classes/dpkg.bbclass
> +++ b/meta/classes/dpkg.bbclass
> @@ -3,12 +3,11 @@
>  
>  # Add dependency from buildchroot creation
>  DEPENDS += "buildchroot"
> -do_unpack[deptask] = "do_build"
> +do_build[deptask] = "do_build"
>  
>  # Each package should have its own unique build folder, so use
>  # recipe name as identifier
>  PP = "/home/builder/${PN}"
> -BUILDROOT = "${BUILDCHROOT_DIR}/${PP}"
>  
>  do_fetch[dirs] = "${DL_DIR}"
>  
> @@ -27,9 +26,8 @@ python do_fetch() {
>  
>  addtask fetch before do_unpack
>  
> -do_unpack[dirs] = "${BUILDROOT}"
> +do_unpack[dirs] = "${WORKDIR}"
>  do_unpack[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}"
> -S ?= "${BUILDROOT}"
>  
>  # Unpack package and put it into working directory in buildchroot
>  python do_unpack() {
> @@ -37,7 +35,7 @@ python do_unpack() {
>      if len(src_uri) == 0:
>          return
>  
> -    rootdir = d.getVar('BUILDROOT', True)
> +    rootdir = d.getVar('WORKDIR', True)
>  
>      try:
>          fetcher = bb.fetch2.Fetch(src_uri, d)
> @@ -48,17 +46,22 @@ python do_unpack() {
>  
>  addtask unpack after do_fetch before do_build
>  
> +BUILDROOT = "${BUILDCHROOT_DIR}/${PP}"
>  do_build[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}"
>  
>  # Build package from sources using build script
>  do_build() {
> +    mkdir -p ${BUILDROOT}
> +    sudo mount --bind ${WORKDIR} ${BUILDROOT}
>      sudo chroot ${BUILDCHROOT_DIR} /build.sh ${PP}/${SRC_DIR}
> +    sudo umount ${BUILDROOT}
> +    rm -rf ${BUILDROOT}
>  }

Sweet, that seems to be going into the right direction. We do not
unpack to BUILDROOT anymore but rather make sure what is unpacked to
WORKDIR becomes visible in BUILDROOT for the build. Seems like what i
suggested in one of my last mails. 

I think that would finally allow to move fetch and unpack out of dpkg.

Henning

>  # Install package to dedicated deploy directory
>  do_install() {
> -    install -m 644 ${BUILDROOT}/*.deb ${DEPLOY_DIR_DEB}/
> +    install -m 644 ${WORKDIR}/*.deb ${DEPLOY_DIR_DEB}/
>  }
>  
>  addtask install after do_build


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

* Re: [PATCH 1/2] isar: Change build folders tree
  2017-09-08  9:48 ` [PATCH 1/2] isar: Change build folders tree Alexander Smirnov
@ 2017-09-08 11:47   ` Henning Schild
  2017-09-08 12:36     ` Alexander Smirnov
  2017-09-11  8:27   ` Claudius Heine
  1 sibling, 1 reply; 15+ messages in thread
From: Henning Schild @ 2017-09-08 11:47 UTC (permalink / raw)
  To: Alexander Smirnov; +Cc: isar-users

This one seems pretty big and is doing multiple things at a time. I
suggest to split it into smaller units.

As far as i can tell it is doing at least 3 things at a time.
- rename S to IMAGE_ROOTFS
- change multiconf stamps from "${MACHINE}-${DISTRO}" to
  "${DISTRO}-${MACHINE}"
- change folder structure "work/${PN}/${MACHINE}/${DISTRO}" to
  "work/${DISTRO}-${DISTRO_ARCH}/${PF}"

More inline.

Am Fri, 8 Sep 2017 12:48:33 +0300
schrieb Alexander Smirnov <asmirnov@ilbers.de>:

> Differentiate folders tree, that are generated during build on
> the highest possible level. So the overal tree now looks like the
> following:
> 
>  tmp/${DISTRO}-${DISTRO_ARCH}/${PF}
> 
> This approach eliminates lots of subfolders to diffirentiate
> buildchroot and image for multiconfig builds. Now each configuration
> has private tree.
> 
> Signed-off-by: Alexander Smirnov <asmirnov@ilbers.de>
> ---
>  meta-isar/classes/rpi-sdimg.bbclass              |  2 +-
>  meta-isar/recipes-core/images/isar-image-base.bb | 19
> ++++++++----------- meta/classes/ext4-img.bbclass
> | 10 +++++----- meta/classes/image.bbclass                       | 12
> +++++++----- meta/conf/isar-bitbake.conf                      |  3 ++-
>  meta/recipes-devtools/buildchroot/buildchroot.bb |  9 ++++-----
>  6 files changed, 27 insertions(+), 28 deletions(-)
> 
> diff --git a/meta-isar/classes/rpi-sdimg.bbclass
> b/meta-isar/classes/rpi-sdimg.bbclass index 2614c41..91b09cd 100644
> --- a/meta-isar/classes/rpi-sdimg.bbclass
> +++ b/meta-isar/classes/rpi-sdimg.bbclass
> @@ -47,7 +47,7 @@ do_rpi_sdimg () {
>      BOOT_BLOCKS=$(LC_ALL=C parted -s ${SDIMG} unit b print | awk '/
> 1 / { print substr($4, 1, length($4 -1)) / 512 /2 }') rm -f
> ${WORKDIR}/boot.img mkfs.vfat -n "${BOOTDD_VOLUME_ID}" -S 512 -C
> ${WORKDIR}/boot.img $BOOT_BLOCKS
> -    mcopy -i ${WORKDIR}/boot.img -s ${S}/boot/* ::/
> +    mcopy -i ${WORKDIR}/boot.img -s ${IMAGE_ROOTFS}/boot/* ::/

This could be one patch that replaces S with IMAGE_ROOTFS.

>  
>      # Burn Partitions
>      dd if=${WORKDIR}/boot.img of=${SDIMG} conv=notrunc seek=1
> bs=$(expr ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) && sync && sync diff
> --git a/meta-isar/recipes-core/images/isar-image-base.bb
> b/meta-isar/recipes-core/images/isar-image-base.bb index
> b679d97..178ac05 100644 ---
> a/meta-isar/recipes-core/images/isar-image-base.bb +++
> b/meta-isar/recipes-core/images/isar-image-base.bb @@ -9,6 +9,7 @@
> LICENSE = "gpl-2.0" LIC_FILES_CHKSUM =
> "file://${LAYERDIR_isar}/licenses/COPYING.GPLv2;md5=751419260aa954499f7abaabaa882bbe"
> PV = "1.0" +PF = "${PN}"
>  
>  inherit image
>  
> @@ -17,11 +18,7 @@ DEPENDS += "${IMAGE_INSTALL}"
>  IMAGE_PREINSTALL += "apt \
>                       dbus"
>  
> -WORKDIR = "${TMPDIR}/work/${PN}/${MACHINE}/${DISTRO}"

> -S = "${WORKDIR}/rootfs"
> -IMAGE_ROOTFS = "${S}"

Part of the S -> IMAGE_ROOTFS

> -
> -do_rootfs[stamp-extra-info] = "${MACHINE}-${DISTRO}"
> +do_rootfs[stamp-extra-info] = "${DISTRO}-${MACHINE}"

This is also a change that should be in a seperate smaller patch.
  
>  do_rootfs() {
>      install -d -m 755 ${WORKDIR}/hooks_multistrap
> @@ -38,20 +35,20 @@ do_rootfs() {
>      sed -i 's|##DISTRO_APT_SOURCE##|${DISTRO_APT_SOURCE}|'
> ${WORKDIR}/multistrap.conf sed -i
> 's|##DISTRO_SUITE##|${DISTRO_SUITE}|' ${WORKDIR}/multistrap.conf sed
> -i 's|##DISTRO_COMPONENTS##|${DISTRO_COMPONENTS}|'
> ${WORKDIR}/multistrap.conf
> -    sed -i
> 's|##CONFIG_SCRIPT##|./tmp/work/${PN}/${MACHINE}/${DISTRO}/configscript.sh|'
> ${WORKDIR}/multistrap.conf
> -    sed -i
> 's|##SETUP_SCRIPT##|./tmp/work/${PN}/${MACHINE}/${DISTRO}/setup.sh|'
> ${WORKDIR}/multistrap.conf
> -    sed -i
> 's|##DIR_HOOKS##|./tmp/work/${PN}/${MACHINE}/${DISTRO}/hooks_multistrap|'
> ${WORKDIR}/multistrap.conf
> +    sed -i
> 's|##CONFIG_SCRIPT##|./tmp/work/${DISTRO}-${DISTRO_ARCH}/${PF}/configscript.sh|'
> ${WORKDIR}/multistrap.conf
> +    sed -i
> 's|##SETUP_SCRIPT##|./tmp/work/${DISTRO}-${DISTRO_ARCH}/${PF}/setup.sh|'
> ${WORKDIR}/multistrap.conf
> +    sed -i
> 's|##DIR_HOOKS##|./tmp/work/${DISTRO}-${DISTRO_ARCH}/${PF}/hooks_multistrap|'
> ${WORKDIR}/multistrap.conf # Multistrap config use relative paths, so
> ensure that we are in the right folder cd ${TOPDIR}
>  
>      # Create root filesystem
> -    sudo multistrap -a ${DISTRO_ARCH} -d "${S}" -f
> "${WORKDIR}/multistrap.conf" || true
> +    sudo multistrap -a ${DISTRO_ARCH} -d "${IMAGE_ROOTFS}" -f
> "${WORKDIR}/multistrap.conf" || true 
>      # Configure root filesystem
> -    sudo chroot ${S} /configscript.sh ${MACHINE_SERIAL}
> ${BAUDRATE_TTY} \
> +    sudo chroot ${IMAGE_ROOTFS} /configscript.sh ${MACHINE_SERIAL}
> ${BAUDRATE_TTY} \ ${ROOTFS_DEV}
> -    sudo rm ${S}/configscript.sh
> +    sudo rm ${IMAGE_ROOTFS}/configscript.sh
>  }
>  
>  addtask rootfs before do_populate
> diff --git a/meta/classes/ext4-img.bbclass
> b/meta/classes/ext4-img.bbclass index 8588626..9af781f 100644
> --- a/meta/classes/ext4-img.bbclass
> +++ b/meta/classes/ext4-img.bbclass
> @@ -6,7 +6,7 @@ ROOTFS_EXTRA ?= "64"
>  
>  EXT4_IMAGE_FILE =
> "${DEPLOY_DIR_IMAGE}/${PN}-${MACHINE}-${DISTRO}.ext4.img" 
> -do_ext4_image[stamp-extra-info] = "${MACHINE}-${DISTRO}"
> +do_ext4_image[stamp-extra-info] = "${DISTRO}-${MACHINE}"
>  
>  # Generate ext4 filesystem image
>  do_ext4_image() {
> @@ -14,23 +14,23 @@ do_ext4_image() {
>  
>      rm -f ${EXT4_IMAGE_FILE}
>  
> -    ROOTFS_SIZE=`sudo du -sm ${S} |  awk '{print $1 +
> ${ROOTFS_EXTRA};}'`
> +    ROOTFS_SIZE=`sudo du -sm ${IMAGE_ROOTFS} |  awk '{print $1 +
> ${ROOTFS_EXTRA};}'` dd if=/dev/zero of=${EXT4_IMAGE_FILE} bs=1M
> count=${ROOTFS_SIZE}
>
>      sudo mkfs.ext4 -F ${EXT4_IMAGE_FILE}
>  
>      mkdir -p ${WORKDIR}/mnt
>      sudo mount -o loop ${EXT4_IMAGE_FILE} ${WORKDIR}/mnt
> -    sudo cp -r ${S}/* ${WORKDIR}/mnt
> +    sudo cp -r ${IMAGE_ROOTFS}/* ${WORKDIR}/mnt
>      sudo umount ${WORKDIR}/mnt
>      rm -r ${WORKDIR}/mnt
>  
>      if [ -n "${KERNEL_IMAGE}" ]; then
> -        cp ${S}/boot/${KERNEL_IMAGE} ${DEPLOY_DIR_IMAGE}
> +        cp ${IMAGE_ROOTFS}/boot/${KERNEL_IMAGE} ${DEPLOY_DIR_IMAGE}
>      fi
>  
>      if [ -n "${INITRD_IMAGE}" ]; then
> -        cp ${S}/boot/${INITRD_IMAGE} ${DEPLOY_DIR_IMAGE}
> +        cp ${IMAGE_ROOTFS}/boot/${INITRD_IMAGE} ${DEPLOY_DIR_IMAGE}
>      fi
>  }
>  
> diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
> index a7f0d74..fe06352 100644
> --- a/meta/classes/image.bbclass
> +++ b/meta/classes/image.bbclass
> @@ -9,20 +9,22 @@ IMAGE_TYPE    ?= "ext4-img"
>  
>  inherit ${IMAGE_TYPE}
>  
> -do_populate[stamp-extra-info] = "${MACHINE}-${DISTRO}"
> +IMAGE_ROOTFS = "${WORKDIR}/rootfs"
> +
> +do_populate[stamp-extra-info] = "${DISTRO}-${MACHINE}"
>  
>  # Install Debian packages, that were built from sources
>  do_populate() {
>      if [ -n "${IMAGE_INSTALL}" ]; then
> -        sudo mkdir -p ${S}/deb
> +        sudo mkdir -p ${IMAGE_ROOTFS}/deb
>  
>          for p in ${IMAGE_INSTALL}; do
> -            sudo cp ${DEPLOY_DIR_DEB}/${p}_*.deb ${S}/deb
> +            sudo cp ${DEPLOY_DIR_DEB}/${p}_*.deb ${IMAGE_ROOTFS}/deb
>          done
>  
> -        sudo chroot ${S} /usr/bin/dpkg -i -R /deb
> +        sudo chroot ${IMAGE_ROOTFS} /usr/bin/dpkg -i -R /deb
>  
> -        sudo rm -rf ${S}/deb
> +        sudo rm -rf ${IMAGE_ROOTFS}/deb
>      fi
>  }
>  
> diff --git a/meta/conf/isar-bitbake.conf b/meta/conf/isar-bitbake.conf
> index f85f5cc..5a26743 100644
> --- a/meta/conf/isar-bitbake.conf
> +++ b/meta/conf/isar-bitbake.conf
> @@ -18,9 +18,10 @@
>  # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
> OR # OTHER DEALINGS IN THE SOFTWARE.
>  
> +WORKDIR = "${TMPDIR}/work/${DISTRO}-${DISTRO_ARCH}/${PF}"
>  DEPLOY_DIR_DEB = "${TMPDIR}/deploy/deb/${MACHINE}"
>  SSTATE_DIR ?= "${TMPDIR}/sstate-cache"
> -BUILDCHROOT_DIR =
> "${TOPDIR}/tmp/work/buildchroot/${DISTRO}-${DISTRO_ARCH}/rootfs"
> +BUILDCHROOT_DIR =
> "${TMPDIR}/work/${DISTRO}-${DISTRO_ARCH}/buildchroot/rootfs" # Setup
> our default hash policy BB_SIGNATURE_HANDLER ?= "noop"
> diff --git a/meta/recipes-devtools/buildchroot/buildchroot.bb
> b/meta/recipes-devtools/buildchroot/buildchroot.bb index
> ccba683..155bd3f 100644 ---
> a/meta/recipes-devtools/buildchroot/buildchroot.bb +++
> b/meta/recipes-devtools/buildchroot/buildchroot.bb @@ -9,6 +9,7 @@
> LICENSE = "gpl-2.0" LIC_FILES_CHKSUM =
> "file://${LAYERDIR_isar}/licenses/COPYING.GPLv2;md5=751419260aa954499f7abaabaa882bbe" 
>  PV = "1.0"
> +PF = "${PN}"

I think this is to remove the package version from WORKDIR, i suggest
to do WORKDIR= instead of overwriting such an essential variable.
Writing to PF will i.e. also affect FILESPATH and STAMP.
This line deserves a comment!

>  
>  BUILDCHROOT_PREINSTALL ?= "gcc \
>                             make \
> @@ -21,8 +22,6 @@ BUILDCHROOT_PREINSTALL ?= "gcc \
>                             apt \
>                             automake"
>  
> -WORKDIR = "${TMPDIR}/work/${PF}/${DISTRO}"
> -
>  do_build[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}"
>  
>  do_build() {
> @@ -40,9 +39,9 @@ do_build() {
>      sed -i 's|##DISTRO_APT_SOURCE##|${DISTRO_APT_SOURCE}|'
> ${WORKDIR}/multistrap.conf sed -i
> 's|##DISTRO_SUITE##|${DISTRO_SUITE}|' ${WORKDIR}/multistrap.conf sed
> -i 's|##DISTRO_COMPONENTS##|${DISTRO_COMPONENTS}|'
> ${WORKDIR}/multistrap.conf
> -    sed -i
> 's|##CONFIG_SCRIPT##|./tmp/work/${PF}/${DISTRO}/configscript.sh|'
> ${WORKDIR}/multistrap.conf
> -    sed -i 's|##SETUP_SCRIPT##|./tmp/work/${PF}/${DISTRO}/setup.sh|'
> ${WORKDIR}/multistrap.conf
> -    sed -i
> 's|##DIR_HOOKS##|./tmp/work/${PF}/${DISTRO}/hooks_multistrap|'
> ${WORKDIR}/multistrap.conf
> +    sed -i
> 's|##CONFIG_SCRIPT##|./tmp/work/${DISTRO}-${DISTRO_ARCH}/${PF}/configscript.sh|'
> ${WORKDIR}/multistrap.conf
> +    sed -i
> 's|##SETUP_SCRIPT##|./tmp/work/${DISTRO}-${DISTRO_ARCH}/${PF}/setup.sh|'
> ${WORKDIR}/multistrap.conf
> +    sed -i
> 's|##DIR_HOOKS##|./tmp/work/${DISTRO}-${DISTRO_ARCH}/${PF}/hooks_multistrap|'
> ${WORKDIR}/multistrap.conf 

The pattern tmp/work/${DISTRO}-${DISTRO_ARCH}/${PF}/ shows up all the
time, can that be derived from $WORKDIR instead of writing it down
again and again?

Henning

> # Multistrap config use relative paths, so
> ensure that we are in the right folder cd ${TOPDIR}


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

* Re: [PATCH 1/2] isar: Change build folders tree
  2017-09-08 11:47   ` Henning Schild
@ 2017-09-08 12:36     ` Alexander Smirnov
  2017-09-08 12:59       ` Henning Schild
                         ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Alexander Smirnov @ 2017-09-08 12:36 UTC (permalink / raw)
  To: Henning Schild; +Cc: isar-users

> This one seems pretty big and is doing multiple things at a time. I
> suggest to split it into smaller units.
> 
> As far as i can tell it is doing at least 3 things at a time.
> - rename S to IMAGE_ROOTFS
> - change multiconf stamps from "${MACHINE}-${DISTRO}" to
>    "${DISTRO}-${MACHINE}"
> - change folder structure "work/${PN}/${MACHINE}/${DISTRO}" to
>    "work/${DISTRO}-${DISTRO_ARCH}/${PF}"
> 

No problem, if general approach is Ok, I'm going to split it into pieces.

> More inline.
> 
> Am Fri, 8 Sep 2017 12:48:33 +0300
> schrieb Alexander Smirnov <asmirnov@ilbers.de>:
> 
>> Differentiate folders tree, that are generated during build on
>> the highest possible level. So the overal tree now looks like the
>> following:
>>
>>   tmp/${DISTRO}-${DISTRO_ARCH}/${PF}
>>
>> This approach eliminates lots of subfolders to diffirentiate
>> buildchroot and image for multiconfig builds. Now each configuration
>> has private tree.
>>
>> Signed-off-by: Alexander Smirnov <asmirnov@ilbers.de>
>> ---
>>   meta-isar/classes/rpi-sdimg.bbclass              |  2 +-
>>   meta-isar/recipes-core/images/isar-image-base.bb | 19
>> ++++++++----------- meta/classes/ext4-img.bbclass
>> | 10 +++++----- meta/classes/image.bbclass                       | 12
>> +++++++----- meta/conf/isar-bitbake.conf                      |  3 ++-
>>   meta/recipes-devtools/buildchroot/buildchroot.bb |  9 ++++-----
>>   6 files changed, 27 insertions(+), 28 deletions(-)
>>
>> diff --git a/meta-isar/classes/rpi-sdimg.bbclass
>> b/meta-isar/classes/rpi-sdimg.bbclass index 2614c41..91b09cd 100644
>> --- a/meta-isar/classes/rpi-sdimg.bbclass
>> +++ b/meta-isar/classes/rpi-sdimg.bbclass
>> @@ -47,7 +47,7 @@ do_rpi_sdimg () {
>>       BOOT_BLOCKS=$(LC_ALL=C parted -s ${SDIMG} unit b print | awk '/
>> 1 / { print substr($4, 1, length($4 -1)) / 512 /2 }') rm -f
>> ${WORKDIR}/boot.img mkfs.vfat -n "${BOOTDD_VOLUME_ID}" -S 512 -C
>> ${WORKDIR}/boot.img $BOOT_BLOCKS
>> -    mcopy -i ${WORKDIR}/boot.img -s ${S}/boot/* ::/
>> +    mcopy -i ${WORKDIR}/boot.img -s ${IMAGE_ROOTFS}/boot/* ::/
> 
> This could be one patch that replaces S with IMAGE_ROOTFS.
> 

Ok.

>>   
>>       # Burn Partitions
>>       dd if=${WORKDIR}/boot.img of=${SDIMG} conv=notrunc seek=1
>> bs=$(expr ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) && sync && sync diff
>> --git a/meta-isar/recipes-core/images/isar-image-base.bb
>> b/meta-isar/recipes-core/images/isar-image-base.bb index
>> b679d97..178ac05 100644 ---
>> a/meta-isar/recipes-core/images/isar-image-base.bb +++
>> b/meta-isar/recipes-core/images/isar-image-base.bb @@ -9,6 +9,7 @@
>> LICENSE = "gpl-2.0" LIC_FILES_CHKSUM =
>> "file://${LAYERDIR_isar}/licenses/COPYING.GPLv2;md5=751419260aa954499f7abaabaa882bbe"
>> PV = "1.0" +PF = "${PN}"
>>   
>>   inherit image
>>   
>> @@ -17,11 +18,7 @@ DEPENDS += "${IMAGE_INSTALL}"
>>   IMAGE_PREINSTALL += "apt \
>>                        dbus"
>>   
>> -WORKDIR = "${TMPDIR}/work/${PN}/${MACHINE}/${DISTRO}"
> 
>> -S = "${WORKDIR}/rootfs"
>> -IMAGE_ROOTFS = "${S}"
> 
> Part of the S -> IMAGE_ROOTFS
> 

Ok.

>> -
>> -do_rootfs[stamp-extra-info] = "${MACHINE}-${DISTRO}"
>> +do_rootfs[stamp-extra-info] = "${DISTRO}-${MACHINE}"
> 
> This is also a change that should be in a seperate smaller patch.

Ok.

>    
>>   do_rootfs() {
>>       install -d -m 755 ${WORKDIR}/hooks_multistrap
>> @@ -38,20 +35,20 @@ do_rootfs() {
>>       sed -i 's|##DISTRO_APT_SOURCE##|${DISTRO_APT_SOURCE}|'
>> ${WORKDIR}/multistrap.conf sed -i
>> 's|##DISTRO_SUITE##|${DISTRO_SUITE}|' ${WORKDIR}/multistrap.conf sed
>> -i 's|##DISTRO_COMPONENTS##|${DISTRO_COMPONENTS}|'
>> ${WORKDIR}/multistrap.conf
>> -    sed -i
>> 's|##CONFIG_SCRIPT##|./tmp/work/${PN}/${MACHINE}/${DISTRO}/configscript.sh|'
>> ${WORKDIR}/multistrap.conf
>> -    sed -i
>> 's|##SETUP_SCRIPT##|./tmp/work/${PN}/${MACHINE}/${DISTRO}/setup.sh|'
>> ${WORKDIR}/multistrap.conf
>> -    sed -i
>> 's|##DIR_HOOKS##|./tmp/work/${PN}/${MACHINE}/${DISTRO}/hooks_multistrap|'
>> ${WORKDIR}/multistrap.conf
>> +    sed -i
>> 's|##CONFIG_SCRIPT##|./tmp/work/${DISTRO}-${DISTRO_ARCH}/${PF}/configscript.sh|'
>> ${WORKDIR}/multistrap.conf
>> +    sed -i
>> 's|##SETUP_SCRIPT##|./tmp/work/${DISTRO}-${DISTRO_ARCH}/${PF}/setup.sh|'
>> ${WORKDIR}/multistrap.conf
>> +    sed -i
>> 's|##DIR_HOOKS##|./tmp/work/${DISTRO}-${DISTRO_ARCH}/${PF}/hooks_multistrap|'
>> ${WORKDIR}/multistrap.conf # Multistrap config use relative paths, so
>> ensure that we are in the right folder cd ${TOPDIR}
>>   
>>       # Create root filesystem
>> -    sudo multistrap -a ${DISTRO_ARCH} -d "${S}" -f
>> "${WORKDIR}/multistrap.conf" || true
>> +    sudo multistrap -a ${DISTRO_ARCH} -d "${IMAGE_ROOTFS}" -f
>> "${WORKDIR}/multistrap.conf" || true
>>       # Configure root filesystem
>> -    sudo chroot ${S} /configscript.sh ${MACHINE_SERIAL}
>> ${BAUDRATE_TTY} \
>> +    sudo chroot ${IMAGE_ROOTFS} /configscript.sh ${MACHINE_SERIAL}
>> ${BAUDRATE_TTY} \ ${ROOTFS_DEV}
>> -    sudo rm ${S}/configscript.sh
>> +    sudo rm ${IMAGE_ROOTFS}/configscript.sh
>>   }
>>   
>>   addtask rootfs before do_populate
>> diff --git a/meta/classes/ext4-img.bbclass
>> b/meta/classes/ext4-img.bbclass index 8588626..9af781f 100644
>> --- a/meta/classes/ext4-img.bbclass
>> +++ b/meta/classes/ext4-img.bbclass
>> @@ -6,7 +6,7 @@ ROOTFS_EXTRA ?= "64"
>>   
>>   EXT4_IMAGE_FILE =
>> "${DEPLOY_DIR_IMAGE}/${PN}-${MACHINE}-${DISTRO}.ext4.img"
>> -do_ext4_image[stamp-extra-info] = "${MACHINE}-${DISTRO}"
>> +do_ext4_image[stamp-extra-info] = "${DISTRO}-${MACHINE}"
>>   
>>   # Generate ext4 filesystem image
>>   do_ext4_image() {
>> @@ -14,23 +14,23 @@ do_ext4_image() {
>>   
>>       rm -f ${EXT4_IMAGE_FILE}
>>   
>> -    ROOTFS_SIZE=`sudo du -sm ${S} |  awk '{print $1 +
>> ${ROOTFS_EXTRA};}'`
>> +    ROOTFS_SIZE=`sudo du -sm ${IMAGE_ROOTFS} |  awk '{print $1 +
>> ${ROOTFS_EXTRA};}'` dd if=/dev/zero of=${EXT4_IMAGE_FILE} bs=1M
>> count=${ROOTFS_SIZE}
>>
>>       sudo mkfs.ext4 -F ${EXT4_IMAGE_FILE}
>>   
>>       mkdir -p ${WORKDIR}/mnt
>>       sudo mount -o loop ${EXT4_IMAGE_FILE} ${WORKDIR}/mnt
>> -    sudo cp -r ${S}/* ${WORKDIR}/mnt
>> +    sudo cp -r ${IMAGE_ROOTFS}/* ${WORKDIR}/mnt
>>       sudo umount ${WORKDIR}/mnt
>>       rm -r ${WORKDIR}/mnt
>>   
>>       if [ -n "${KERNEL_IMAGE}" ]; then
>> -        cp ${S}/boot/${KERNEL_IMAGE} ${DEPLOY_DIR_IMAGE}
>> +        cp ${IMAGE_ROOTFS}/boot/${KERNEL_IMAGE} ${DEPLOY_DIR_IMAGE}
>>       fi
>>   
>>       if [ -n "${INITRD_IMAGE}" ]; then
>> -        cp ${S}/boot/${INITRD_IMAGE} ${DEPLOY_DIR_IMAGE}
>> +        cp ${IMAGE_ROOTFS}/boot/${INITRD_IMAGE} ${DEPLOY_DIR_IMAGE}
>>       fi
>>   }
>>   
>> diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
>> index a7f0d74..fe06352 100644
>> --- a/meta/classes/image.bbclass
>> +++ b/meta/classes/image.bbclass
>> @@ -9,20 +9,22 @@ IMAGE_TYPE    ?= "ext4-img"
>>   
>>   inherit ${IMAGE_TYPE}
>>   
>> -do_populate[stamp-extra-info] = "${MACHINE}-${DISTRO}"
>> +IMAGE_ROOTFS = "${WORKDIR}/rootfs"
>> +
>> +do_populate[stamp-extra-info] = "${DISTRO}-${MACHINE}"
>>   
>>   # Install Debian packages, that were built from sources
>>   do_populate() {
>>       if [ -n "${IMAGE_INSTALL}" ]; then
>> -        sudo mkdir -p ${S}/deb
>> +        sudo mkdir -p ${IMAGE_ROOTFS}/deb
>>   
>>           for p in ${IMAGE_INSTALL}; do
>> -            sudo cp ${DEPLOY_DIR_DEB}/${p}_*.deb ${S}/deb
>> +            sudo cp ${DEPLOY_DIR_DEB}/${p}_*.deb ${IMAGE_ROOTFS}/deb
>>           done
>>   
>> -        sudo chroot ${S} /usr/bin/dpkg -i -R /deb
>> +        sudo chroot ${IMAGE_ROOTFS} /usr/bin/dpkg -i -R /deb
>>   
>> -        sudo rm -rf ${S}/deb
>> +        sudo rm -rf ${IMAGE_ROOTFS}/deb
>>       fi
>>   }
>>   
>> diff --git a/meta/conf/isar-bitbake.conf b/meta/conf/isar-bitbake.conf
>> index f85f5cc..5a26743 100644
>> --- a/meta/conf/isar-bitbake.conf
>> +++ b/meta/conf/isar-bitbake.conf
>> @@ -18,9 +18,10 @@
>>   # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
>> OR # OTHER DEALINGS IN THE SOFTWARE.
>>   
>> +WORKDIR = "${TMPDIR}/work/${DISTRO}-${DISTRO_ARCH}/${PF}"
>>   DEPLOY_DIR_DEB = "${TMPDIR}/deploy/deb/${MACHINE}"
>>   SSTATE_DIR ?= "${TMPDIR}/sstate-cache"
>> -BUILDCHROOT_DIR =
>> "${TOPDIR}/tmp/work/buildchroot/${DISTRO}-${DISTRO_ARCH}/rootfs"
>> +BUILDCHROOT_DIR =
>> "${TMPDIR}/work/${DISTRO}-${DISTRO_ARCH}/buildchroot/rootfs" # Setup
>> our default hash policy BB_SIGNATURE_HANDLER ?= "noop"
>> diff --git a/meta/recipes-devtools/buildchroot/buildchroot.bb
>> b/meta/recipes-devtools/buildchroot/buildchroot.bb index
>> ccba683..155bd3f 100644 ---
>> a/meta/recipes-devtools/buildchroot/buildchroot.bb +++
>> b/meta/recipes-devtools/buildchroot/buildchroot.bb @@ -9,6 +9,7 @@
>> LICENSE = "gpl-2.0" LIC_FILES_CHKSUM =
>> "file://${LAYERDIR_isar}/licenses/COPYING.GPLv2;md5=751419260aa954499f7abaabaa882bbe"
>>   PV = "1.0"
>> +PF = "${PN}"
> 
> I think this is to remove the package version from WORKDIR, i suggest
> to do WORKDIR= instead of overwriting such an essential variable.
> Writing to PF will i.e. also affect FILESPATH and STAMP.
> This line deserves a comment!

I'm still thinking about this...

My idea is that buildchroot and image recipes don't need version at all, 
because there is no source code provider, that could track the code 
revision. The line:

  PV = "1.0"

is confusing and makes really no sense, I can't imagine by which event 
it should be updated. Any changes in this recipe should be reflected in 
whole Isar version update. So the proposal is to drop it, but by 
dropping it we will get broken ${PF} variable, it will look like: 
"buildchroot-".

So, the desired goal - to have buildchroot and image WORKDIRs without 
version suffixes:

1. If drop PV, the PF should be updated
2. If do not drop PV, WORKDIR should be updated

> 
>>   
>>   BUILDCHROOT_PREINSTALL ?= "gcc \
>>                              make \
>> @@ -21,8 +22,6 @@ BUILDCHROOT_PREINSTALL ?= "gcc \
>>                              apt \
>>                              automake"
>>   
>> -WORKDIR = "${TMPDIR}/work/${PF}/${DISTRO}"
>> -
>>   do_build[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}"
>>   
>>   do_build() {
>> @@ -40,9 +39,9 @@ do_build() {
>>       sed -i 's|##DISTRO_APT_SOURCE##|${DISTRO_APT_SOURCE}|'
>> ${WORKDIR}/multistrap.conf sed -i
>> 's|##DISTRO_SUITE##|${DISTRO_SUITE}|' ${WORKDIR}/multistrap.conf sed
>> -i 's|##DISTRO_COMPONENTS##|${DISTRO_COMPONENTS}|'
>> ${WORKDIR}/multistrap.conf
>> -    sed -i
>> 's|##CONFIG_SCRIPT##|./tmp/work/${PF}/${DISTRO}/configscript.sh|'
>> ${WORKDIR}/multistrap.conf
>> -    sed -i 's|##SETUP_SCRIPT##|./tmp/work/${PF}/${DISTRO}/setup.sh|'
>> ${WORKDIR}/multistrap.conf
>> -    sed -i
>> 's|##DIR_HOOKS##|./tmp/work/${PF}/${DISTRO}/hooks_multistrap|'
>> ${WORKDIR}/multistrap.conf
>> +    sed -i
>> 's|##CONFIG_SCRIPT##|./tmp/work/${DISTRO}-${DISTRO_ARCH}/${PF}/configscript.sh|'
>> ${WORKDIR}/multistrap.conf
>> +    sed -i
>> 's|##SETUP_SCRIPT##|./tmp/work/${DISTRO}-${DISTRO_ARCH}/${PF}/setup.sh|'
>> ${WORKDIR}/multistrap.conf
>> +    sed -i
>> 's|##DIR_HOOKS##|./tmp/work/${DISTRO}-${DISTRO_ARCH}/${PF}/hooks_multistrap|'
>> ${WORKDIR}/multistrap.conf
> 
> The pattern tmp/work/${DISTRO}-${DISTRO_ARCH}/${PF}/ shows up all the
> time, can that be derived from $WORKDIR instead of writing it down
> again and again?

That's mad, but mulstistrap understands relative paths only. Any attempt 
to replace it by absolute path lead to errors. That's why it was done in 
this way, because WORKDIR is absolute path. :-(

Alex

> 
>> # Multistrap config use relative paths, so
>> ensure that we are in the right folder cd ${TOPDIR}
> 

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

* Re: [PATCH 1/2] isar: Change build folders tree
  2017-09-08 12:36     ` Alexander Smirnov
@ 2017-09-08 12:59       ` Henning Schild
  2017-09-08 13:07       ` Henning Schild
  2017-09-09  9:39       ` Claudius Heine
  2 siblings, 0 replies; 15+ messages in thread
From: Henning Schild @ 2017-09-08 12:59 UTC (permalink / raw)
  To: Alexander Smirnov; +Cc: isar-users

Am Fri, 8 Sep 2017 15:36:09 +0300
schrieb Alexander Smirnov <asmirnov@ilbers.de>:

> > This one seems pretty big and is doing multiple things at a time. I
> > suggest to split it into smaller units.
> > 
> > As far as i can tell it is doing at least 3 things at a time.
> > - rename S to IMAGE_ROOTFS
> > - change multiconf stamps from "${MACHINE}-${DISTRO}" to
> >    "${DISTRO}-${MACHINE}"
> > - change folder structure "work/${PN}/${MACHINE}/${DISTRO}" to
> >    "work/${DISTRO}-${DISTRO_ARCH}/${PF}"
> >   
> 
> No problem, if general approach is Ok, I'm going to split it into
> pieces.
> 
> > More inline.
> > 
> > Am Fri, 8 Sep 2017 12:48:33 +0300
> > schrieb Alexander Smirnov <asmirnov@ilbers.de>:
> >   
> >> Differentiate folders tree, that are generated during build on
> >> the highest possible level. So the overal tree now looks like the
> >> following:
> >>
> >>   tmp/${DISTRO}-${DISTRO_ARCH}/${PF}
> >>
> >> This approach eliminates lots of subfolders to diffirentiate
> >> buildchroot and image for multiconfig builds. Now each
> >> configuration has private tree.
> >>
> >> Signed-off-by: Alexander Smirnov <asmirnov@ilbers.de>
> >> ---
> >>   meta-isar/classes/rpi-sdimg.bbclass              |  2 +-
> >>   meta-isar/recipes-core/images/isar-image-base.bb | 19
> >> ++++++++----------- meta/classes/ext4-img.bbclass
> >> | 10 +++++----- meta/classes/image.bbclass                       |
> >> 12 +++++++----- meta/conf/isar-bitbake.conf
> >> |  3 ++- meta/recipes-devtools/buildchroot/buildchroot.bb |  9
> >> ++++----- 6 files changed, 27 insertions(+), 28 deletions(-)
> >>
> >> diff --git a/meta-isar/classes/rpi-sdimg.bbclass
> >> b/meta-isar/classes/rpi-sdimg.bbclass index 2614c41..91b09cd 100644
> >> --- a/meta-isar/classes/rpi-sdimg.bbclass
> >> +++ b/meta-isar/classes/rpi-sdimg.bbclass
> >> @@ -47,7 +47,7 @@ do_rpi_sdimg () {
> >>       BOOT_BLOCKS=$(LC_ALL=C parted -s ${SDIMG} unit b print | awk
> >> '/ 1 / { print substr($4, 1, length($4 -1)) / 512 /2 }') rm -f
> >> ${WORKDIR}/boot.img mkfs.vfat -n "${BOOTDD_VOLUME_ID}" -S 512 -C
> >> ${WORKDIR}/boot.img $BOOT_BLOCKS
> >> -    mcopy -i ${WORKDIR}/boot.img -s ${S}/boot/* ::/
> >> +    mcopy -i ${WORKDIR}/boot.img -s ${IMAGE_ROOTFS}/boot/* ::/  
> > 
> > This could be one patch that replaces S with IMAGE_ROOTFS.
> >   
> 
> Ok.
> 
> >>   
> >>       # Burn Partitions
> >>       dd if=${WORKDIR}/boot.img of=${SDIMG} conv=notrunc seek=1
> >> bs=$(expr ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) && sync && sync diff
> >> --git a/meta-isar/recipes-core/images/isar-image-base.bb
> >> b/meta-isar/recipes-core/images/isar-image-base.bb index
> >> b679d97..178ac05 100644 ---
> >> a/meta-isar/recipes-core/images/isar-image-base.bb +++
> >> b/meta-isar/recipes-core/images/isar-image-base.bb @@ -9,6 +9,7 @@
> >> LICENSE = "gpl-2.0" LIC_FILES_CHKSUM =
> >> "file://${LAYERDIR_isar}/licenses/COPYING.GPLv2;md5=751419260aa954499f7abaabaa882bbe"
> >> PV = "1.0" +PF = "${PN}"
> >>   
> >>   inherit image
> >>   
> >> @@ -17,11 +18,7 @@ DEPENDS += "${IMAGE_INSTALL}"
> >>   IMAGE_PREINSTALL += "apt \
> >>                        dbus"
> >>   
> >> -WORKDIR = "${TMPDIR}/work/${PN}/${MACHINE}/${DISTRO}"  
> >   
> >> -S = "${WORKDIR}/rootfs"
> >> -IMAGE_ROOTFS = "${S}"  
> > 
> > Part of the S -> IMAGE_ROOTFS
> >   
> 
> Ok.
> 
> >> -
> >> -do_rootfs[stamp-extra-info] = "${MACHINE}-${DISTRO}"
> >> +do_rootfs[stamp-extra-info] = "${DISTRO}-${MACHINE}"  
> > 
> > This is also a change that should be in a seperate smaller patch.  
> 
> Ok.
> 
> >      
> >>   do_rootfs() {
> >>       install -d -m 755 ${WORKDIR}/hooks_multistrap
> >> @@ -38,20 +35,20 @@ do_rootfs() {
> >>       sed -i 's|##DISTRO_APT_SOURCE##|${DISTRO_APT_SOURCE}|'
> >> ${WORKDIR}/multistrap.conf sed -i
> >> 's|##DISTRO_SUITE##|${DISTRO_SUITE}|' ${WORKDIR}/multistrap.conf
> >> sed -i 's|##DISTRO_COMPONENTS##|${DISTRO_COMPONENTS}|'
> >> ${WORKDIR}/multistrap.conf
> >> -    sed -i
> >> 's|##CONFIG_SCRIPT##|./tmp/work/${PN}/${MACHINE}/${DISTRO}/configscript.sh|'
> >> ${WORKDIR}/multistrap.conf
> >> -    sed -i
> >> 's|##SETUP_SCRIPT##|./tmp/work/${PN}/${MACHINE}/${DISTRO}/setup.sh|'
> >> ${WORKDIR}/multistrap.conf
> >> -    sed -i
> >> 's|##DIR_HOOKS##|./tmp/work/${PN}/${MACHINE}/${DISTRO}/hooks_multistrap|'
> >> ${WORKDIR}/multistrap.conf
> >> +    sed -i
> >> 's|##CONFIG_SCRIPT##|./tmp/work/${DISTRO}-${DISTRO_ARCH}/${PF}/configscript.sh|'
> >> ${WORKDIR}/multistrap.conf
> >> +    sed -i
> >> 's|##SETUP_SCRIPT##|./tmp/work/${DISTRO}-${DISTRO_ARCH}/${PF}/setup.sh|'
> >> ${WORKDIR}/multistrap.conf
> >> +    sed -i
> >> 's|##DIR_HOOKS##|./tmp/work/${DISTRO}-${DISTRO_ARCH}/${PF}/hooks_multistrap|'
> >> ${WORKDIR}/multistrap.conf # Multistrap config use relative paths,
> >> so ensure that we are in the right folder cd ${TOPDIR}
> >>   
> >>       # Create root filesystem
> >> -    sudo multistrap -a ${DISTRO_ARCH} -d "${S}" -f
> >> "${WORKDIR}/multistrap.conf" || true
> >> +    sudo multistrap -a ${DISTRO_ARCH} -d "${IMAGE_ROOTFS}" -f
> >> "${WORKDIR}/multistrap.conf" || true
> >>       # Configure root filesystem
> >> -    sudo chroot ${S} /configscript.sh ${MACHINE_SERIAL}
> >> ${BAUDRATE_TTY} \
> >> +    sudo chroot ${IMAGE_ROOTFS} /configscript.sh ${MACHINE_SERIAL}
> >> ${BAUDRATE_TTY} \ ${ROOTFS_DEV}
> >> -    sudo rm ${S}/configscript.sh
> >> +    sudo rm ${IMAGE_ROOTFS}/configscript.sh
> >>   }
> >>   
> >>   addtask rootfs before do_populate
> >> diff --git a/meta/classes/ext4-img.bbclass
> >> b/meta/classes/ext4-img.bbclass index 8588626..9af781f 100644
> >> --- a/meta/classes/ext4-img.bbclass
> >> +++ b/meta/classes/ext4-img.bbclass
> >> @@ -6,7 +6,7 @@ ROOTFS_EXTRA ?= "64"
> >>   
> >>   EXT4_IMAGE_FILE =
> >> "${DEPLOY_DIR_IMAGE}/${PN}-${MACHINE}-${DISTRO}.ext4.img"
> >> -do_ext4_image[stamp-extra-info] = "${MACHINE}-${DISTRO}"
> >> +do_ext4_image[stamp-extra-info] = "${DISTRO}-${MACHINE}"
> >>   
> >>   # Generate ext4 filesystem image
> >>   do_ext4_image() {
> >> @@ -14,23 +14,23 @@ do_ext4_image() {
> >>   
> >>       rm -f ${EXT4_IMAGE_FILE}
> >>   
> >> -    ROOTFS_SIZE=`sudo du -sm ${S} |  awk '{print $1 +
> >> ${ROOTFS_EXTRA};}'`
> >> +    ROOTFS_SIZE=`sudo du -sm ${IMAGE_ROOTFS} |  awk '{print $1 +
> >> ${ROOTFS_EXTRA};}'` dd if=/dev/zero of=${EXT4_IMAGE_FILE} bs=1M
> >> count=${ROOTFS_SIZE}
> >>
> >>       sudo mkfs.ext4 -F ${EXT4_IMAGE_FILE}
> >>   
> >>       mkdir -p ${WORKDIR}/mnt
> >>       sudo mount -o loop ${EXT4_IMAGE_FILE} ${WORKDIR}/mnt
> >> -    sudo cp -r ${S}/* ${WORKDIR}/mnt
> >> +    sudo cp -r ${IMAGE_ROOTFS}/* ${WORKDIR}/mnt
> >>       sudo umount ${WORKDIR}/mnt
> >>       rm -r ${WORKDIR}/mnt
> >>   
> >>       if [ -n "${KERNEL_IMAGE}" ]; then
> >> -        cp ${S}/boot/${KERNEL_IMAGE} ${DEPLOY_DIR_IMAGE}
> >> +        cp ${IMAGE_ROOTFS}/boot/${KERNEL_IMAGE}
> >> ${DEPLOY_DIR_IMAGE} fi
> >>   
> >>       if [ -n "${INITRD_IMAGE}" ]; then
> >> -        cp ${S}/boot/${INITRD_IMAGE} ${DEPLOY_DIR_IMAGE}
> >> +        cp ${IMAGE_ROOTFS}/boot/${INITRD_IMAGE}
> >> ${DEPLOY_DIR_IMAGE} fi
> >>   }
> >>   
> >> diff --git a/meta/classes/image.bbclass
> >> b/meta/classes/image.bbclass index a7f0d74..fe06352 100644
> >> --- a/meta/classes/image.bbclass
> >> +++ b/meta/classes/image.bbclass
> >> @@ -9,20 +9,22 @@ IMAGE_TYPE    ?= "ext4-img"
> >>   
> >>   inherit ${IMAGE_TYPE}
> >>   
> >> -do_populate[stamp-extra-info] = "${MACHINE}-${DISTRO}"
> >> +IMAGE_ROOTFS = "${WORKDIR}/rootfs"
> >> +
> >> +do_populate[stamp-extra-info] = "${DISTRO}-${MACHINE}"
> >>   
> >>   # Install Debian packages, that were built from sources
> >>   do_populate() {
> >>       if [ -n "${IMAGE_INSTALL}" ]; then
> >> -        sudo mkdir -p ${S}/deb
> >> +        sudo mkdir -p ${IMAGE_ROOTFS}/deb
> >>   
> >>           for p in ${IMAGE_INSTALL}; do
> >> -            sudo cp ${DEPLOY_DIR_DEB}/${p}_*.deb ${S}/deb
> >> +            sudo cp ${DEPLOY_DIR_DEB}/${p}_*.deb
> >> ${IMAGE_ROOTFS}/deb done
> >>   
> >> -        sudo chroot ${S} /usr/bin/dpkg -i -R /deb
> >> +        sudo chroot ${IMAGE_ROOTFS} /usr/bin/dpkg -i -R /deb
> >>   
> >> -        sudo rm -rf ${S}/deb
> >> +        sudo rm -rf ${IMAGE_ROOTFS}/deb
> >>       fi
> >>   }
> >>   
> >> diff --git a/meta/conf/isar-bitbake.conf
> >> b/meta/conf/isar-bitbake.conf index f85f5cc..5a26743 100644
> >> --- a/meta/conf/isar-bitbake.conf
> >> +++ b/meta/conf/isar-bitbake.conf
> >> @@ -18,9 +18,10 @@
> >>   # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
> >> USE OR # OTHER DEALINGS IN THE SOFTWARE.
> >>   
> >> +WORKDIR = "${TMPDIR}/work/${DISTRO}-${DISTRO_ARCH}/${PF}"
> >>   DEPLOY_DIR_DEB = "${TMPDIR}/deploy/deb/${MACHINE}"
> >>   SSTATE_DIR ?= "${TMPDIR}/sstate-cache"
> >> -BUILDCHROOT_DIR =
> >> "${TOPDIR}/tmp/work/buildchroot/${DISTRO}-${DISTRO_ARCH}/rootfs"
> >> +BUILDCHROOT_DIR =
> >> "${TMPDIR}/work/${DISTRO}-${DISTRO_ARCH}/buildchroot/rootfs" #
> >> Setup our default hash policy BB_SIGNATURE_HANDLER ?= "noop"
> >> diff --git a/meta/recipes-devtools/buildchroot/buildchroot.bb
> >> b/meta/recipes-devtools/buildchroot/buildchroot.bb index
> >> ccba683..155bd3f 100644 ---
> >> a/meta/recipes-devtools/buildchroot/buildchroot.bb +++
> >> b/meta/recipes-devtools/buildchroot/buildchroot.bb @@ -9,6 +9,7 @@
> >> LICENSE = "gpl-2.0" LIC_FILES_CHKSUM =
> >> "file://${LAYERDIR_isar}/licenses/COPYING.GPLv2;md5=751419260aa954499f7abaabaa882bbe"
> >>   PV = "1.0"
> >> +PF = "${PN}"  
> > 
> > I think this is to remove the package version from WORKDIR, i
> > suggest to do WORKDIR= instead of overwriting such an essential
> > variable. Writing to PF will i.e. also affect FILESPATH and STAMP.
> > This line deserves a comment!  
> 
> I'm still thinking about this...
> 
> My idea is that buildchroot and image recipes don't need version at
> all, because there is no source code provider, that could track the
> code revision. The line:
> 
>   PV = "1.0"
> 
> is confusing and makes really no sense, I can't imagine by which
> event it should be updated. Any changes in this recipe should be
> reflected in whole Isar version update. So the proposal is to drop
> it, but by dropping it we will get broken ${PF} variable, it will
> look like: "buildchroot-".
> 
> So, the desired goal - to have buildchroot and image WORKDIRs without 
> version suffixes:
> 
> 1. If drop PV, the PF should be updated

PV is a basic bitbake variable and i think it should not be dropped for
images. In fact you could imagine people having a v2 or v3 of their
images in their layers.
A second version of the image could have another meaning than "the way
we build has changed" it could also be "the content/configuration has
changed".

i.e.:

my-image_2.0.bb:
require recipes-core/images/isar-image-base.bb
IMAGE_INSTALL += "example-custom"

my_image_3.0.bb:
require recipes-core/images/isar-image-base.bb
IMAGE_INSTALL += "example-custom hello nano parted"
ROOTFS_EXTRA = "2048"

Henning

> 2. If do not drop PV, WORKDIR should be updated
> 
> >   
> >>   
> >>   BUILDCHROOT_PREINSTALL ?= "gcc \
> >>                              make \
> >> @@ -21,8 +22,6 @@ BUILDCHROOT_PREINSTALL ?= "gcc \
> >>                              apt \
> >>                              automake"
> >>   
> >> -WORKDIR = "${TMPDIR}/work/${PF}/${DISTRO}"
> >> -
> >>   do_build[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}"
> >>   
> >>   do_build() {
> >> @@ -40,9 +39,9 @@ do_build() {
> >>       sed -i 's|##DISTRO_APT_SOURCE##|${DISTRO_APT_SOURCE}|'
> >> ${WORKDIR}/multistrap.conf sed -i
> >> 's|##DISTRO_SUITE##|${DISTRO_SUITE}|' ${WORKDIR}/multistrap.conf
> >> sed -i 's|##DISTRO_COMPONENTS##|${DISTRO_COMPONENTS}|'
> >> ${WORKDIR}/multistrap.conf
> >> -    sed -i
> >> 's|##CONFIG_SCRIPT##|./tmp/work/${PF}/${DISTRO}/configscript.sh|'
> >> ${WORKDIR}/multistrap.conf
> >> -    sed -i
> >> 's|##SETUP_SCRIPT##|./tmp/work/${PF}/${DISTRO}/setup.sh|'
> >> ${WORKDIR}/multistrap.conf
> >> -    sed -i
> >> 's|##DIR_HOOKS##|./tmp/work/${PF}/${DISTRO}/hooks_multistrap|'
> >> ${WORKDIR}/multistrap.conf
> >> +    sed -i
> >> 's|##CONFIG_SCRIPT##|./tmp/work/${DISTRO}-${DISTRO_ARCH}/${PF}/configscript.sh|'
> >> ${WORKDIR}/multistrap.conf
> >> +    sed -i
> >> 's|##SETUP_SCRIPT##|./tmp/work/${DISTRO}-${DISTRO_ARCH}/${PF}/setup.sh|'
> >> ${WORKDIR}/multistrap.conf
> >> +    sed -i
> >> 's|##DIR_HOOKS##|./tmp/work/${DISTRO}-${DISTRO_ARCH}/${PF}/hooks_multistrap|'
> >> ${WORKDIR}/multistrap.conf  
> > 
> > The pattern tmp/work/${DISTRO}-${DISTRO_ARCH}/${PF}/ shows up all
> > the time, can that be derived from $WORKDIR instead of writing it
> > down again and again?  
> 
> That's mad, but mulstistrap understands relative paths only. Any
> attempt to replace it by absolute path lead to errors. That's why it
> was done in this way, because WORKDIR is absolute path. :-(
> 
> Alex
> 
> >   
> >> # Multistrap config use relative paths, so
> >> ensure that we are in the right folder cd ${TOPDIR}  
> >   



-- 
Siemens AG
Corporate Technology
CT RDA ITP SES-DE
Otto-Hahn-Ring 6
81739 Muenchen, Germany
Mobile: +49 172 8378927
mailto: henning.schild@siemens.com

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

* Re: [PATCH 1/2] isar: Change build folders tree
  2017-09-08 12:36     ` Alexander Smirnov
  2017-09-08 12:59       ` Henning Schild
@ 2017-09-08 13:07       ` Henning Schild
  2017-09-08 13:20         ` Alexander Smirnov
  2017-09-09  9:39       ` Claudius Heine
  2 siblings, 1 reply; 15+ messages in thread
From: Henning Schild @ 2017-09-08 13:07 UTC (permalink / raw)
  To: Alexander Smirnov; +Cc: isar-users

Am Fri, 8 Sep 2017 15:36:09 +0300
schrieb Alexander Smirnov <asmirnov@ilbers.de>:

> > This one seems pretty big and is doing multiple things at a time. I
> > suggest to split it into smaller units.
> > 
> > As far as i can tell it is doing at least 3 things at a time.
> > - rename S to IMAGE_ROOTFS
> > - change multiconf stamps from "${MACHINE}-${DISTRO}" to
> >    "${DISTRO}-${MACHINE}"
> > - change folder structure "work/${PN}/${MACHINE}/${DISTRO}" to
> >    "work/${DISTRO}-${DISTRO_ARCH}/${PF}"
> >   
> 
> No problem, if general approach is Ok, I'm going to split it into
> pieces.
> 
> > More inline.
> > 
> > Am Fri, 8 Sep 2017 12:48:33 +0300
> > schrieb Alexander Smirnov <asmirnov@ilbers.de>:
> >   
> >> Differentiate folders tree, that are generated during build on
> >> the highest possible level. So the overal tree now looks like the
> >> following:
> >>
> >>   tmp/${DISTRO}-${DISTRO_ARCH}/${PF}
> >>
> >> This approach eliminates lots of subfolders to diffirentiate
> >> buildchroot and image for multiconfig builds. Now each
> >> configuration has private tree.
> >>
> >> Signed-off-by: Alexander Smirnov <asmirnov@ilbers.de>
> >> ---
> >>   meta-isar/classes/rpi-sdimg.bbclass              |  2 +-
> >>   meta-isar/recipes-core/images/isar-image-base.bb | 19
> >> ++++++++----------- meta/classes/ext4-img.bbclass
> >> | 10 +++++----- meta/classes/image.bbclass                       |
> >> 12 +++++++----- meta/conf/isar-bitbake.conf
> >> |  3 ++- meta/recipes-devtools/buildchroot/buildchroot.bb |  9
> >> ++++----- 6 files changed, 27 insertions(+), 28 deletions(-)
> >>
> >> diff --git a/meta-isar/classes/rpi-sdimg.bbclass
> >> b/meta-isar/classes/rpi-sdimg.bbclass index 2614c41..91b09cd 100644
> >> --- a/meta-isar/classes/rpi-sdimg.bbclass
> >> +++ b/meta-isar/classes/rpi-sdimg.bbclass
> >> @@ -47,7 +47,7 @@ do_rpi_sdimg () {
> >>       BOOT_BLOCKS=$(LC_ALL=C parted -s ${SDIMG} unit b print | awk
> >> '/ 1 / { print substr($4, 1, length($4 -1)) / 512 /2 }') rm -f
> >> ${WORKDIR}/boot.img mkfs.vfat -n "${BOOTDD_VOLUME_ID}" -S 512 -C
> >> ${WORKDIR}/boot.img $BOOT_BLOCKS
> >> -    mcopy -i ${WORKDIR}/boot.img -s ${S}/boot/* ::/
> >> +    mcopy -i ${WORKDIR}/boot.img -s ${IMAGE_ROOTFS}/boot/* ::/  
> > 
> > This could be one patch that replaces S with IMAGE_ROOTFS.
> >   
> 
> Ok.
> 
> >>   
> >>       # Burn Partitions
> >>       dd if=${WORKDIR}/boot.img of=${SDIMG} conv=notrunc seek=1
> >> bs=$(expr ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) && sync && sync diff
> >> --git a/meta-isar/recipes-core/images/isar-image-base.bb
> >> b/meta-isar/recipes-core/images/isar-image-base.bb index
> >> b679d97..178ac05 100644 ---
> >> a/meta-isar/recipes-core/images/isar-image-base.bb +++
> >> b/meta-isar/recipes-core/images/isar-image-base.bb @@ -9,6 +9,7 @@
> >> LICENSE = "gpl-2.0" LIC_FILES_CHKSUM =
> >> "file://${LAYERDIR_isar}/licenses/COPYING.GPLv2;md5=751419260aa954499f7abaabaa882bbe"
> >> PV = "1.0" +PF = "${PN}"
> >>   
> >>   inherit image
> >>   
> >> @@ -17,11 +18,7 @@ DEPENDS += "${IMAGE_INSTALL}"
> >>   IMAGE_PREINSTALL += "apt \
> >>                        dbus"
> >>   
> >> -WORKDIR = "${TMPDIR}/work/${PN}/${MACHINE}/${DISTRO}"  
> >   
> >> -S = "${WORKDIR}/rootfs"
> >> -IMAGE_ROOTFS = "${S}"  
> > 
> > Part of the S -> IMAGE_ROOTFS
> >   
> 
> Ok.
> 
> >> -
> >> -do_rootfs[stamp-extra-info] = "${MACHINE}-${DISTRO}"
> >> +do_rootfs[stamp-extra-info] = "${DISTRO}-${MACHINE}"  
> > 
> > This is also a change that should be in a seperate smaller patch.  
> 
> Ok.
> 
> >      
> >>   do_rootfs() {
> >>       install -d -m 755 ${WORKDIR}/hooks_multistrap
> >> @@ -38,20 +35,20 @@ do_rootfs() {
> >>       sed -i 's|##DISTRO_APT_SOURCE##|${DISTRO_APT_SOURCE}|'
> >> ${WORKDIR}/multistrap.conf sed -i
> >> 's|##DISTRO_SUITE##|${DISTRO_SUITE}|' ${WORKDIR}/multistrap.conf
> >> sed -i 's|##DISTRO_COMPONENTS##|${DISTRO_COMPONENTS}|'
> >> ${WORKDIR}/multistrap.conf
> >> -    sed -i
> >> 's|##CONFIG_SCRIPT##|./tmp/work/${PN}/${MACHINE}/${DISTRO}/configscript.sh|'
> >> ${WORKDIR}/multistrap.conf
> >> -    sed -i
> >> 's|##SETUP_SCRIPT##|./tmp/work/${PN}/${MACHINE}/${DISTRO}/setup.sh|'
> >> ${WORKDIR}/multistrap.conf
> >> -    sed -i
> >> 's|##DIR_HOOKS##|./tmp/work/${PN}/${MACHINE}/${DISTRO}/hooks_multistrap|'
> >> ${WORKDIR}/multistrap.conf
> >> +    sed -i
> >> 's|##CONFIG_SCRIPT##|./tmp/work/${DISTRO}-${DISTRO_ARCH}/${PF}/configscript.sh|'
> >> ${WORKDIR}/multistrap.conf
> >> +    sed -i
> >> 's|##SETUP_SCRIPT##|./tmp/work/${DISTRO}-${DISTRO_ARCH}/${PF}/setup.sh|'
> >> ${WORKDIR}/multistrap.conf
> >> +    sed -i
> >> 's|##DIR_HOOKS##|./tmp/work/${DISTRO}-${DISTRO_ARCH}/${PF}/hooks_multistrap|'
> >> ${WORKDIR}/multistrap.conf # Multistrap config use relative paths,
> >> so ensure that we are in the right folder cd ${TOPDIR}
> >>   
> >>       # Create root filesystem
> >> -    sudo multistrap -a ${DISTRO_ARCH} -d "${S}" -f
> >> "${WORKDIR}/multistrap.conf" || true
> >> +    sudo multistrap -a ${DISTRO_ARCH} -d "${IMAGE_ROOTFS}" -f
> >> "${WORKDIR}/multistrap.conf" || true
> >>       # Configure root filesystem
> >> -    sudo chroot ${S} /configscript.sh ${MACHINE_SERIAL}
> >> ${BAUDRATE_TTY} \
> >> +    sudo chroot ${IMAGE_ROOTFS} /configscript.sh ${MACHINE_SERIAL}
> >> ${BAUDRATE_TTY} \ ${ROOTFS_DEV}
> >> -    sudo rm ${S}/configscript.sh
> >> +    sudo rm ${IMAGE_ROOTFS}/configscript.sh
> >>   }
> >>   
> >>   addtask rootfs before do_populate
> >> diff --git a/meta/classes/ext4-img.bbclass
> >> b/meta/classes/ext4-img.bbclass index 8588626..9af781f 100644
> >> --- a/meta/classes/ext4-img.bbclass
> >> +++ b/meta/classes/ext4-img.bbclass
> >> @@ -6,7 +6,7 @@ ROOTFS_EXTRA ?= "64"
> >>   
> >>   EXT4_IMAGE_FILE =
> >> "${DEPLOY_DIR_IMAGE}/${PN}-${MACHINE}-${DISTRO}.ext4.img"
> >> -do_ext4_image[stamp-extra-info] = "${MACHINE}-${DISTRO}"
> >> +do_ext4_image[stamp-extra-info] = "${DISTRO}-${MACHINE}"
> >>   
> >>   # Generate ext4 filesystem image
> >>   do_ext4_image() {
> >> @@ -14,23 +14,23 @@ do_ext4_image() {
> >>   
> >>       rm -f ${EXT4_IMAGE_FILE}
> >>   
> >> -    ROOTFS_SIZE=`sudo du -sm ${S} |  awk '{print $1 +
> >> ${ROOTFS_EXTRA};}'`
> >> +    ROOTFS_SIZE=`sudo du -sm ${IMAGE_ROOTFS} |  awk '{print $1 +
> >> ${ROOTFS_EXTRA};}'` dd if=/dev/zero of=${EXT4_IMAGE_FILE} bs=1M
> >> count=${ROOTFS_SIZE}
> >>
> >>       sudo mkfs.ext4 -F ${EXT4_IMAGE_FILE}
> >>   
> >>       mkdir -p ${WORKDIR}/mnt
> >>       sudo mount -o loop ${EXT4_IMAGE_FILE} ${WORKDIR}/mnt
> >> -    sudo cp -r ${S}/* ${WORKDIR}/mnt
> >> +    sudo cp -r ${IMAGE_ROOTFS}/* ${WORKDIR}/mnt
> >>       sudo umount ${WORKDIR}/mnt
> >>       rm -r ${WORKDIR}/mnt
> >>   
> >>       if [ -n "${KERNEL_IMAGE}" ]; then
> >> -        cp ${S}/boot/${KERNEL_IMAGE} ${DEPLOY_DIR_IMAGE}
> >> +        cp ${IMAGE_ROOTFS}/boot/${KERNEL_IMAGE}
> >> ${DEPLOY_DIR_IMAGE} fi
> >>   
> >>       if [ -n "${INITRD_IMAGE}" ]; then
> >> -        cp ${S}/boot/${INITRD_IMAGE} ${DEPLOY_DIR_IMAGE}
> >> +        cp ${IMAGE_ROOTFS}/boot/${INITRD_IMAGE}
> >> ${DEPLOY_DIR_IMAGE} fi
> >>   }
> >>   
> >> diff --git a/meta/classes/image.bbclass
> >> b/meta/classes/image.bbclass index a7f0d74..fe06352 100644
> >> --- a/meta/classes/image.bbclass
> >> +++ b/meta/classes/image.bbclass
> >> @@ -9,20 +9,22 @@ IMAGE_TYPE    ?= "ext4-img"
> >>   
> >>   inherit ${IMAGE_TYPE}
> >>   
> >> -do_populate[stamp-extra-info] = "${MACHINE}-${DISTRO}"
> >> +IMAGE_ROOTFS = "${WORKDIR}/rootfs"
> >> +
> >> +do_populate[stamp-extra-info] = "${DISTRO}-${MACHINE}"
> >>   
> >>   # Install Debian packages, that were built from sources
> >>   do_populate() {
> >>       if [ -n "${IMAGE_INSTALL}" ]; then
> >> -        sudo mkdir -p ${S}/deb
> >> +        sudo mkdir -p ${IMAGE_ROOTFS}/deb
> >>   
> >>           for p in ${IMAGE_INSTALL}; do
> >> -            sudo cp ${DEPLOY_DIR_DEB}/${p}_*.deb ${S}/deb
> >> +            sudo cp ${DEPLOY_DIR_DEB}/${p}_*.deb
> >> ${IMAGE_ROOTFS}/deb done
> >>   
> >> -        sudo chroot ${S} /usr/bin/dpkg -i -R /deb
> >> +        sudo chroot ${IMAGE_ROOTFS} /usr/bin/dpkg -i -R /deb
> >>   
> >> -        sudo rm -rf ${S}/deb
> >> +        sudo rm -rf ${IMAGE_ROOTFS}/deb
> >>       fi
> >>   }
> >>   
> >> diff --git a/meta/conf/isar-bitbake.conf
> >> b/meta/conf/isar-bitbake.conf index f85f5cc..5a26743 100644
> >> --- a/meta/conf/isar-bitbake.conf
> >> +++ b/meta/conf/isar-bitbake.conf
> >> @@ -18,9 +18,10 @@
> >>   # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
> >> USE OR # OTHER DEALINGS IN THE SOFTWARE.
> >>   
> >> +WORKDIR = "${TMPDIR}/work/${DISTRO}-${DISTRO_ARCH}/${PF}"
> >>   DEPLOY_DIR_DEB = "${TMPDIR}/deploy/deb/${MACHINE}"
> >>   SSTATE_DIR ?= "${TMPDIR}/sstate-cache"
> >> -BUILDCHROOT_DIR =
> >> "${TOPDIR}/tmp/work/buildchroot/${DISTRO}-${DISTRO_ARCH}/rootfs"
> >> +BUILDCHROOT_DIR =
> >> "${TMPDIR}/work/${DISTRO}-${DISTRO_ARCH}/buildchroot/rootfs" #
> >> Setup our default hash policy BB_SIGNATURE_HANDLER ?= "noop"
> >> diff --git a/meta/recipes-devtools/buildchroot/buildchroot.bb
> >> b/meta/recipes-devtools/buildchroot/buildchroot.bb index
> >> ccba683..155bd3f 100644 ---
> >> a/meta/recipes-devtools/buildchroot/buildchroot.bb +++
> >> b/meta/recipes-devtools/buildchroot/buildchroot.bb @@ -9,6 +9,7 @@
> >> LICENSE = "gpl-2.0" LIC_FILES_CHKSUM =
> >> "file://${LAYERDIR_isar}/licenses/COPYING.GPLv2;md5=751419260aa954499f7abaabaa882bbe"
> >>   PV = "1.0"
> >> +PF = "${PN}"  
> > 
> > I think this is to remove the package version from WORKDIR, i
> > suggest to do WORKDIR= instead of overwriting such an essential
> > variable. Writing to PF will i.e. also affect FILESPATH and STAMP.
> > This line deserves a comment!  
> 
> I'm still thinking about this...
> 
> My idea is that buildchroot and image recipes don't need version at
> all, because there is no source code provider, that could track the
> code revision. The line:
> 
>   PV = "1.0"
> 
> is confusing and makes really no sense, I can't imagine by which
> event it should be updated. Any changes in this recipe should be
> reflected in whole Isar version update. So the proposal is to drop
> it, but by dropping it we will get broken ${PF} variable, it will
> look like: "buildchroot-".
> 
> So, the desired goal - to have buildchroot and image WORKDIRs without 
> version suffixes:
> 
> 1. If drop PV, the PF should be updated
> 2. If do not drop PV, WORKDIR should be updated
> 
> >   
> >>   
> >>   BUILDCHROOT_PREINSTALL ?= "gcc \
> >>                              make \
> >> @@ -21,8 +22,6 @@ BUILDCHROOT_PREINSTALL ?= "gcc \
> >>                              apt \
> >>                              automake"
> >>   
> >> -WORKDIR = "${TMPDIR}/work/${PF}/${DISTRO}"
> >> -
> >>   do_build[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}"
> >>   
> >>   do_build() {
> >> @@ -40,9 +39,9 @@ do_build() {
> >>       sed -i 's|##DISTRO_APT_SOURCE##|${DISTRO_APT_SOURCE}|'
> >> ${WORKDIR}/multistrap.conf sed -i
> >> 's|##DISTRO_SUITE##|${DISTRO_SUITE}|' ${WORKDIR}/multistrap.conf
> >> sed -i 's|##DISTRO_COMPONENTS##|${DISTRO_COMPONENTS}|'
> >> ${WORKDIR}/multistrap.conf
> >> -    sed -i
> >> 's|##CONFIG_SCRIPT##|./tmp/work/${PF}/${DISTRO}/configscript.sh|'
> >> ${WORKDIR}/multistrap.conf
> >> -    sed -i
> >> 's|##SETUP_SCRIPT##|./tmp/work/${PF}/${DISTRO}/setup.sh|'
> >> ${WORKDIR}/multistrap.conf
> >> -    sed -i
> >> 's|##DIR_HOOKS##|./tmp/work/${PF}/${DISTRO}/hooks_multistrap|'
> >> ${WORKDIR}/multistrap.conf
> >> +    sed -i
> >> 's|##CONFIG_SCRIPT##|./tmp/work/${DISTRO}-${DISTRO_ARCH}/${PF}/configscript.sh|'
> >> ${WORKDIR}/multistrap.conf
> >> +    sed -i
> >> 's|##SETUP_SCRIPT##|./tmp/work/${DISTRO}-${DISTRO_ARCH}/${PF}/setup.sh|'
> >> ${WORKDIR}/multistrap.conf
> >> +    sed -i
> >> 's|##DIR_HOOKS##|./tmp/work/${DISTRO}-${DISTRO_ARCH}/${PF}/hooks_multistrap|'
> >> ${WORKDIR}/multistrap.conf  
> > 
> > The pattern tmp/work/${DISTRO}-${DISTRO_ARCH}/${PF}/ shows up all
> > the time, can that be derived from $WORKDIR instead of writing it
> > down again and again?  
> 
> That's mad, but mulstistrap understands relative paths only. Any
> attempt to replace it by absolute path lead to errors. That's why it
> was done in this way, because WORKDIR is absolute path. :-(

Ok. Could this not be fixed with something like the following in
isar-bitbake.conf:

WORKDIR_SUFFIX=${DISTRO}-${DISTRO_ARCH}/${PF}
WORKDIR=${WORKDIR}/${WORKDIR_SUFFIX}

and now you can use WORKDIR_SUFFIX in all these lines. Such a change
should probably be its own patch.

Henning

> Alex
> 
> >   
> >> # Multistrap config use relative paths, so
> >> ensure that we are in the right folder cd ${TOPDIR}  
> >   


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

* Re: [PATCH 1/2] isar: Change build folders tree
  2017-09-08 13:07       ` Henning Schild
@ 2017-09-08 13:20         ` Alexander Smirnov
  2017-09-08 13:36           ` Henning Schild
  0 siblings, 1 reply; 15+ messages in thread
From: Alexander Smirnov @ 2017-09-08 13:20 UTC (permalink / raw)
  To: Henning Schild; +Cc: isar-users



On 09/08/2017 04:07 PM, Henning Schild wrote:
> Am Fri, 8 Sep 2017 15:36:09 +0300
> schrieb Alexander Smirnov <asmirnov@ilbers.de>:
> 
>>> This one seems pretty big and is doing multiple things at a time. I
>>> suggest to split it into smaller units.
>>>
>>> As far as i can tell it is doing at least 3 things at a time.
>>> - rename S to IMAGE_ROOTFS
>>> - change multiconf stamps from "${MACHINE}-${DISTRO}" to
>>>     "${DISTRO}-${MACHINE}"
>>> - change folder structure "work/${PN}/${MACHINE}/${DISTRO}" to
>>>     "work/${DISTRO}-${DISTRO_ARCH}/${PF}"
>>>    
>>
>> No problem, if general approach is Ok, I'm going to split it into
>> pieces.
>>
>>> More inline.
>>>
>>> Am Fri, 8 Sep 2017 12:48:33 +0300
>>> schrieb Alexander Smirnov <asmirnov@ilbers.de>:
>>>    
>>>> Differentiate folders tree, that are generated during build on
>>>> the highest possible level. So the overal tree now looks like the
>>>> following:
>>>>
>>>>    tmp/${DISTRO}-${DISTRO_ARCH}/${PF}
>>>>
>>>> This approach eliminates lots of subfolders to diffirentiate
>>>> buildchroot and image for multiconfig builds. Now each
>>>> configuration has private tree.
>>>>
>>>> Signed-off-by: Alexander Smirnov <asmirnov@ilbers.de>
>>>> ---
>>>>    meta-isar/classes/rpi-sdimg.bbclass              |  2 +-
>>>>    meta-isar/recipes-core/images/isar-image-base.bb | 19
>>>> ++++++++----------- meta/classes/ext4-img.bbclass
>>>> | 10 +++++----- meta/classes/image.bbclass                       |
>>>> 12 +++++++----- meta/conf/isar-bitbake.conf
>>>> |  3 ++- meta/recipes-devtools/buildchroot/buildchroot.bb |  9
>>>> ++++----- 6 files changed, 27 insertions(+), 28 deletions(-)
>>>>
>>>> diff --git a/meta-isar/classes/rpi-sdimg.bbclass
>>>> b/meta-isar/classes/rpi-sdimg.bbclass index 2614c41..91b09cd 100644
>>>> --- a/meta-isar/classes/rpi-sdimg.bbclass
>>>> +++ b/meta-isar/classes/rpi-sdimg.bbclass
>>>> @@ -47,7 +47,7 @@ do_rpi_sdimg () {
>>>>        BOOT_BLOCKS=$(LC_ALL=C parted -s ${SDIMG} unit b print | awk
>>>> '/ 1 / { print substr($4, 1, length($4 -1)) / 512 /2 }') rm -f
>>>> ${WORKDIR}/boot.img mkfs.vfat -n "${BOOTDD_VOLUME_ID}" -S 512 -C
>>>> ${WORKDIR}/boot.img $BOOT_BLOCKS
>>>> -    mcopy -i ${WORKDIR}/boot.img -s ${S}/boot/* ::/
>>>> +    mcopy -i ${WORKDIR}/boot.img -s ${IMAGE_ROOTFS}/boot/* ::/
>>>
>>> This could be one patch that replaces S with IMAGE_ROOTFS.
>>>    
>>
>> Ok.
>>
>>>>    
>>>>        # Burn Partitions
>>>>        dd if=${WORKDIR}/boot.img of=${SDIMG} conv=notrunc seek=1
>>>> bs=$(expr ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) && sync && sync diff
>>>> --git a/meta-isar/recipes-core/images/isar-image-base.bb
>>>> b/meta-isar/recipes-core/images/isar-image-base.bb index
>>>> b679d97..178ac05 100644 ---
>>>> a/meta-isar/recipes-core/images/isar-image-base.bb +++
>>>> b/meta-isar/recipes-core/images/isar-image-base.bb @@ -9,6 +9,7 @@
>>>> LICENSE = "gpl-2.0" LIC_FILES_CHKSUM =
>>>> "file://${LAYERDIR_isar}/licenses/COPYING.GPLv2;md5=751419260aa954499f7abaabaa882bbe"
>>>> PV = "1.0" +PF = "${PN}"
>>>>    
>>>>    inherit image
>>>>    
>>>> @@ -17,11 +18,7 @@ DEPENDS += "${IMAGE_INSTALL}"
>>>>    IMAGE_PREINSTALL += "apt \
>>>>                         dbus"
>>>>    
>>>> -WORKDIR = "${TMPDIR}/work/${PN}/${MACHINE}/${DISTRO}"
>>>    
>>>> -S = "${WORKDIR}/rootfs"
>>>> -IMAGE_ROOTFS = "${S}"
>>>
>>> Part of the S -> IMAGE_ROOTFS
>>>    
>>
>> Ok.
>>
>>>> -
>>>> -do_rootfs[stamp-extra-info] = "${MACHINE}-${DISTRO}"
>>>> +do_rootfs[stamp-extra-info] = "${DISTRO}-${MACHINE}"
>>>
>>> This is also a change that should be in a seperate smaller patch.
>>
>> Ok.
>>
>>>       
>>>>    do_rootfs() {
>>>>        install -d -m 755 ${WORKDIR}/hooks_multistrap
>>>> @@ -38,20 +35,20 @@ do_rootfs() {
>>>>        sed -i 's|##DISTRO_APT_SOURCE##|${DISTRO_APT_SOURCE}|'
>>>> ${WORKDIR}/multistrap.conf sed -i
>>>> 's|##DISTRO_SUITE##|${DISTRO_SUITE}|' ${WORKDIR}/multistrap.conf
>>>> sed -i 's|##DISTRO_COMPONENTS##|${DISTRO_COMPONENTS}|'
>>>> ${WORKDIR}/multistrap.conf
>>>> -    sed -i
>>>> 's|##CONFIG_SCRIPT##|./tmp/work/${PN}/${MACHINE}/${DISTRO}/configscript.sh|'
>>>> ${WORKDIR}/multistrap.conf
>>>> -    sed -i
>>>> 's|##SETUP_SCRIPT##|./tmp/work/${PN}/${MACHINE}/${DISTRO}/setup.sh|'
>>>> ${WORKDIR}/multistrap.conf
>>>> -    sed -i
>>>> 's|##DIR_HOOKS##|./tmp/work/${PN}/${MACHINE}/${DISTRO}/hooks_multistrap|'
>>>> ${WORKDIR}/multistrap.conf
>>>> +    sed -i
>>>> 's|##CONFIG_SCRIPT##|./tmp/work/${DISTRO}-${DISTRO_ARCH}/${PF}/configscript.sh|'
>>>> ${WORKDIR}/multistrap.conf
>>>> +    sed -i
>>>> 's|##SETUP_SCRIPT##|./tmp/work/${DISTRO}-${DISTRO_ARCH}/${PF}/setup.sh|'
>>>> ${WORKDIR}/multistrap.conf
>>>> +    sed -i
>>>> 's|##DIR_HOOKS##|./tmp/work/${DISTRO}-${DISTRO_ARCH}/${PF}/hooks_multistrap|'
>>>> ${WORKDIR}/multistrap.conf # Multistrap config use relative paths,
>>>> so ensure that we are in the right folder cd ${TOPDIR}
>>>>    
>>>>        # Create root filesystem
>>>> -    sudo multistrap -a ${DISTRO_ARCH} -d "${S}" -f
>>>> "${WORKDIR}/multistrap.conf" || true
>>>> +    sudo multistrap -a ${DISTRO_ARCH} -d "${IMAGE_ROOTFS}" -f
>>>> "${WORKDIR}/multistrap.conf" || true
>>>>        # Configure root filesystem
>>>> -    sudo chroot ${S} /configscript.sh ${MACHINE_SERIAL}
>>>> ${BAUDRATE_TTY} \
>>>> +    sudo chroot ${IMAGE_ROOTFS} /configscript.sh ${MACHINE_SERIAL}
>>>> ${BAUDRATE_TTY} \ ${ROOTFS_DEV}
>>>> -    sudo rm ${S}/configscript.sh
>>>> +    sudo rm ${IMAGE_ROOTFS}/configscript.sh
>>>>    }
>>>>    
>>>>    addtask rootfs before do_populate
>>>> diff --git a/meta/classes/ext4-img.bbclass
>>>> b/meta/classes/ext4-img.bbclass index 8588626..9af781f 100644
>>>> --- a/meta/classes/ext4-img.bbclass
>>>> +++ b/meta/classes/ext4-img.bbclass
>>>> @@ -6,7 +6,7 @@ ROOTFS_EXTRA ?= "64"
>>>>    
>>>>    EXT4_IMAGE_FILE =
>>>> "${DEPLOY_DIR_IMAGE}/${PN}-${MACHINE}-${DISTRO}.ext4.img"
>>>> -do_ext4_image[stamp-extra-info] = "${MACHINE}-${DISTRO}"
>>>> +do_ext4_image[stamp-extra-info] = "${DISTRO}-${MACHINE}"
>>>>    
>>>>    # Generate ext4 filesystem image
>>>>    do_ext4_image() {
>>>> @@ -14,23 +14,23 @@ do_ext4_image() {
>>>>    
>>>>        rm -f ${EXT4_IMAGE_FILE}
>>>>    
>>>> -    ROOTFS_SIZE=`sudo du -sm ${S} |  awk '{print $1 +
>>>> ${ROOTFS_EXTRA};}'`
>>>> +    ROOTFS_SIZE=`sudo du -sm ${IMAGE_ROOTFS} |  awk '{print $1 +
>>>> ${ROOTFS_EXTRA};}'` dd if=/dev/zero of=${EXT4_IMAGE_FILE} bs=1M
>>>> count=${ROOTFS_SIZE}
>>>>
>>>>        sudo mkfs.ext4 -F ${EXT4_IMAGE_FILE}
>>>>    
>>>>        mkdir -p ${WORKDIR}/mnt
>>>>        sudo mount -o loop ${EXT4_IMAGE_FILE} ${WORKDIR}/mnt
>>>> -    sudo cp -r ${S}/* ${WORKDIR}/mnt
>>>> +    sudo cp -r ${IMAGE_ROOTFS}/* ${WORKDIR}/mnt
>>>>        sudo umount ${WORKDIR}/mnt
>>>>        rm -r ${WORKDIR}/mnt
>>>>    
>>>>        if [ -n "${KERNEL_IMAGE}" ]; then
>>>> -        cp ${S}/boot/${KERNEL_IMAGE} ${DEPLOY_DIR_IMAGE}
>>>> +        cp ${IMAGE_ROOTFS}/boot/${KERNEL_IMAGE}
>>>> ${DEPLOY_DIR_IMAGE} fi
>>>>    
>>>>        if [ -n "${INITRD_IMAGE}" ]; then
>>>> -        cp ${S}/boot/${INITRD_IMAGE} ${DEPLOY_DIR_IMAGE}
>>>> +        cp ${IMAGE_ROOTFS}/boot/${INITRD_IMAGE}
>>>> ${DEPLOY_DIR_IMAGE} fi
>>>>    }
>>>>    
>>>> diff --git a/meta/classes/image.bbclass
>>>> b/meta/classes/image.bbclass index a7f0d74..fe06352 100644
>>>> --- a/meta/classes/image.bbclass
>>>> +++ b/meta/classes/image.bbclass
>>>> @@ -9,20 +9,22 @@ IMAGE_TYPE    ?= "ext4-img"
>>>>    
>>>>    inherit ${IMAGE_TYPE}
>>>>    
>>>> -do_populate[stamp-extra-info] = "${MACHINE}-${DISTRO}"
>>>> +IMAGE_ROOTFS = "${WORKDIR}/rootfs"
>>>> +
>>>> +do_populate[stamp-extra-info] = "${DISTRO}-${MACHINE}"
>>>>    
>>>>    # Install Debian packages, that were built from sources
>>>>    do_populate() {
>>>>        if [ -n "${IMAGE_INSTALL}" ]; then
>>>> -        sudo mkdir -p ${S}/deb
>>>> +        sudo mkdir -p ${IMAGE_ROOTFS}/deb
>>>>    
>>>>            for p in ${IMAGE_INSTALL}; do
>>>> -            sudo cp ${DEPLOY_DIR_DEB}/${p}_*.deb ${S}/deb
>>>> +            sudo cp ${DEPLOY_DIR_DEB}/${p}_*.deb
>>>> ${IMAGE_ROOTFS}/deb done
>>>>    
>>>> -        sudo chroot ${S} /usr/bin/dpkg -i -R /deb
>>>> +        sudo chroot ${IMAGE_ROOTFS} /usr/bin/dpkg -i -R /deb
>>>>    
>>>> -        sudo rm -rf ${S}/deb
>>>> +        sudo rm -rf ${IMAGE_ROOTFS}/deb
>>>>        fi
>>>>    }
>>>>    
>>>> diff --git a/meta/conf/isar-bitbake.conf
>>>> b/meta/conf/isar-bitbake.conf index f85f5cc..5a26743 100644
>>>> --- a/meta/conf/isar-bitbake.conf
>>>> +++ b/meta/conf/isar-bitbake.conf
>>>> @@ -18,9 +18,10 @@
>>>>    # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
>>>> USE OR # OTHER DEALINGS IN THE SOFTWARE.
>>>>    
>>>> +WORKDIR = "${TMPDIR}/work/${DISTRO}-${DISTRO_ARCH}/${PF}"
>>>>    DEPLOY_DIR_DEB = "${TMPDIR}/deploy/deb/${MACHINE}"
>>>>    SSTATE_DIR ?= "${TMPDIR}/sstate-cache"
>>>> -BUILDCHROOT_DIR =
>>>> "${TOPDIR}/tmp/work/buildchroot/${DISTRO}-${DISTRO_ARCH}/rootfs"
>>>> +BUILDCHROOT_DIR =
>>>> "${TMPDIR}/work/${DISTRO}-${DISTRO_ARCH}/buildchroot/rootfs" #
>>>> Setup our default hash policy BB_SIGNATURE_HANDLER ?= "noop"
>>>> diff --git a/meta/recipes-devtools/buildchroot/buildchroot.bb
>>>> b/meta/recipes-devtools/buildchroot/buildchroot.bb index
>>>> ccba683..155bd3f 100644 ---
>>>> a/meta/recipes-devtools/buildchroot/buildchroot.bb +++
>>>> b/meta/recipes-devtools/buildchroot/buildchroot.bb @@ -9,6 +9,7 @@
>>>> LICENSE = "gpl-2.0" LIC_FILES_CHKSUM =
>>>> "file://${LAYERDIR_isar}/licenses/COPYING.GPLv2;md5=751419260aa954499f7abaabaa882bbe"
>>>>    PV = "1.0"
>>>> +PF = "${PN}"
>>>
>>> I think this is to remove the package version from WORKDIR, i
>>> suggest to do WORKDIR= instead of overwriting such an essential
>>> variable. Writing to PF will i.e. also affect FILESPATH and STAMP.
>>> This line deserves a comment!
>>
>> I'm still thinking about this...
>>
>> My idea is that buildchroot and image recipes don't need version at
>> all, because there is no source code provider, that could track the
>> code revision. The line:
>>
>>    PV = "1.0"
>>
>> is confusing and makes really no sense, I can't imagine by which
>> event it should be updated. Any changes in this recipe should be
>> reflected in whole Isar version update. So the proposal is to drop
>> it, but by dropping it we will get broken ${PF} variable, it will
>> look like: "buildchroot-".
>>
>> So, the desired goal - to have buildchroot and image WORKDIRs without
>> version suffixes:
>>
>> 1. If drop PV, the PF should be updated
>> 2. If do not drop PV, WORKDIR should be updated
>>
>>>    
>>>>    
>>>>    BUILDCHROOT_PREINSTALL ?= "gcc \
>>>>                               make \
>>>> @@ -21,8 +22,6 @@ BUILDCHROOT_PREINSTALL ?= "gcc \
>>>>                               apt \
>>>>                               automake"
>>>>    
>>>> -WORKDIR = "${TMPDIR}/work/${PF}/${DISTRO}"
>>>> -
>>>>    do_build[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}"
>>>>    
>>>>    do_build() {
>>>> @@ -40,9 +39,9 @@ do_build() {
>>>>        sed -i 's|##DISTRO_APT_SOURCE##|${DISTRO_APT_SOURCE}|'
>>>> ${WORKDIR}/multistrap.conf sed -i
>>>> 's|##DISTRO_SUITE##|${DISTRO_SUITE}|' ${WORKDIR}/multistrap.conf
>>>> sed -i 's|##DISTRO_COMPONENTS##|${DISTRO_COMPONENTS}|'
>>>> ${WORKDIR}/multistrap.conf
>>>> -    sed -i
>>>> 's|##CONFIG_SCRIPT##|./tmp/work/${PF}/${DISTRO}/configscript.sh|'
>>>> ${WORKDIR}/multistrap.conf
>>>> -    sed -i
>>>> 's|##SETUP_SCRIPT##|./tmp/work/${PF}/${DISTRO}/setup.sh|'
>>>> ${WORKDIR}/multistrap.conf
>>>> -    sed -i
>>>> 's|##DIR_HOOKS##|./tmp/work/${PF}/${DISTRO}/hooks_multistrap|'
>>>> ${WORKDIR}/multistrap.conf
>>>> +    sed -i
>>>> 's|##CONFIG_SCRIPT##|./tmp/work/${DISTRO}-${DISTRO_ARCH}/${PF}/configscript.sh|'
>>>> ${WORKDIR}/multistrap.conf
>>>> +    sed -i
>>>> 's|##SETUP_SCRIPT##|./tmp/work/${DISTRO}-${DISTRO_ARCH}/${PF}/setup.sh|'
>>>> ${WORKDIR}/multistrap.conf
>>>> +    sed -i
>>>> 's|##DIR_HOOKS##|./tmp/work/${DISTRO}-${DISTRO_ARCH}/${PF}/hooks_multistrap|'
>>>> ${WORKDIR}/multistrap.conf
>>>
>>> The pattern tmp/work/${DISTRO}-${DISTRO_ARCH}/${PF}/ shows up all
>>> the time, can that be derived from $WORKDIR instead of writing it
>>> down again and again?
>>
>> That's mad, but mulstistrap understands relative paths only. Any
>> attempt to replace it by absolute path lead to errors. That's why it
>> was done in this way, because WORKDIR is absolute path. :-(
> 
> Ok. Could this not be fixed with something like the following in
> isar-bitbake.conf:
> 
> WORKDIR_SUFFIX=${DISTRO}-${DISTRO_ARCH}/${PF}
> WORKDIR=${WORKDIR}/${WORKDIR_SUFFIX}

Does this line correct? After concatenation there will be line:

   ${TMPDIR}/work/${PF}/${DISTRO}-${DISTRO_ARCH}/${PF}

I assume it's not the one you want...

Due to we need eventually whole path:

   ./tmp/work/${DISTRO}-${DISTRO_ARCH}/${PF}

we could a bit change your proposal:

WORKDIR_RELATIVE=tmp/work/${DISTRO}-${DISTRO_ARCH}/${PF}
WORKDIR=${TOPDIR}/${WORKDIR_RELATIVE}

so the pattern for multistrap will be: ./${WORKDIR_RELATIVE}

what do you think?

Alex

> and now you can use WORKDIR_SUFFIX in all these lines. Such a change
> should probably be its own patch.
> 
> Henning
> 
>> Alex
>>
>>>    
>>>> # Multistrap config use relative paths, so
>>>> ensure that we are in the right folder cd ${TOPDIR}
>>>    
> 

-- 
With best regards,
Alexander Smirnov

ilbers GmbH
Baierbrunner Str. 28c
D-81379 Munich
+49 (89) 122 67 24-0
http://ilbers.de/
Commercial register Munich, HRB 214197
General manager: Baurzhan Ismagulov

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

* Re: [PATCH 1/2] isar: Change build folders tree
  2017-09-08 13:20         ` Alexander Smirnov
@ 2017-09-08 13:36           ` Henning Schild
  0 siblings, 0 replies; 15+ messages in thread
From: Henning Schild @ 2017-09-08 13:36 UTC (permalink / raw)
  To: Alexander Smirnov; +Cc: isar-users

Am Fri, 8 Sep 2017 16:20:04 +0300
schrieb Alexander Smirnov <asmirnov@ilbers.de>:

> On 09/08/2017 04:07 PM, Henning Schild wrote:
> > Am Fri, 8 Sep 2017 15:36:09 +0300
> > schrieb Alexander Smirnov <asmirnov@ilbers.de>:
> >   
> >>> This one seems pretty big and is doing multiple things at a time.
> >>> I suggest to split it into smaller units.
> >>>
> >>> As far as i can tell it is doing at least 3 things at a time.
> >>> - rename S to IMAGE_ROOTFS
> >>> - change multiconf stamps from "${MACHINE}-${DISTRO}" to
> >>>     "${DISTRO}-${MACHINE}"
> >>> - change folder structure "work/${PN}/${MACHINE}/${DISTRO}" to
> >>>     "work/${DISTRO}-${DISTRO_ARCH}/${PF}"
> >>>      
> >>
> >> No problem, if general approach is Ok, I'm going to split it into
> >> pieces.
> >>  
> >>> More inline.
> >>>
> >>> Am Fri, 8 Sep 2017 12:48:33 +0300
> >>> schrieb Alexander Smirnov <asmirnov@ilbers.de>:
> >>>      
> >>>> Differentiate folders tree, that are generated during build on
> >>>> the highest possible level. So the overal tree now looks like the
> >>>> following:
> >>>>
> >>>>    tmp/${DISTRO}-${DISTRO_ARCH}/${PF}
> >>>>
> >>>> This approach eliminates lots of subfolders to diffirentiate
> >>>> buildchroot and image for multiconfig builds. Now each
> >>>> configuration has private tree.
> >>>>
> >>>> Signed-off-by: Alexander Smirnov <asmirnov@ilbers.de>
> >>>> ---
> >>>>    meta-isar/classes/rpi-sdimg.bbclass              |  2 +-
> >>>>    meta-isar/recipes-core/images/isar-image-base.bb | 19
> >>>> ++++++++----------- meta/classes/ext4-img.bbclass
> >>>> | 10 +++++----- meta/classes/image.bbclass
> >>>> | 12 +++++++----- meta/conf/isar-bitbake.conf
> >>>> |  3 ++- meta/recipes-devtools/buildchroot/buildchroot.bb |  9
> >>>> ++++----- 6 files changed, 27 insertions(+), 28 deletions(-)
> >>>>
> >>>> diff --git a/meta-isar/classes/rpi-sdimg.bbclass
> >>>> b/meta-isar/classes/rpi-sdimg.bbclass index 2614c41..91b09cd
> >>>> 100644 --- a/meta-isar/classes/rpi-sdimg.bbclass
> >>>> +++ b/meta-isar/classes/rpi-sdimg.bbclass
> >>>> @@ -47,7 +47,7 @@ do_rpi_sdimg () {
> >>>>        BOOT_BLOCKS=$(LC_ALL=C parted -s ${SDIMG} unit b print |
> >>>> awk '/ 1 / { print substr($4, 1, length($4 -1)) / 512 /2 }') rm
> >>>> -f ${WORKDIR}/boot.img mkfs.vfat -n "${BOOTDD_VOLUME_ID}" -S 512
> >>>> -C ${WORKDIR}/boot.img $BOOT_BLOCKS
> >>>> -    mcopy -i ${WORKDIR}/boot.img -s ${S}/boot/* ::/
> >>>> +    mcopy -i ${WORKDIR}/boot.img -s ${IMAGE_ROOTFS}/boot/* ::/  
> >>>
> >>> This could be one patch that replaces S with IMAGE_ROOTFS.
> >>>      
> >>
> >> Ok.
> >>  
> >>>>    
> >>>>        # Burn Partitions
> >>>>        dd if=${WORKDIR}/boot.img of=${SDIMG} conv=notrunc seek=1
> >>>> bs=$(expr ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) && sync && sync diff
> >>>> --git a/meta-isar/recipes-core/images/isar-image-base.bb
> >>>> b/meta-isar/recipes-core/images/isar-image-base.bb index
> >>>> b679d97..178ac05 100644 ---
> >>>> a/meta-isar/recipes-core/images/isar-image-base.bb +++
> >>>> b/meta-isar/recipes-core/images/isar-image-base.bb @@ -9,6 +9,7
> >>>> @@ LICENSE = "gpl-2.0" LIC_FILES_CHKSUM =
> >>>> "file://${LAYERDIR_isar}/licenses/COPYING.GPLv2;md5=751419260aa954499f7abaabaa882bbe"
> >>>> PV = "1.0" +PF = "${PN}"
> >>>>    
> >>>>    inherit image
> >>>>    
> >>>> @@ -17,11 +18,7 @@ DEPENDS += "${IMAGE_INSTALL}"
> >>>>    IMAGE_PREINSTALL += "apt \
> >>>>                         dbus"
> >>>>    
> >>>> -WORKDIR = "${TMPDIR}/work/${PN}/${MACHINE}/${DISTRO}"  
> >>>      
> >>>> -S = "${WORKDIR}/rootfs"
> >>>> -IMAGE_ROOTFS = "${S}"  
> >>>
> >>> Part of the S -> IMAGE_ROOTFS
> >>>      
> >>
> >> Ok.
> >>  
> >>>> -
> >>>> -do_rootfs[stamp-extra-info] = "${MACHINE}-${DISTRO}"
> >>>> +do_rootfs[stamp-extra-info] = "${DISTRO}-${MACHINE}"  
> >>>
> >>> This is also a change that should be in a seperate smaller
> >>> patch.  
> >>
> >> Ok.
> >>  
> >>>         
> >>>>    do_rootfs() {
> >>>>        install -d -m 755 ${WORKDIR}/hooks_multistrap
> >>>> @@ -38,20 +35,20 @@ do_rootfs() {
> >>>>        sed -i 's|##DISTRO_APT_SOURCE##|${DISTRO_APT_SOURCE}|'
> >>>> ${WORKDIR}/multistrap.conf sed -i
> >>>> 's|##DISTRO_SUITE##|${DISTRO_SUITE}|' ${WORKDIR}/multistrap.conf
> >>>> sed -i 's|##DISTRO_COMPONENTS##|${DISTRO_COMPONENTS}|'
> >>>> ${WORKDIR}/multistrap.conf
> >>>> -    sed -i
> >>>> 's|##CONFIG_SCRIPT##|./tmp/work/${PN}/${MACHINE}/${DISTRO}/configscript.sh|'
> >>>> ${WORKDIR}/multistrap.conf
> >>>> -    sed -i
> >>>> 's|##SETUP_SCRIPT##|./tmp/work/${PN}/${MACHINE}/${DISTRO}/setup.sh|'
> >>>> ${WORKDIR}/multistrap.conf
> >>>> -    sed -i
> >>>> 's|##DIR_HOOKS##|./tmp/work/${PN}/${MACHINE}/${DISTRO}/hooks_multistrap|'
> >>>> ${WORKDIR}/multistrap.conf
> >>>> +    sed -i
> >>>> 's|##CONFIG_SCRIPT##|./tmp/work/${DISTRO}-${DISTRO_ARCH}/${PF}/configscript.sh|'
> >>>> ${WORKDIR}/multistrap.conf
> >>>> +    sed -i
> >>>> 's|##SETUP_SCRIPT##|./tmp/work/${DISTRO}-${DISTRO_ARCH}/${PF}/setup.sh|'
> >>>> ${WORKDIR}/multistrap.conf
> >>>> +    sed -i
> >>>> 's|##DIR_HOOKS##|./tmp/work/${DISTRO}-${DISTRO_ARCH}/${PF}/hooks_multistrap|'
> >>>> ${WORKDIR}/multistrap.conf # Multistrap config use relative
> >>>> paths, so ensure that we are in the right folder cd ${TOPDIR}
> >>>>    
> >>>>        # Create root filesystem
> >>>> -    sudo multistrap -a ${DISTRO_ARCH} -d "${S}" -f
> >>>> "${WORKDIR}/multistrap.conf" || true
> >>>> +    sudo multistrap -a ${DISTRO_ARCH} -d "${IMAGE_ROOTFS}" -f
> >>>> "${WORKDIR}/multistrap.conf" || true
> >>>>        # Configure root filesystem
> >>>> -    sudo chroot ${S} /configscript.sh ${MACHINE_SERIAL}
> >>>> ${BAUDRATE_TTY} \
> >>>> +    sudo chroot ${IMAGE_ROOTFS} /configscript.sh
> >>>> ${MACHINE_SERIAL} ${BAUDRATE_TTY} \ ${ROOTFS_DEV}
> >>>> -    sudo rm ${S}/configscript.sh
> >>>> +    sudo rm ${IMAGE_ROOTFS}/configscript.sh
> >>>>    }
> >>>>    
> >>>>    addtask rootfs before do_populate
> >>>> diff --git a/meta/classes/ext4-img.bbclass
> >>>> b/meta/classes/ext4-img.bbclass index 8588626..9af781f 100644
> >>>> --- a/meta/classes/ext4-img.bbclass
> >>>> +++ b/meta/classes/ext4-img.bbclass
> >>>> @@ -6,7 +6,7 @@ ROOTFS_EXTRA ?= "64"
> >>>>    
> >>>>    EXT4_IMAGE_FILE =
> >>>> "${DEPLOY_DIR_IMAGE}/${PN}-${MACHINE}-${DISTRO}.ext4.img"
> >>>> -do_ext4_image[stamp-extra-info] = "${MACHINE}-${DISTRO}"
> >>>> +do_ext4_image[stamp-extra-info] = "${DISTRO}-${MACHINE}"
> >>>>    
> >>>>    # Generate ext4 filesystem image
> >>>>    do_ext4_image() {
> >>>> @@ -14,23 +14,23 @@ do_ext4_image() {
> >>>>    
> >>>>        rm -f ${EXT4_IMAGE_FILE}
> >>>>    
> >>>> -    ROOTFS_SIZE=`sudo du -sm ${S} |  awk '{print $1 +
> >>>> ${ROOTFS_EXTRA};}'`
> >>>> +    ROOTFS_SIZE=`sudo du -sm ${IMAGE_ROOTFS} |  awk '{print $1 +
> >>>> ${ROOTFS_EXTRA};}'` dd if=/dev/zero of=${EXT4_IMAGE_FILE} bs=1M
> >>>> count=${ROOTFS_SIZE}
> >>>>
> >>>>        sudo mkfs.ext4 -F ${EXT4_IMAGE_FILE}
> >>>>    
> >>>>        mkdir -p ${WORKDIR}/mnt
> >>>>        sudo mount -o loop ${EXT4_IMAGE_FILE} ${WORKDIR}/mnt
> >>>> -    sudo cp -r ${S}/* ${WORKDIR}/mnt
> >>>> +    sudo cp -r ${IMAGE_ROOTFS}/* ${WORKDIR}/mnt
> >>>>        sudo umount ${WORKDIR}/mnt
> >>>>        rm -r ${WORKDIR}/mnt
> >>>>    
> >>>>        if [ -n "${KERNEL_IMAGE}" ]; then
> >>>> -        cp ${S}/boot/${KERNEL_IMAGE} ${DEPLOY_DIR_IMAGE}
> >>>> +        cp ${IMAGE_ROOTFS}/boot/${KERNEL_IMAGE}
> >>>> ${DEPLOY_DIR_IMAGE} fi
> >>>>    
> >>>>        if [ -n "${INITRD_IMAGE}" ]; then
> >>>> -        cp ${S}/boot/${INITRD_IMAGE} ${DEPLOY_DIR_IMAGE}
> >>>> +        cp ${IMAGE_ROOTFS}/boot/${INITRD_IMAGE}
> >>>> ${DEPLOY_DIR_IMAGE} fi
> >>>>    }
> >>>>    
> >>>> diff --git a/meta/classes/image.bbclass
> >>>> b/meta/classes/image.bbclass index a7f0d74..fe06352 100644
> >>>> --- a/meta/classes/image.bbclass
> >>>> +++ b/meta/classes/image.bbclass
> >>>> @@ -9,20 +9,22 @@ IMAGE_TYPE    ?= "ext4-img"
> >>>>    
> >>>>    inherit ${IMAGE_TYPE}
> >>>>    
> >>>> -do_populate[stamp-extra-info] = "${MACHINE}-${DISTRO}"
> >>>> +IMAGE_ROOTFS = "${WORKDIR}/rootfs"
> >>>> +
> >>>> +do_populate[stamp-extra-info] = "${DISTRO}-${MACHINE}"
> >>>>    
> >>>>    # Install Debian packages, that were built from sources
> >>>>    do_populate() {
> >>>>        if [ -n "${IMAGE_INSTALL}" ]; then
> >>>> -        sudo mkdir -p ${S}/deb
> >>>> +        sudo mkdir -p ${IMAGE_ROOTFS}/deb
> >>>>    
> >>>>            for p in ${IMAGE_INSTALL}; do
> >>>> -            sudo cp ${DEPLOY_DIR_DEB}/${p}_*.deb ${S}/deb
> >>>> +            sudo cp ${DEPLOY_DIR_DEB}/${p}_*.deb
> >>>> ${IMAGE_ROOTFS}/deb done
> >>>>    
> >>>> -        sudo chroot ${S} /usr/bin/dpkg -i -R /deb
> >>>> +        sudo chroot ${IMAGE_ROOTFS} /usr/bin/dpkg -i -R /deb
> >>>>    
> >>>> -        sudo rm -rf ${S}/deb
> >>>> +        sudo rm -rf ${IMAGE_ROOTFS}/deb
> >>>>        fi
> >>>>    }
> >>>>    
> >>>> diff --git a/meta/conf/isar-bitbake.conf
> >>>> b/meta/conf/isar-bitbake.conf index f85f5cc..5a26743 100644
> >>>> --- a/meta/conf/isar-bitbake.conf
> >>>> +++ b/meta/conf/isar-bitbake.conf
> >>>> @@ -18,9 +18,10 @@
> >>>>    # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
> >>>> THE USE OR # OTHER DEALINGS IN THE SOFTWARE.
> >>>>    
> >>>> +WORKDIR = "${TMPDIR}/work/${DISTRO}-${DISTRO_ARCH}/${PF}"
> >>>>    DEPLOY_DIR_DEB = "${TMPDIR}/deploy/deb/${MACHINE}"
> >>>>    SSTATE_DIR ?= "${TMPDIR}/sstate-cache"
> >>>> -BUILDCHROOT_DIR =
> >>>> "${TOPDIR}/tmp/work/buildchroot/${DISTRO}-${DISTRO_ARCH}/rootfs"
> >>>> +BUILDCHROOT_DIR =
> >>>> "${TMPDIR}/work/${DISTRO}-${DISTRO_ARCH}/buildchroot/rootfs" #
> >>>> Setup our default hash policy BB_SIGNATURE_HANDLER ?= "noop"
> >>>> diff --git a/meta/recipes-devtools/buildchroot/buildchroot.bb
> >>>> b/meta/recipes-devtools/buildchroot/buildchroot.bb index
> >>>> ccba683..155bd3f 100644 ---
> >>>> a/meta/recipes-devtools/buildchroot/buildchroot.bb +++
> >>>> b/meta/recipes-devtools/buildchroot/buildchroot.bb @@ -9,6 +9,7
> >>>> @@ LICENSE = "gpl-2.0" LIC_FILES_CHKSUM =
> >>>> "file://${LAYERDIR_isar}/licenses/COPYING.GPLv2;md5=751419260aa954499f7abaabaa882bbe"
> >>>>    PV = "1.0"
> >>>> +PF = "${PN}"  
> >>>
> >>> I think this is to remove the package version from WORKDIR, i
> >>> suggest to do WORKDIR= instead of overwriting such an essential
> >>> variable. Writing to PF will i.e. also affect FILESPATH and STAMP.
> >>> This line deserves a comment!  
> >>
> >> I'm still thinking about this...
> >>
> >> My idea is that buildchroot and image recipes don't need version at
> >> all, because there is no source code provider, that could track the
> >> code revision. The line:
> >>
> >>    PV = "1.0"
> >>
> >> is confusing and makes really no sense, I can't imagine by which
> >> event it should be updated. Any changes in this recipe should be
> >> reflected in whole Isar version update. So the proposal is to drop
> >> it, but by dropping it we will get broken ${PF} variable, it will
> >> look like: "buildchroot-".
> >>
> >> So, the desired goal - to have buildchroot and image WORKDIRs
> >> without version suffixes:
> >>
> >> 1. If drop PV, the PF should be updated
> >> 2. If do not drop PV, WORKDIR should be updated
> >>  
> >>>      
> >>>>    
> >>>>    BUILDCHROOT_PREINSTALL ?= "gcc \
> >>>>                               make \
> >>>> @@ -21,8 +22,6 @@ BUILDCHROOT_PREINSTALL ?= "gcc \
> >>>>                               apt \
> >>>>                               automake"
> >>>>    
> >>>> -WORKDIR = "${TMPDIR}/work/${PF}/${DISTRO}"
> >>>> -
> >>>>    do_build[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}"
> >>>>    
> >>>>    do_build() {
> >>>> @@ -40,9 +39,9 @@ do_build() {
> >>>>        sed -i 's|##DISTRO_APT_SOURCE##|${DISTRO_APT_SOURCE}|'
> >>>> ${WORKDIR}/multistrap.conf sed -i
> >>>> 's|##DISTRO_SUITE##|${DISTRO_SUITE}|' ${WORKDIR}/multistrap.conf
> >>>> sed -i 's|##DISTRO_COMPONENTS##|${DISTRO_COMPONENTS}|'
> >>>> ${WORKDIR}/multistrap.conf
> >>>> -    sed -i
> >>>> 's|##CONFIG_SCRIPT##|./tmp/work/${PF}/${DISTRO}/configscript.sh|'
> >>>> ${WORKDIR}/multistrap.conf
> >>>> -    sed -i
> >>>> 's|##SETUP_SCRIPT##|./tmp/work/${PF}/${DISTRO}/setup.sh|'
> >>>> ${WORKDIR}/multistrap.conf
> >>>> -    sed -i
> >>>> 's|##DIR_HOOKS##|./tmp/work/${PF}/${DISTRO}/hooks_multistrap|'
> >>>> ${WORKDIR}/multistrap.conf
> >>>> +    sed -i
> >>>> 's|##CONFIG_SCRIPT##|./tmp/work/${DISTRO}-${DISTRO_ARCH}/${PF}/configscript.sh|'
> >>>> ${WORKDIR}/multistrap.conf
> >>>> +    sed -i
> >>>> 's|##SETUP_SCRIPT##|./tmp/work/${DISTRO}-${DISTRO_ARCH}/${PF}/setup.sh|'
> >>>> ${WORKDIR}/multistrap.conf
> >>>> +    sed -i
> >>>> 's|##DIR_HOOKS##|./tmp/work/${DISTRO}-${DISTRO_ARCH}/${PF}/hooks_multistrap|'
> >>>> ${WORKDIR}/multistrap.conf  
> >>>
> >>> The pattern tmp/work/${DISTRO}-${DISTRO_ARCH}/${PF}/ shows up all
> >>> the time, can that be derived from $WORKDIR instead of writing it
> >>> down again and again?  
> >>
> >> That's mad, but mulstistrap understands relative paths only. Any
> >> attempt to replace it by absolute path lead to errors. That's why
> >> it was done in this way, because WORKDIR is absolute path. :-(  
> > 
> > Ok. Could this not be fixed with something like the following in
> > isar-bitbake.conf:
> > 
> > WORKDIR_SUFFIX=${DISTRO}-${DISTRO_ARCH}/${PF}
> > WORKDIR=${WORKDIR}/${WORKDIR_SUFFIX}  
> 
> Does this line correct? After concatenation there will be line:
> 
>    ${TMPDIR}/work/${PF}/${DISTRO}-${DISTRO_ARCH}/${PF}

Yes you are probably right, it was just an example i never tried.

> I assume it's not the one you want...
> 
> Due to we need eventually whole path:
> 
>    ./tmp/work/${DISTRO}-${DISTRO_ARCH}/${PF}
> 
> we could a bit change your proposal:
> 
> WORKDIR_RELATIVE=tmp/work/${DISTRO}-${DISTRO_ARCH}/${PF}
> WORKDIR=${TOPDIR}/${WORKDIR_RELATIVE}
> 
> so the pattern for multistrap will be: ./${WORKDIR_RELATIVE}
>
> what do you think?

Whatever works so we write "${DISTRO}-${DISTRO_ARCH}/${PF}" in just one
place and derive from it later.
Your suggestion sounds good.

Henning

> 
> Alex
> 
> > and now you can use WORKDIR_SUFFIX in all these lines. Such a change
> > should probably be its own patch.
> > 
> > Henning
> >   
> >> Alex
> >>  
> >>>      
> >>>> # Multistrap config use relative paths, so
> >>>> ensure that we are in the right folder cd ${TOPDIR}  
> >>>      
> >   
> 


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

* Re: [PATCH 1/2] isar: Change build folders tree
  2017-09-08 12:36     ` Alexander Smirnov
  2017-09-08 12:59       ` Henning Schild
  2017-09-08 13:07       ` Henning Schild
@ 2017-09-09  9:39       ` Claudius Heine
  2017-09-11  7:28         ` Alexander Smirnov
  2 siblings, 1 reply; 15+ messages in thread
From: Claudius Heine @ 2017-09-09  9:39 UTC (permalink / raw)
  To: Alexander Smirnov, Henning Schild; +Cc: isar-users

[-- Attachment #1: Type: text/plain, Size: 2497 bytes --]

Hi,

On Fri, 2017-09-08 at 15:36 +0300, Alexander Smirnov wrote:
> > >    
> > >    BUILDCHROOT_PREINSTALL ?= "gcc \
> > >                               make \
> > > @@ -21,8 +22,6 @@ BUILDCHROOT_PREINSTALL ?= "gcc \
> > >                               apt \
> > >                               automake"
> > >    
> > > -WORKDIR = "${TMPDIR}/work/${PF}/${DISTRO}"
> > > -
> > >    do_build[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}"
> > >    
> > >    do_build() {
> > > @@ -40,9 +39,9 @@ do_build() {
> > >        sed -i 's|##DISTRO_APT_SOURCE##|${DISTRO_APT_SOURCE}|'
> > > ${WORKDIR}/multistrap.conf sed -i
> > > 's|##DISTRO_SUITE##|${DISTRO_SUITE}|' ${WORKDIR}/multistrap.conf
> > > sed
> > > -i 's|##DISTRO_COMPONENTS##|${DISTRO_COMPONENTS}|'
> > > ${WORKDIR}/multistrap.conf
> > > -    sed -i
> > > 's|##CONFIG_SCRIPT##|./tmp/work/${PF}/${DISTRO}/configscript.sh|'
> > > ${WORKDIR}/multistrap.conf
> > > -    sed -i
> > > 's|##SETUP_SCRIPT##|./tmp/work/${PF}/${DISTRO}/setup.sh|'
> > > ${WORKDIR}/multistrap.conf
> > > -    sed -i
> > > 's|##DIR_HOOKS##|./tmp/work/${PF}/${DISTRO}/hooks_multistrap|'
> > > ${WORKDIR}/multistrap.conf
> > > +    sed -i
> > > 's|##CONFIG_SCRIPT##|./tmp/work/${DISTRO}-
> > > ${DISTRO_ARCH}/${PF}/configscript.sh|'
> > > ${WORKDIR}/multistrap.conf
> > > +    sed -i
> > > 's|##SETUP_SCRIPT##|./tmp/work/${DISTRO}-
> > > ${DISTRO_ARCH}/${PF}/setup.sh|'
> > > ${WORKDIR}/multistrap.conf
> > > +    sed -i
> > > 's|##DIR_HOOKS##|./tmp/work/${DISTRO}-
> > > ${DISTRO_ARCH}/${PF}/hooks_multistrap|'
> > > ${WORKDIR}/multistrap.conf
> > 
> > The pattern tmp/work/${DISTRO}-${DISTRO_ARCH}/${PF}/ shows up all
> > the
> > time, can that be derived from $WORKDIR instead of writing it down
> > again and again?
> 
> That's mad, but mulstistrap understands relative paths only. Any
> attempt 
> to replace it by absolute path lead to errors. That's why it was done
> in 
> this way, because WORKDIR is absolute path. :-(

If only multistrap cannot deal with absolute paths, why not use
`os.path.relpath` in these instances?

Cheers,
Claudius

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-54 Fax: (+49)-8142-66989-80 Email: ch@denx.de

            PGP key: 6FF2 E59F 00C6 BC28 31D8 64C1 1173 CB19 9808 B153
                              Keyserver: hkp://pool.sks-keyservers.net

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH 1/2] isar: Change build folders tree
  2017-09-09  9:39       ` Claudius Heine
@ 2017-09-11  7:28         ` Alexander Smirnov
  0 siblings, 0 replies; 15+ messages in thread
From: Alexander Smirnov @ 2017-09-11  7:28 UTC (permalink / raw)
  To: Claudius Heine, Henning Schild; +Cc: isar-users



On 09/09/2017 12:39 PM, Claudius Heine wrote:
> Hi,
> 
> On Fri, 2017-09-08 at 15:36 +0300, Alexander Smirnov wrote:
>>>>     
>>>>     BUILDCHROOT_PREINSTALL ?= "gcc \
>>>>                                make \
>>>> @@ -21,8 +22,6 @@ BUILDCHROOT_PREINSTALL ?= "gcc \
>>>>                                apt \
>>>>                                automake"
>>>>     
>>>> -WORKDIR = "${TMPDIR}/work/${PF}/${DISTRO}"
>>>> -
>>>>     do_build[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}"
>>>>     
>>>>     do_build() {
>>>> @@ -40,9 +39,9 @@ do_build() {
>>>>         sed -i 's|##DISTRO_APT_SOURCE##|${DISTRO_APT_SOURCE}|'
>>>> ${WORKDIR}/multistrap.conf sed -i
>>>> 's|##DISTRO_SUITE##|${DISTRO_SUITE}|' ${WORKDIR}/multistrap.conf
>>>> sed
>>>> -i 's|##DISTRO_COMPONENTS##|${DISTRO_COMPONENTS}|'
>>>> ${WORKDIR}/multistrap.conf
>>>> -    sed -i
>>>> 's|##CONFIG_SCRIPT##|./tmp/work/${PF}/${DISTRO}/configscript.sh|'
>>>> ${WORKDIR}/multistrap.conf
>>>> -    sed -i
>>>> 's|##SETUP_SCRIPT##|./tmp/work/${PF}/${DISTRO}/setup.sh|'
>>>> ${WORKDIR}/multistrap.conf
>>>> -    sed -i
>>>> 's|##DIR_HOOKS##|./tmp/work/${PF}/${DISTRO}/hooks_multistrap|'
>>>> ${WORKDIR}/multistrap.conf
>>>> +    sed -i
>>>> 's|##CONFIG_SCRIPT##|./tmp/work/${DISTRO}-
>>>> ${DISTRO_ARCH}/${PF}/configscript.sh|'
>>>> ${WORKDIR}/multistrap.conf
>>>> +    sed -i
>>>> 's|##SETUP_SCRIPT##|./tmp/work/${DISTRO}-
>>>> ${DISTRO_ARCH}/${PF}/setup.sh|'
>>>> ${WORKDIR}/multistrap.conf
>>>> +    sed -i
>>>> 's|##DIR_HOOKS##|./tmp/work/${DISTRO}-
>>>> ${DISTRO_ARCH}/${PF}/hooks_multistrap|'
>>>> ${WORKDIR}/multistrap.conf
>>>
>>> The pattern tmp/work/${DISTRO}-${DISTRO_ARCH}/${PF}/ shows up all
>>> the
>>> time, can that be derived from $WORKDIR instead of writing it down
>>> again and again?
>>
>> That's mad, but mulstistrap understands relative paths only. Any
>> attempt
>> to replace it by absolute path lead to errors. That's why it was done
>> in
>> this way, because WORKDIR is absolute path. :-(
> 
> If only multistrap cannot deal with absolute paths, why not use
> `os.path.relpath` in these instances?


Didn't know about this, let me try...

Alex

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

* Re: [PATCH 1/2] isar: Change build folders tree
  2017-09-08  9:48 ` [PATCH 1/2] isar: Change build folders tree Alexander Smirnov
  2017-09-08 11:47   ` Henning Schild
@ 2017-09-11  8:27   ` Claudius Heine
  2017-09-11  8:41     ` Alexander Smirnov
  1 sibling, 1 reply; 15+ messages in thread
From: Claudius Heine @ 2017-09-11  8:27 UTC (permalink / raw)
  To: Alexander Smirnov, isar-users

Hi,

On 09/08/2017 11:48 AM, Alexander Smirnov wrote:
> @@ -40,9 +39,9 @@ do_build() {
>       sed -i 's|##DISTRO_APT_SOURCE##|${DISTRO_APT_SOURCE}|' ${WORKDIR}/multistrap.conf
>       sed -i 's|##DISTRO_SUITE##|${DISTRO_SUITE}|' ${WORKDIR}/multistrap.conf
>       sed -i 's|##DISTRO_COMPONENTS##|${DISTRO_COMPONENTS}|' ${WORKDIR}/multistrap.conf
> -    sed -i 's|##CONFIG_SCRIPT##|./tmp/work/${PF}/${DISTRO}/configscript.sh|' ${WORKDIR}/multistrap.conf
> -    sed -i 's|##SETUP_SCRIPT##|./tmp/work/${PF}/${DISTRO}/setup.sh|' ${WORKDIR}/multistrap.conf
> -    sed -i 's|##DIR_HOOKS##|./tmp/work/${PF}/${DISTRO}/hooks_multistrap|' ${WORKDIR}/multistrap.conf
> +    sed -i 's|##CONFIG_SCRIPT##|./tmp/work/${DISTRO}-${DISTRO_ARCH}/${PF}/configscript.sh|' ${WORKDIR}/multistrap.conf
> +    sed -i 's|##SETUP_SCRIPT##|./tmp/work/${DISTRO}-${DISTRO_ARCH}/${PF}/setup.sh|' ${WORKDIR}/multistrap.conf
> +    sed -i 's|##DIR_HOOKS##|./tmp/work/${DISTRO}-${DISTRO_ARCH}/${PF}/hooks_multistrap|' ${WORKDIR}/multistrap.conf

Since you are touching this part in this patch series. Can you clean 
this up a bit in a seperate patch?

Something like this just looks so much nicer, don't you agree?

   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##|./tmp/work/${PN}/${MACHINE}/configscript.sh|g' \
       -e 's|##SETUP_SCRIPT##|${WORKDIR}/setup.sh|g' \
       -e 's|##DIR_HOOKS##|./tmp/work/${PN}/${MACHINE}/hooks_multistrap|g' \
          ${WORKDIR}/multistrap.conf.in > ${WORKDIR}/multistrap.conf

Of course you have to fit that to your code here.

Thanks.

Cheers,
Claudius

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-54 Fax: (+49)-8142-66989-80 Email: ch@denx.de

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

* Re: [PATCH 1/2] isar: Change build folders tree
  2017-09-11  8:27   ` Claudius Heine
@ 2017-09-11  8:41     ` Alexander Smirnov
  0 siblings, 0 replies; 15+ messages in thread
From: Alexander Smirnov @ 2017-09-11  8:41 UTC (permalink / raw)
  To: Claudius Heine, isar-users

On 09/11/2017 11:27 AM, Claudius Heine wrote:
> Hi,
> 
> On 09/08/2017 11:48 AM, Alexander Smirnov wrote:
>> @@ -40,9 +39,9 @@ do_build() {
>>       sed -i 's|##DISTRO_APT_SOURCE##|${DISTRO_APT_SOURCE}|' 
>> ${WORKDIR}/multistrap.conf
>>       sed -i 's|##DISTRO_SUITE##|${DISTRO_SUITE}|' 
>> ${WORKDIR}/multistrap.conf
>>       sed -i 's|##DISTRO_COMPONENTS##|${DISTRO_COMPONENTS}|' 
>> ${WORKDIR}/multistrap.conf
>> -    sed -i 
>> 's|##CONFIG_SCRIPT##|./tmp/work/${PF}/${DISTRO}/configscript.sh|' 
>> ${WORKDIR}/multistrap.conf
>> -    sed -i 's|##SETUP_SCRIPT##|./tmp/work/${PF}/${DISTRO}/setup.sh|' 
>> ${WORKDIR}/multistrap.conf
>> -    sed -i 
>> 's|##DIR_HOOKS##|./tmp/work/${PF}/${DISTRO}/hooks_multistrap|' 
>> ${WORKDIR}/multistrap.conf
>> +    sed -i 
>> 's|##CONFIG_SCRIPT##|./tmp/work/${DISTRO}-${DISTRO_ARCH}/${PF}/configscript.sh|' 
>> ${WORKDIR}/multistrap.conf
>> +    sed -i 
>> 's|##SETUP_SCRIPT##|./tmp/work/${DISTRO}-${DISTRO_ARCH}/${PF}/setup.sh|' 
>> ${WORKDIR}/multistrap.conf
>> +    sed -i 
>> 's|##DIR_HOOKS##|./tmp/work/${DISTRO}-${DISTRO_ARCH}/${PF}/hooks_multistrap|' 
>> ${WORKDIR}/multistrap.conf
> 
> Since you are touching this part in this patch series. Can you clean 
> this up a bit in a seperate patch?
> 
> Something like this just looks so much nicer, don't you agree?
> 
>    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##|./tmp/work/${PN}/${MACHINE}/configscript.sh|g' \
>        -e 's|##SETUP_SCRIPT##|${WORKDIR}/setup.sh|g' \
>        -e 
> 's|##DIR_HOOKS##|./tmp/work/${PN}/${MACHINE}/hooks_multistrap|g' \
>           ${WORKDIR}/multistrap.conf.in > ${WORKDIR}/multistrap.conf
> 
> Of course you have to fit that to your code here.

This series is outdated. Please comment on v2.

Alex

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

end of thread, other threads:[~2017-09-11  8:41 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-08  9:48 [PATCH 0/2] Unify work space for packages Alexander Smirnov
2017-09-08  9:48 ` [PATCH 1/2] isar: Change build folders tree Alexander Smirnov
2017-09-08 11:47   ` Henning Schild
2017-09-08 12:36     ` Alexander Smirnov
2017-09-08 12:59       ` Henning Schild
2017-09-08 13:07       ` Henning Schild
2017-09-08 13:20         ` Alexander Smirnov
2017-09-08 13:36           ` Henning Schild
2017-09-09  9:39       ` Claudius Heine
2017-09-11  7:28         ` Alexander Smirnov
2017-09-11  8:27   ` Claudius Heine
2017-09-11  8:41     ` Alexander Smirnov
2017-09-08  9:48 ` [PATCH 2/2] class/dpkg: Unify workplace for packages Alexander Smirnov
2017-09-08 11:29   ` Henning Schild
2017-09-08 10:01 ` [PATCH 0/2] Unify work space " Alexander Smirnov

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