From 9f27224519df042051c2394428f3dfc2bd280066 Mon Sep 17 00:00:00 2001 From: Florent Villard Date: Tue, 24 Jan 2006 08:56:50 +0000 Subject: try harder to clean previous unionfs remaining directories --- iurt2 | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/iurt2 b/iurt2 index f0fbd7a..7eefc12 100755 --- a/iurt2 +++ b/iurt2 @@ -306,6 +306,7 @@ if (!$nocheckchroot) { dump_rpmmacros("$chroot/home/builder/.rpmmacros") or die "FATAL iurt: could not dump rpm macros"; if ($unionfs) { $unionfs_dir = "$config->{local_home}/iurt_unionfs$debug_tag"; + clean_all_unionfs($unionfs_dir); -d $unionfs_dir or mkdir $unionfs_dir } my $s = sub { print "iurt: dumping cache...\n"; dump_cache(); exit }; @@ -449,7 +450,7 @@ foreach (my $i ; $i < @todo; $i++) { # if (!$unionfs_tmp) { $cache->{failure}{$srpm} = 1 - } elsif ($cache->{no_unionfs}{$srpm}) { + } elsif (!$cache->{no_unionfs}{$srpm}) { $cache->{failure}{$srpm} = 1 } next @@ -498,13 +499,7 @@ if ($config->{rsync_to}) { # one last try to clean print STDERR "iurt: try to clean remaining unionfs\n"; if ($unionfs) { - print STDERR "Cleaning old unionfs remaining dir\n"; - opendir my $dir, $unionfs_dir; - while (readdir $dir) { - /unionfs\.(\d+)\.(\d+)/ or next; - clean_unionfs($unionfs_dir, $1, $2); - } - closedir $dir + clean_all_unionfs($unionfs_dir) } unlink $pidfile; @@ -535,6 +530,17 @@ sub usage { exit } +sub clean_all_unionfs { + my ($unionfs_dir) = @_; + print STDERR "Cleaning old unionfs remaining dir in $unionfs_dir\n"; + opendir my $dir, $unionfs_dir or die "FATAL iurt: could not open $unionfs_dir ($!)"; + foreach (readdir $dir) { + /unionfs\.(\d+)\.(\d+)/ or next; + clean_unionfs($unionfs_dir, $1, $2); + } + closedir $dir +} + sub clean_chroot { my ($chroot, $only_clean) = @_; if (-d $chroot) { @@ -587,6 +593,7 @@ sub clean { sub clean_unionfs { my ($unionfs_dir, $run, $union_id) = @_; system("sudo umount $unionfs_dir/unionfs.$run.$union_id/proc") and print STDERR "ERROR iurt: could not umount $unionfs_dir/unionfs.$run.$union_id/proc\n"; + print "Cleaning $unionfs_dir/unionfs.$run.$union_id\n"; foreach my $t ("unionfs",'tmpfs') { # unfortunately quite oftem the unionfs is busy and could not be unmounted my $d = "$unionfs_dir/$t.$run.$union_id"; -- cgit v1.2.1