]> git.donarmstrong.com Git - debhelper.git/commitdiff
remove _mkdir, use mkdir -p
authorJoey Hess <joey@gnu.kitenet.net>
Mon, 20 Apr 2009 18:33:00 +0000 (14:33 -0400)
committerJoey Hess <joey@gnu.kitenet.net>
Mon, 20 Apr 2009 18:33:00 +0000 (14:33 -0400)
_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

index 7942baacdd1b4a08e1d84f8346787b29a8e549bc..573ace2a54e88ef058d2ad38b3e069d408295c92 100644 (file)
@@ -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(@_)