From: Jan Kiszka <jan.kiszka@siemens.com>
To: Alexander Smirnov <asmirnov@ilbers.de>, isar-users@googlegroups.com
Subject: Re: [PATCH 3/5] buildchroot: Enable isar-apt
Date: Mon, 5 Feb 2018 11:18:05 +0100 [thread overview]
Message-ID: <0f008581-a852-79fa-f67e-6361c4ca35ed@siemens.com> (raw)
In-Reply-To: <20180205095931.23903-4-asmirnov@ilbers.de>
On 2018-02-05 10:59, Alexander Smirnov wrote:
> This patch provides access to isar-apt from buildchroot. It does the
> following:
> - mount isar-apt during buildchroot building.
> - umount isar-apt using bitbake events.
>
> Also it needs to keep Isar build tree clean from any mounts despite on whether
> build succeed of failed. bitbake provides various events that could trigger
> custom python hooks. In this patch BuildCompleted event is used, which happened
> when bitbake finished its execution despite on the result.
>
> Signed-off-by: Alexander Smirnov <asmirnov@ilbers.de>
> ---
> meta-isar/conf/local.conf.sample | 3 +++
> meta/classes/isar-events.bbclass | 20 ++++++++++++++++++++
> meta/recipes-devtools/buildchroot/buildchroot.bb | 7 +++++++
> .../buildchroot/files/multistrap.conf.in | 8 +++++++-
> 4 files changed, 37 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 2ae43e7..fc760ed 100644
> --- a/meta-isar/conf/local.conf.sample
> +++ b/meta-isar/conf/local.conf.sample
> @@ -158,3 +158,6 @@ IMAGE_INSTALL = "example-hello example-raw"
> #
> # Default parallel jobs for bitbake:
> BB_NUMBER_THREADS = "4"
> +
> +# Add event handlers for bitbake
> +INHERIT += "isar-events"
> diff --git a/meta/classes/isar-events.bbclass b/meta/classes/isar-events.bbclass
> new file mode 100644
> index 0000000..55fc106
> --- /dev/null
> +++ b/meta/classes/isar-events.bbclass
> @@ -0,0 +1,20 @@
> +# 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 + '/isar-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 51f9d5d..cb90148 100644
> --- a/meta/recipes-devtools/buildchroot/buildchroot.bb
> +++ b/meta/recipes-devtools/buildchroot/buildchroot.bb
> @@ -33,6 +33,7 @@ WORKDIR = "${TMPDIR}/work/${DISTRO}-${DISTRO_ARCH}/${PN}"
>
> do_build[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}"
> do_build[dirs] = "${WORKDIR}/hooks_multistrap"
> +do_build[depends] = "isar-apt:do_cache_config"
>
> do_build() {
> E="${@ bb.utils.export_proxies(d)}"
> @@ -58,6 +59,9 @@ do_build() {
> -e 's|##DIR_HOOKS##|./'"$WORKDIR_REL"'/hooks_multistrap|g' \
> "${WORKDIR}/multistrap.conf.in" > "${WORKDIR}/multistrap.conf"
>
> + [ ! -d ${BUILDCHROOT_DIR}/isar-apt ] && install -d -m 555 ${BUILDCHROOT_DIR}/isar-apt
> + sudo mount --bind ${DEPLOY_DIR_APT}/${DISTRO} ${BUILDCHROOT_DIR}/isar-apt
> +
> [ ! -d ${BUILDCHROOT_DIR}/proc ] && install -d -m 555 ${BUILDCHROOT_DIR}/proc
> sudo mount -t proc none ${BUILDCHROOT_DIR}/proc
> _do_build_cleanup() {
> @@ -73,6 +77,9 @@ do_build() {
> # Install package builder script
> sudo install -m 755 ${WORKDIR}/build.sh ${BUILDCHROOT_DIR}
>
> + # Create share point for isar-apt
> + sudo install -d ${BUILDCHROOT_DIR}/isar-apt
> +
> # Configure root filesystem
> sudo chroot ${BUILDCHROOT_DIR} /configscript.sh
> _do_build_cleanup
> diff --git a/meta/recipes-devtools/buildchroot/files/multistrap.conf.in b/meta/recipes-devtools/buildchroot/files/multistrap.conf.in
> index a0b28e3..480a4b8 100644
> --- a/meta/recipes-devtools/buildchroot/files/multistrap.conf.in
> +++ b/meta/recipes-devtools/buildchroot/files/multistrap.conf.in
> @@ -6,7 +6,7 @@ noauth=true
> unpack=true
> ignorenativearch=true
> bootstrap=##DISTRO_MULTICONF_BOOTSTRAP##
> -aptsources=##DISTRO_MULTICONF_APTSOURCES##
> +aptsources=isar-apt ##DISTRO_MULTICONF_APTSOURCES##
> configscript=##CONFIG_SCRIPT##
> setupscript=##SETUP_SCRIPT##
> hookdir=##DIR_HOOKS##
> @@ -29,3 +29,9 @@ source=##DISTRO_APT_SOURCE_SEC##
> suite=##DISTRO_SUITE##/updates
> components=##DISTRO_COMPONENTS##
> omitdebsrc=true
> +
> +[isar-apt]
> +source=file:///isar-apt
> +suite=isar
> +components=main
> +omitdebsrc=true
>
On first glance, this looks identical to v1 which I tried over the
current bitbake version we have in Isar. There I see two issues:
- umount does not work if the build fails
- re-mount will not happen if the buildchroot was built in a previous
run and only a depending packages is built now
Jan
--
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux
next prev parent reply other threads:[~2018-02-05 10:18 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-05 9:59 [PATCH 0/5] Rework isar-apt v2 Alexander Smirnov
2018-02-05 9:59 ` [PATCH 1/5] Update isar-bitbake.conf according to the changes in bitbake related to multiconfig support Alexander Smirnov
2018-02-05 10:15 ` Jan Kiszka
2018-02-05 10:26 ` Alexander Smirnov
2018-02-05 10:27 ` Jan Kiszka
2018-02-05 9:59 ` [PATCH 2/5] isar-apt: Introduce separate recipe Alexander Smirnov
2018-02-05 9:59 ` [PATCH 3/5] buildchroot: Enable isar-apt Alexander Smirnov
2018-02-05 10:18 ` Jan Kiszka [this message]
2018-02-05 10:33 ` Alexander Smirnov
2018-02-05 9:59 ` [PATCH 4/5] build.sh: Update apt sources Alexander Smirnov
2018-02-05 9:59 ` [PATCH 5/5] build.sh: Force 'yes' for apt Alexander Smirnov
2018-02-05 11:52 ` Jan Kiszka
2018-02-05 13:56 ` Alexander Smirnov
2018-02-05 13:48 ` [PATCH 3/5 v2] buildchroot: Enable isar-apt Alexander Smirnov
2018-02-06 11:01 ` [PATCH 3/5 v3] " Alexander Smirnov
2018-02-06 12:10 ` Jan Kiszka
2018-02-06 13:28 ` Alexander Smirnov
2018-02-05 14:41 ` [PATCH 0/5] Rework isar-apt v2 Alexander Smirnov
2018-02-05 16:47 ` Jan Kiszka
2018-02-05 16:56 ` Alexander Smirnov
2018-02-06 13:57 ` [PATCH 3/5 v4] buildchroot: Enable isar-apt Alexander Smirnov
2018-02-06 17:31 ` Jan Kiszka
2018-02-06 18:29 ` Alexander Smirnov
2018-02-06 18:31 ` Jan Kiszka
2018-02-08 14:37 ` Henning Schild
2018-02-08 14:57 ` Alexander Smirnov
2018-02-06 20:24 ` [PATCH 0/5] Rework isar-apt v2 Alexander Smirnov
2018-02-08 14:59 ` Henning Schild
2018-02-08 15:09 ` Jan Kiszka
2018-02-09 10:30 ` Henning Schild
2018-02-08 17:03 ` Benedikt Niedermayr
2018-02-08 18:27 ` Benedikt Niedermayr
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=0f008581-a852-79fa-f67e-6361c4ca35ed@siemens.com \
--to=jan.kiszka@siemens.com \
--cc=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