From: Alexander Smirnov <asmirnov@ilbers.de>
To: Jan Kiszka <jan.kiszka@siemens.com>,
isar-users <isar-users@googlegroups.com>
Subject: Re: [PATCH v2 5/9] Move buildchroot mounts into dpkg-base class
Date: Tue, 13 Feb 2018 23:17:48 +0300 [thread overview]
Message-ID: <640ea89d-7320-30b9-fd22-4747ee3f727f@ilbers.de> (raw)
In-Reply-To: <697b09bb60a515430f655989e859263922148264.1518552327.git.jan.kiszka@siemens.com>
On 02/13/2018 11:05 PM, Jan Kiszka wrote:
> From: Jan Kiszka <jan.kiszka@siemens.com>
>
> This avoids the unfortunate setup_mounts task which is either not
> executed on rebuilds or causes excessive package rebuilds. We just need
> ensure prior to switching into the buildchroot that all mount points are
> populated.
>
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> ---
> meta/classes/dpkg-base.bbclass | 13 +++++++++-
> meta/recipes-devtools/buildchroot/buildchroot.bb | 30 +++---------------------
> 2 files changed, 15 insertions(+), 28 deletions(-)
>
> diff --git a/meta/classes/dpkg-base.bbclass b/meta/classes/dpkg-base.bbclass
> index a45fbce..66132da 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_setup_mounts"
> +do_build[depends] = "buildchroot:do_build"
>
> # Add dependency between Isar recipes
> DEPENDS ?= ""
> @@ -20,11 +20,22 @@ dpkg_runbuild() {
> die "This should never be called, overwrite it in your derived class"
> }
>
> +mount_if_needed() {
> +
> + # The test may race with parallel builds. So probe, mount if needed, and
> + # then only fail if both the mount and yet another probe failed as well.
> + grep -q $2 /proc/mounts || sudo mount $1 $2 || grep -q $2 /proc/mounts
This could lead to have lots of remounts on the same folder during
parallel execution. This should be done in a separate task and protected
by [lockfiles].
Alex
> +}
> +
> # Wrap the function dpkg_runbuild with the bind mount for buildroot
> do_build() {
> mkdir -p ${BUILDROOT}
> sudo mount --bind ${WORKDIR} ${BUILDROOT}
>
> + mount_if_needed "--bind ${DEPLOY_DIR_APT}/${DISTRO}" ${BUILDCHROOT_DIR}/isar-apt
> + mount_if_needed "-t devtmpfs -o mode=0755,nosuid devtmpfs" ${BUILDCHROOT_DIR}/dev
> + mount_if_needed "-t proc none" ${BUILDCHROOT_DIR}/proc
> +
> dpkg_runbuild
>
> sudo umount ${BUILDROOT} 2>/dev/null || true
> diff --git a/meta/recipes-devtools/buildchroot/buildchroot.bb b/meta/recipes-devtools/buildchroot/buildchroot.bb
> index 570c0ad..cd91228 100644
> --- a/meta/recipes-devtools/buildchroot/buildchroot.bb
> +++ b/meta/recipes-devtools/buildchroot/buildchroot.bb
> @@ -60,7 +60,9 @@ do_build() {
> -e 's|##DIR_HOOKS##|./'"$WORKDIR_REL"'/hooks_multistrap|g' \
> "${WORKDIR}/multistrap.conf.in" > "${WORKDIR}/multistrap.conf"
>
> - do_setup_mounts
> + sudo mount --bind ${DEPLOY_DIR_APT}/${DISTRO} ${BUILDCHROOT_DIR}/isar-apt
> + sudo mount -t devtmpfs -o mode=0755,nosuid devtmpfs ${BUILDCHROOT_DIR}/dev
> + sudo mount -t proc none ${BUILDCHROOT_DIR}/proc
>
> # Create root filesystem
> sudo -E multistrap -a ${DISTRO_ARCH} -d "${BUILDCHROOT_DIR}" -f "${WORKDIR}/multistrap.conf"
> @@ -70,30 +72,4 @@ do_build() {
>
> # Configure root filesystem
> sudo chroot ${BUILDCHROOT_DIR} /configscript.sh
> -
> - do_cleanup_mounts
> -}
> -
> -# Invalidate stamp for do_setup_mounts before each build start.
> -# This will guarantee that this function will be executed once
> -# per build.
> -python __anonymous() {
> - stamp = d.getVar("STAMP") + ".do_setup_mounts." + d.getVarFlag("do_setup_mounts", 'stamp-extra-info')
> - os.remove(stamp) if os.path.exists(stamp) else None
> -}
> -
> -do_setup_mounts[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}"
> -
> -do_setup_mounts() {
> - sudo mount --bind ${DEPLOY_DIR_APT}/${DISTRO} ${BUILDCHROOT_DIR}/isar-apt
> - sudo mount -t devtmpfs -o mode=0755,nosuid devtmpfs ${BUILDCHROOT_DIR}/dev
> - sudo mount -t proc none ${BUILDCHROOT_DIR}/proc
> -}
> -
> -addtask setup_mounts after do_build
> -
> -do_cleanup_mounts() {
> - sudo umount ${BUILDCHROOT_DIR}/isar-apt 2>/dev/null || true
> - sudo umount ${BUILDCHROOT_DIR}/dev 2>/dev/null || true
> - sudo umount ${BUILDCHROOT_DIR}/proc 2>/dev/null || true
> }
>
--
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
next prev parent reply other threads:[~2018-02-13 20:17 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-13 20:05 [PATCH v2 0/9] Add support for automatic partial rebuilds on recipe changes Jan Kiszka
2018-02-13 20:05 ` [PATCH v2 1/9] dpkg-raw: Install hooks automatically Jan Kiszka
2018-02-13 20:05 ` [PATCH v2 2/9] Fix indention of base_do_build Jan Kiszka
2018-02-13 20:05 ` [PATCH v2 3/9] Add clean and cleanall tasks Jan Kiszka
2018-02-14 15:14 ` [PATCH v3 " Jan Kiszka
2018-02-13 20:05 ` [PATCH v2 4/9] Enable recipe caching Jan Kiszka
2018-02-13 20:05 ` [PATCH v2 5/9] Move buildchroot mounts into dpkg-base class Jan Kiszka
2018-02-13 20:17 ` Alexander Smirnov [this message]
2018-02-13 20:47 ` Jan Kiszka
2018-02-14 5:54 ` Alexander Smirnov
2018-02-14 8:37 ` Jan Kiszka
2018-02-14 8:52 ` [PATCH v3 " Jan Kiszka
2018-02-14 9:09 ` Alexander Smirnov
2018-02-14 9:16 ` Jan Kiszka
2018-02-13 20:05 ` [PATCH v2 6/9] Enable proper rebuilds on dependency changes Jan Kiszka
2018-02-13 20:05 ` [PATCH v2 7/9] dpkg-raw: Clean DEBIAN dir prior to filling it Jan Kiszka
2018-02-15 9:14 ` Claudius Heine
2018-02-15 9:18 ` Jan Kiszka
2018-02-15 10:26 ` Claudius Heine
2018-02-15 10:30 ` Alexander Smirnov
2018-02-15 10:53 ` [PATCH] dpkg-raw: Fix creation of DEBIAN folder Jan Kiszka
2018-02-15 15:39 ` Alexander Smirnov
2018-02-26 11:39 ` Andreas Reichel
2018-02-26 12:03 ` Jan Kiszka
2018-02-26 12:27 ` Andreas Reichel
2018-02-15 12:20 ` [PATCH v2 7/9] dpkg-raw: Clean DEBIAN dir prior to filling it Claudius Heine
2018-02-13 20:05 ` [PATCH v2 8/9] isar-image-base: Clean rootfs folder prior to building Jan Kiszka
2018-02-13 20:05 ` [PATCH v2 9/9] buildchroot: Clean up rootfs prior to populating it Jan Kiszka
2018-02-14 17:43 ` Alexander Smirnov
2018-02-14 17:48 ` Jan Kiszka
2018-02-14 11:33 ` [PATCH v2 0/9] Add support for automatic partial rebuilds on recipe changes Alexander Smirnov
2018-02-14 12:41 ` Jan Kiszka
2018-02-14 12:57 ` Alexander Smirnov
2018-02-14 13:10 ` Jan Kiszka
2018-02-14 13:29 ` Jan Kiszka
2018-02-14 13:38 ` Jan Kiszka
2018-02-14 13:49 ` Jan Kiszka
2018-02-14 14:06 ` Alexander Smirnov
2018-02-14 14:03 ` Alexander Smirnov
2018-02-14 14:10 ` Jan Kiszka
2018-02-14 17:51 ` Alexander Smirnov
2018-02-14 17:54 ` Jan Kiszka
2018-02-14 17:57 ` Alexander Smirnov
2018-02-14 18:02 ` Jan Kiszka
2018-02-14 18:34 ` 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=640ea89d-7320-30b9-fd22-4747ee3f727f@ilbers.de \
--to=asmirnov@ilbers.de \
--cc=isar-users@googlegroups.com \
--cc=jan.kiszka@siemens.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