public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Alexander Smirnov <asmirnov@ilbers.de>
To: isar-users@googlegroups.com
Cc: Alexander Smirnov <asmirnov@ilbers.de>
Subject: [PATCH v3 2/5] isar: Change build folders tree
Date: Tue, 12 Sep 2017 10:57:12 +0300	[thread overview]
Message-ID: <20170912075712.5788-1-asmirnov@ilbers.de> (raw)
In-Reply-To: <20170911192738.1323-3-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/work/${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/recipes-core/images/isar-image-base.bb | 26 +++++++++++++-----------
 meta/conf/isar-bitbake.conf                      |  3 ++-
 meta/recipes-devtools/buildchroot/buildchroot.bb | 26 +++++++++++++-----------
 3 files changed, 30 insertions(+), 25 deletions(-)

diff --git a/meta-isar/recipes-core/images/isar-image-base.bb b/meta-isar/recipes-core/images/isar-image-base.bb
index 94cbc9e..5cb8b1c 100644
--- a/meta-isar/recipes-core/images/isar-image-base.bb
+++ b/meta-isar/recipes-core/images/isar-image-base.bb
@@ -17,7 +17,7 @@ DEPENDS += "${IMAGE_INSTALL}"
 IMAGE_PREINSTALL += "apt \
                      dbus"
 
-WORKDIR = "${TMPDIR}/work/${PN}/${MACHINE}/${DISTRO}"
+WORKDIR = "${TMPDIR}/work/${DISTRO}-${DISTRO_ARCH}/${PN}"
 
 do_rootfs[stamp-extra-info] = "${MACHINE}-${DISTRO}"
 
@@ -30,18 +30,20 @@ do_rootfs() {
     install -m 755 ${THISDIR}/files/setup.sh ${WORKDIR}
     install -m 755 ${THISDIR}/files/download_dev-random ${WORKDIR}/hooks_multistrap/
 
-    # Adjust multistrap config
-    sed -i 's|##IMAGE_PREINSTALL##|${IMAGE_PREINSTALL}|' ${WORKDIR}/multistrap.conf
-    sed -i 's|##DISTRO##|${DISTRO}|' ${WORKDIR}/multistrap.conf
-    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
-
-    # Multistrap config use relative paths, so ensure that we are in the right folder
+    # Multistrap accepts only relative path in configuration files, so get it:
     cd ${TOPDIR}
+    WORKDIR_REL=${@ os.path.relpath(d.getVar("WORKDIR", True))}
+
+    # Adjust multistrap config
+    sed -i -e 's|##IMAGE_PREINSTALL##|${IMAGE_PREINSTALL}|g' \
+           -e 's|##DISTRO##|${DISTRO}|g' \
+           -e 's|##DISTRO_APT_SOURCE##|${DISTRO_APT_SOURCE}|g' \
+           -e 's|##DISTRO_SUITE##|${DISTRO_SUITE}|g' \
+           -e 's|##DISTRO_COMPONENTS##|${DISTRO_COMPONENTS}|g' \
+           -e 's|##CONFIG_SCRIPT##|./'"$WORKDIR_REL"'/configscript.sh|g' \
+           -e 's|##SETUP_SCRIPT##|./'"$WORKDIR_REL"'/setup.sh|g' \
+           -e 's|##DIR_HOOKS##|./'"$WORKDIR_REL"'/hooks_multistrap|g' \
+              ${WORKDIR}/multistrap.conf
 
     # Create root filesystem
     sudo multistrap -a ${DISTRO_ARCH} -d "${IMAGE_ROOTFS}" -f "${WORKDIR}/multistrap.conf" || true
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..30039f2 100644
--- a/meta/recipes-devtools/buildchroot/buildchroot.bb
+++ b/meta/recipes-devtools/buildchroot/buildchroot.bb
@@ -21,7 +21,7 @@ BUILDCHROOT_PREINSTALL ?= "gcc \
                            apt \
                            automake"
 
-WORKDIR = "${TMPDIR}/work/${PF}/${DISTRO}"
+WORKDIR = "${TMPDIR}/work/${DISTRO}-${DISTRO_ARCH}/${PN}"
 
 do_build[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}"
 
@@ -34,18 +34,20 @@ do_build() {
     install -m 755 ${THISDIR}/files/setup.sh ${WORKDIR}
     install -m 755 ${THISDIR}/files/download_dev-random ${WORKDIR}/hooks_multistrap/
 
-    # Adjust multistrap config
-    sed -i 's|##BUILDCHROOT_PREINSTALL##|${BUILDCHROOT_PREINSTALL}|' ${WORKDIR}/multistrap.conf
-    sed -i 's|##DISTRO##|${DISTRO}|' ${WORKDIR}/multistrap.conf
-    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
-
-    # Multistrap config use relative paths, so ensure that we are in the right folder
+    # Multistrap accepts only relative path in configuration files, so get it:
     cd ${TOPDIR}
+    WORKDIR_REL=${@ os.path.relpath(d.getVar("WORKDIR", True))}
+
+    # Adjust multistrap config
+    sed -i -e 's|##BUILDCHROOT_PREINSTALL##|${BUILDCHROOT_PREINSTALL}|g' \
+           -e 's|##DISTRO##|${DISTRO}|g' \
+           -e 's|##DISTRO_APT_SOURCE##|${DISTRO_APT_SOURCE}|g' \
+           -e 's|##DISTRO_SUITE##|${DISTRO_SUITE}|g' \
+           -e 's|##DISTRO_COMPONENTS##|${DISTRO_COMPONENTS}|g' \
+           -e 's|##CONFIG_SCRIPT##|./'"$WORKDIR_REL"'/configscript.sh|g' \
+           -e 's|##SETUP_SCRIPT##|./'"$WORKDIR_REL"'/setup.sh|g' \
+           -e 's|##DIR_HOOKS##|./'"$WORKDIR_REL"'/hooks_multistrap|g' \
+              ${WORKDIR}/multistrap.conf
 
     # Create root filesystem
     sudo multistrap -a ${DISTRO_ARCH} -d "${BUILDCHROOT_DIR}" -f "${WORKDIR}/multistrap.conf" || true
-- 
2.1.4


  parent reply	other threads:[~2017-09-12  7:57 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-11 19:27 [PATCH v3 0/5] Unify work space for packages Alexander Smirnov
2017-09-11 19:27 ` [PATCH v3 1/5] image: Unify path to image rootfs Alexander Smirnov
2017-09-11 19:27 ` [PATCH v3 2/5] isar: Change build folders tree Alexander Smirnov
2017-09-12  7:23   ` Claudius Heine
2017-09-12  7:57   ` Alexander Smirnov [this message]
2017-09-12 12:52   ` Henning Schild
2017-09-12 13:02     ` Alexander Smirnov
2017-09-11 19:27 ` [PATCH v3 3/5] stamps: Name stamps canonicaly and unified Alexander Smirnov
2017-09-11 19:27 ` [PATCH v3 4/5] image: Name image " Alexander Smirnov
2017-09-11 19:27 ` [PATCH v3 5/5] class/dpkg: Unify workplace for packages Alexander Smirnov
2017-09-12 14:26 ` [PATCH] doc: Update technical overview Alexander Smirnov

Reply instructions:

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

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

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

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

  git send-email \
    --in-reply-to=20170912075712.5788-1-asmirnov@ilbers.de \
    --to=asmirnov@ilbers.de \
    --cc=isar-users@googlegroups.com \
    /path/to/YOUR_REPLY

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

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