Umount directories inside build root after build is finished 56/176456/6
authorSlava Barinov <v.barinov@samsung.com>
Thu, 19 Apr 2018 09:45:31 +0000 (12:45 +0300)
committerjingui.ren <jingui.ren@samsung.com>
Wed, 2 May 2018 06:42:08 +0000 (14:42 +0800)
Sometimes (e.g. during ASan build) some directories left mounted after gbs
build is finished and error "there're mounted directories to build root"
appears.

To prevent that this patch forces check of mounted directories and unmounting
them.

Change-Id: Ic22d4baf386bd0f2bd3a3f2d7baccb485e06b7de
Signed-off-by: Slava Barinov <v.barinov@samsung.com>
depanneur

index 9ec738f5921d1a5dee63adfae08f874024619acc..c01a0fa0a6b2b230230a9b832798d187ff099acd 100755 (executable)
--- a/depanneur
+++ b/depanneur
@@ -2076,6 +2076,15 @@ sub build_package {
         } else {
             $rpmdirpath = `sudo chroot '$scratch' su -c "rpm --eval %{_rpmdir} 2>/dev/null" - abuild`;
             $srcrpmdirpath = `sudo chroot '$scratch' su -c "rpm --eval %{_srcrpmdir} 2>/dev/null" - abuild`;
+            {
+                # If mounted dirs left inside chroot we have to unmount them
+                my $escaped_scratch = $scratch =~ s#/#\\/#gr;
+                my $scratch_mnts = `sudo mount | awk '/$escaped_scratch/{print \$3}'`;
+                my @scratch_mnt_list = split("\n", $scratch_mnts);
+                foreach my $scratch_mnt (@scratch_mnt_list) {
+                    safe_umount($scratch_mnt);
+                }
+            }
         }
         chomp($rpmdirpath);
         chomp($srcrpmdirpath);