summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Hess <joey@gnu.kitenet.net>2009-04-20 14:33:00 -0400
committerJoey Hess <joey@gnu.kitenet.net>2009-04-20 14:33:00 -0400
commit8bc41beed81ddc5ad864c7387bf61cac85ca739c (patch)
treed1c3fe6cde811ae1a8acd3a9c4c0812946dda555
parenta4d098bce5a9a339e5768b23ecbdb2cf448b233b (diff)
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.
-rw-r--r--Debian/Debhelper/Dh_Buildsystem.pm22
1 files 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(@_)