From e406fc18cd733342b04c1bf70352988d6e9007a1 Mon Sep 17 00:00:00 2001 From: Modestas Vainius Date: Tue, 30 Jun 2009 16:04:50 +0300 Subject: [PATCH] rmdir_builddir(): use shell commands rather than perl equivalent. Pass --ignore-fail-on-non-empty option to shell rmddir and later check with -d if the exists to get the same effect. Also drop no act check from rmdir_builddir(), doit() does it for us now. Signed-off-by: Modestas Vainius --- Debian/Debhelper/Buildsystem.pm | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Debian/Debhelper/Buildsystem.pm b/Debian/Debhelper/Buildsystem.pm index 9730928..62c45b5 100644 --- a/Debian/Debhelper/Buildsystem.pm +++ b/Debian/Debhelper/Buildsystem.pm @@ -320,20 +320,20 @@ sub rmdir_builddir { my $only_empty=shift; if ($this->get_builddir()) { my $buildpath = $this->get_buildpath(); - if (-d $buildpath && ! $dh{NO_ACT}) { - my @spdir = File::Spec->splitdir($this->get_build_rel2sourcedir()); + if (-d $buildpath) { + my @dir = File::Spec->splitdir($this->get_build_rel2sourcedir()); my $peek; - if (!$only_empty) { + if (not $only_empty) { doit("rm", "-rf", $buildpath); - pop @spdir; + pop @dir; } # If build directory is relative and had 2 or more levels, delete - # empty parent directories until the source directory level. + # empty parent directories until the source or top directory level. if (not File::Spec->file_name_is_absolute($buildpath)) { - while (($peek=pop(@spdir)) && $peek ne '.' && $peek ne '..') { - my $dir = $this->get_sourcepath(File::Spec->catdir(@spdir, $peek)); - verbose_print("rmdir $dir"); - last if ! rmdir($dir); + while (($peek=pop @dir) && $peek ne '.' && $peek ne '..') { + my $dir = $this->get_sourcepath(File::Spec->catdir(@dir, $peek)); + doit("rmdir", "--ignore-fail-on-non-empty", $dir); + last if -d $dir; } } } -- 2.39.2