From 8bc41beed81ddc5ad864c7387bf61cac85ca739c Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 20 Apr 2009 14:33:00 -0400 Subject: remove _mkdir, use mkdir -p _mkdir is not necessary, because mkdir's error messages are good enough if a file by the name of the directory exists ("cannot create directory: File exists"), or if a file is where the parent directory should be ("cannot create directory: Not a directory") Using mkdir -p seems useful, in case someone wants a deeply nested builddir. This also changes the return value of mkdir_builddir, but nothing currently tests it. --- Debian/Debhelper/Dh_Buildsystem.pm | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/Debian/Debhelper/Dh_Buildsystem.pm b/Debian/Debhelper/Dh_Buildsystem.pm index 7942baac..573ace2a 100644 --- a/Debian/Debhelper/Dh_Buildsystem.pm +++ b/Debian/Debhelper/Dh_Buildsystem.pm @@ -160,22 +160,6 @@ sub get_rel2builddir_path { return $path; } -sub _mkdir { - my ($cls, $dir)=@_; - # XXX JEH is there any reason not to just doit("mkdir") ? - # XXX MDX Replaced below part. This call is there to be - # more verbose about errors (if accidently $dir in - # non-dir form and to test for ! -d $dir. - if (-e $dir && ! -d $dir) { - error("error: unable to create '$dir': object already exists and is not a directory"); - } - elsif (! -d $dir) { - doit("mkdir", $dir); - return 1; - } - return 0; -} - sub _cd { my ($cls, $dir)=@_; if (! $dh{NO_ACT}) { @@ -184,14 +168,12 @@ sub _cd { } } -# Creates a build directory. Returns 1 if the directory was created -# or 0 if it already exists or there is no need to create it. +# Creates a build directory. sub mkdir_builddir { my $self=shift; if ($self->get_builddir()) { - return $self->_mkdir($self->get_builddir()); + doit("mkdir", "-p", $self->get_builddir()); } - return 0; } # Changes working directory the build directory (if needed), calls doit(@_) -- cgit v1.2.3