public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH] [RFC] buildchroot: Fix do_setup_mounts
@ 2018-02-13 20:32 Alexander Smirnov
  2018-02-13 20:49 ` Jan Kiszka
  0 siblings, 1 reply; 2+ messages in thread
From: Alexander Smirnov @ 2018-02-13 20:32 UTC (permalink / raw)
  To: isar-users; +Cc: Alexander Smirnov

Fix this function to work correctly for re-running builds.

Signed-off-by: Alexander Smirnov <asmirnov@ilbers.de>
---
 meta/recipes-devtools/buildchroot/buildchroot.bb | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/meta/recipes-devtools/buildchroot/buildchroot.bb b/meta/recipes-devtools/buildchroot/buildchroot.bb
index 570c0ad..d25b549 100644
--- a/meta/recipes-devtools/buildchroot/buildchroot.bb
+++ b/meta/recipes-devtools/buildchroot/buildchroot.bb
@@ -74,20 +74,16 @@ do_build() {
     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[nostamp] = "1"
+do_setup_mounts[lockfiles] = "${WORKDIR}/isar.lock"
 
 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
+    grep -q ${BUILDCHROOT_DIR}/isar-apt /proc/mounts || \
+        sudo mount --bind ${DEPLOY_DIR_APT}/${DISTRO} ${BUILDCHROOT_DIR}/isar-apt
+    grep -q ${BUILDCHROOT_DIR}/dev /proc/mounts || \
+        sudo mount -t devtmpfs -o mode=0755,nosuid devtmpfs ${BUILDCHROOT_DIR}/dev
+    grep -q ${BUILDCHROOT_DIR}/proc /proc/mounts || \
+        sudo mount -t proc none ${BUILDCHROOT_DIR}/proc
 }
 
 addtask setup_mounts after do_build
-- 
2.1.4


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

* Re: [PATCH] [RFC] buildchroot: Fix do_setup_mounts
  2018-02-13 20:32 [PATCH] [RFC] buildchroot: Fix do_setup_mounts Alexander Smirnov
@ 2018-02-13 20:49 ` Jan Kiszka
  0 siblings, 0 replies; 2+ messages in thread
From: Jan Kiszka @ 2018-02-13 20:49 UTC (permalink / raw)
  To: Alexander Smirnov, isar-users

On 2018-02-13 21:32, Alexander Smirnov wrote:
> Fix this function to work correctly for re-running builds.
> 
> Signed-off-by: Alexander Smirnov <asmirnov@ilbers.de>
> ---
>  meta/recipes-devtools/buildchroot/buildchroot.bb | 20 ++++++++------------
>  1 file changed, 8 insertions(+), 12 deletions(-)
> 
> diff --git a/meta/recipes-devtools/buildchroot/buildchroot.bb b/meta/recipes-devtools/buildchroot/buildchroot.bb
> index 570c0ad..d25b549 100644
> --- a/meta/recipes-devtools/buildchroot/buildchroot.bb
> +++ b/meta/recipes-devtools/buildchroot/buildchroot.bb
> @@ -74,20 +74,16 @@ do_build() {
>      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[nostamp] = "1"
> +do_setup_mounts[lockfiles] = "${WORKDIR}/isar.lock"
>  
>  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
> +    grep -q ${BUILDCHROOT_DIR}/isar-apt /proc/mounts || \
> +        sudo mount --bind ${DEPLOY_DIR_APT}/${DISTRO} ${BUILDCHROOT_DIR}/isar-apt
> +    grep -q ${BUILDCHROOT_DIR}/dev /proc/mounts || \
> +        sudo mount -t devtmpfs -o mode=0755,nosuid devtmpfs ${BUILDCHROOT_DIR}/dev
> +    grep -q ${BUILDCHROOT_DIR}/proc /proc/mounts || \
> +        sudo mount -t proc none ${BUILDCHROOT_DIR}/proc
>  }
>  
>  addtask setup_mounts after do_build
> 

NACK.

I've tried that (nostamp), but that breaks the dependency due to
recurring execution of this task which every one depends upon.

Jan

-- 
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux

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

end of thread, other threads:[~2018-02-13 20:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-13 20:32 [PATCH] [RFC] buildchroot: Fix do_setup_mounts Alexander Smirnov
2018-02-13 20:49 ` Jan Kiszka

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