From: Alexander Smirnov <asmirnov@ilbers.de>
To: isar-users@googlegroups.com
Cc: Alexander Smirnov <asmirnov@ilbers.de>
Subject: [RFC][PATCH 4/6] buildchroot: Add mount/umount for 'base-apt'
Date: Tue, 2 Jan 2018 17:57:42 +0300 [thread overview]
Message-ID: <20180102145744.21814-5-asmirnov@ilbers.de> (raw)
In-Reply-To: <20180102145744.21814-1-asmirnov@ilbers.de>
'base-apt' should be avaialble in buildchroot to have possibility
to install build dependencies for packages being built. Mounting is
performed in dedicated task buildchroot:do_prepare. To implement
umounting, the bitbake events are used. This patch registers handler
for build complete event which performs cleanup.
Signed-off-by: Alexander Smirnov <asmirnov@ilbers.de>
---
meta-isar/conf/local.conf.sample | 3 +++
meta/classes/dpkg-base.bbclass | 2 +-
meta/classes/isar-events.bbclass | 21 +++++++++++++++++++++
meta/recipes-devtools/buildchroot/buildchroot.bb | 11 +++++++++++
4 files changed, 36 insertions(+), 1 deletion(-)
create mode 100644 meta/classes/isar-events.bbclass
diff --git a/meta-isar/conf/local.conf.sample b/meta-isar/conf/local.conf.sample
index 2da803b..acced81 100644
--- a/meta-isar/conf/local.conf.sample
+++ b/meta-isar/conf/local.conf.sample
@@ -167,3 +167,6 @@ REPREPRO_LOCK_ATTEMPTS = "16"
# List of images, wich dependencies will be pre-fetched and put in base-apt.
# This will guarantee image building reproducibility.
BASE_APT_IMAGES ?= "isar-image-base isar-image-debug"
+
+# Add event handlers for bitbake
+INHERIT += "isar-events"
diff --git a/meta/classes/dpkg-base.bbclass b/meta/classes/dpkg-base.bbclass
index c61f9a6..bc8fab8 100644
--- a/meta/classes/dpkg-base.bbclass
+++ b/meta/classes/dpkg-base.bbclass
@@ -2,7 +2,7 @@
# Copyright (C) 2017 Siemens AG
# Add dependency from buildchroot creation
-do_build[depends] = "buildchroot:do_build"
+do_build[depends] = "buildchroot:do_prepare"
# Each package should have its own unique build folder, so use
# recipe name as identifier
diff --git a/meta/classes/isar-events.bbclass b/meta/classes/isar-events.bbclass
new file mode 100644
index 0000000..6ccda99
--- /dev/null
+++ b/meta/classes/isar-events.bbclass
@@ -0,0 +1,21 @@
+# Isar event handlers.
+#
+# This software is a part of ISAR.
+# Copyright (C) 2015-2017 ilbers GmbH
+
+addhandler isar_handler
+
+python isar_handler () {
+ import subprocess
+
+ devnull = open(os.devnull, 'w')
+
+ if isinstance(e, bb.event.BuildCompleted):
+ bchroot = d.getVar('BUILDCHROOT_DIR', True)
+
+ # Clean up buildchroot
+ subprocess.call('/usr/bin/sudo /bin/umount ' + bchroot + '/proc || /bin/true', stdout=devnull, stderr=devnull, shell=True)
+ subprocess.call('/usr/bin/sudo /bin/umount ' + bchroot + '/apt || /bin/true', stdout=devnull, stderr=devnull, shell=True)
+
+ devnull.close()
+}
diff --git a/meta/recipes-devtools/buildchroot/buildchroot.bb b/meta/recipes-devtools/buildchroot/buildchroot.bb
index 4d773f9..1fad2f8 100644
--- a/meta/recipes-devtools/buildchroot/buildchroot.bb
+++ b/meta/recipes-devtools/buildchroot/buildchroot.bb
@@ -80,7 +80,18 @@ do_build() {
# Install package builder script
sudo install -m 755 ${WORKDIR}/build.sh ${BUILDCHROOT_DIR}
+ # Create share point for apt
+ sudo install -d ${BUILDCHROOT_DIR}/apt
+
# Configure root filesystem
sudo chroot ${BUILDCHROOT_DIR} /configscript.sh
_do_build_cleanup
}
+
+do_prepare[nostamp] = "1"
+
+do_prepare() {
+ sudo mount --bind ${BASE_APT_DIR}/apt ${BUILDCHROOT_DIR}/apt
+}
+
+addtask prepare after do_build
--
2.1.4
next prev parent reply other threads:[~2018-01-02 14:58 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-02 14:57 [RFC][PATCH 0/6] Isar build reproducibility Alexander Smirnov
2018-01-02 14:57 ` [RFC][PATCH 1/6] base-apt: Introduce fetching upstream apt Alexander Smirnov
2018-01-02 16:15 ` Jan Kiszka
2018-01-02 17:02 ` Alexander Smirnov
2018-01-03 13:15 ` Henning Schild
2018-01-02 16:20 ` Jan Kiszka
2018-01-02 14:57 ` [RFC][PATCH 2/6] base-apt: Add to pipeline Alexander Smirnov
2018-01-03 13:32 ` Henning Schild
2018-01-03 17:24 ` Henning Schild
2018-01-02 14:57 ` [RFC][PATCH 3/6] buildchroot: Switch to base-apt Alexander Smirnov
2018-01-02 14:57 ` Alexander Smirnov [this message]
2018-01-02 14:57 ` [RFC][PATCH 5/6] image: " Alexander Smirnov
2018-01-02 14:57 ` [RFC][PATCH 6/6] base-apt: Add possibility to reuse Alexander Smirnov
2018-01-02 16:09 ` [RFC][PATCH 0/6] Isar build reproducibility Jan Kiszka
2018-01-02 16:58 ` Alexander Smirnov
2018-01-02 17:07 ` Jan Kiszka
2018-01-02 17:25 ` Jan Kiszka
2018-01-03 13:49 ` Henning Schild
2018-01-03 13:54 ` Jan Kiszka
2018-01-03 14:03 ` Henning Schild
2018-01-03 14:06 ` Jan Kiszka
2018-01-09 7:45 ` 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=20180102145744.21814-5-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