summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorModestas Vainius <modestas@vainius.eu>2009-06-29 19:11:42 +0300
committerModestas Vainius <modestas@vainius.eu>2009-06-30 00:53:06 +0300
commitc8ad61cdba0348c1d1ea1000b99ba83496b71bf1 (patch)
tree1de475a34079073a11f7f94d6012007477a39e73
parentafabee81e04c52cae5cbf55b8ba4566659505e9b (diff)
Rename enforce_out_of_source_building() to prefer_
Also add enforce_out_of_source_building() for clarity which does not take any parameters. Now both have a clear name and no confusing parameter combinations. Signed-off-by: Modestas Vainius <modestas@vainius.eu>
-rw-r--r--Debian/Debhelper/Buildsystem.pm26
-rw-r--r--Debian/Debhelper/Buildsystem/cmake.pm3
-rw-r--r--Debian/Debhelper/Buildsystem/python_distutils.pm2
-rwxr-xr-xt/buildsystems/buildsystem_tests2
4 files changed, 21 insertions, 12 deletions
diff --git a/Debian/Debhelper/Buildsystem.pm b/Debian/Debhelper/Buildsystem.pm
index c63f8153..e2037b5f 100644
--- a/Debian/Debhelper/Buildsystem.pm
+++ b/Debian/Debhelper/Buildsystem.pm
@@ -89,6 +89,7 @@ sub _set_builddir {
$this->{builddir} = undef;
}
}
+ return $this->{builddir};
}
# This instance method is called to check if the build system is able
@@ -117,17 +118,17 @@ sub enforce_in_source_building {
}
}
-# Derived class can call this method in its constructor to enforce
-# out of source building even if the user didn't request it. However,
-# if 'builddir' named parameter is passed, accept its value as the
-# build directory even if it matches the source directory (meaning out
-# of source is only prefered to in source, not enforced).
-sub enforce_out_of_source_building {
+# Derived class can call this method in its constructor to *prefer*
+# out of source building. Unless build directory has already been
+# specified building will proceed in the DEFAULT_BUILD_DIRECTORY or
+# the one specified in the 'builddir' named parameter (which may
+# match the source directory). Typically you should pass @_ from
+# the constructor to this call.
+sub prefer_out_of_source_building {
my $this=shift;
my %args=@_;
if (!defined $this->get_builddir()) {
- $this->_set_builddir($args{builddir});
- if (!defined $this->get_builddir() && !$args{builddir}) {
+ if (!$this->_set_builddir($args{builddir}) && !$args{builddir}) {
# If we are here, DEFAULT_BUILD_DIRECTORY matches
# the source directory, building might fail.
error("default build directory is the same as the source directory." .
@@ -136,6 +137,15 @@ sub enforce_out_of_source_building {
}
}
+# Derived class can call this method in its constructor to *enforce*
+# out of source building even if the user didn't request it.
+# Build directory is set to DEFAULT_BUILD_DIRECTORY or building
+# fails if it is not possible to set it
+sub enforce_out_of_source_building {
+ my $this=shift;
+ $this->prefer_out_of_source_building();
+}
+
# Enhanced version of File::Spec::canonpath. It collapses ..
# too so it may return invalid path if symlinks are involved.
# On the other hand, it does not need for the path to exist.
diff --git a/Debian/Debhelper/Buildsystem/cmake.pm b/Debian/Debhelper/Buildsystem/cmake.pm
index fe97f772..16796512 100644
--- a/Debian/Debhelper/Buildsystem/cmake.pm
+++ b/Debian/Debhelper/Buildsystem/cmake.pm
@@ -24,8 +24,7 @@ sub check_auto_buildable {
sub new {
my $class=shift;
my $this=$class->SUPER::new(@_);
- # Prefer out of source tree building.
- $this->enforce_out_of_source_building(@_);
+ $this->prefer_out_of_source_building(@_);
return $this;
}
diff --git a/Debian/Debhelper/Buildsystem/python_distutils.pm b/Debian/Debhelper/Buildsystem/python_distutils.pm
index fce45135..73ac2e30 100644
--- a/Debian/Debhelper/Buildsystem/python_distutils.pm
+++ b/Debian/Debhelper/Buildsystem/python_distutils.pm
@@ -25,7 +25,7 @@ sub new {
my $class=shift;
my $this=$class->SUPER::new(@_);
# Out of source tree building is prefered.
- $this->enforce_out_of_source_building(@_);
+ $this->prefer_out_of_source_building(@_);
return $this;
}
diff --git a/t/buildsystems/buildsystem_tests b/t/buildsystems/buildsystem_tests
index 82d8c100..e92e46f1 100755
--- a/t/buildsystems/buildsystem_tests
+++ b/t/buildsystems/buildsystem_tests
@@ -162,7 +162,7 @@ test_buildsystem_paths_api($bs, "no builddir, sourcedir=autoconf", \%tmp);
# Prefer out of source tree building when
# sourcedir=builddir=autoconf hence builddir should be dropped.
-$bs->enforce_out_of_source_building(builddir => "autoconf");
+$bs->prefer_out_of_source_building(builddir => "autoconf");
test_buildsystem_paths_api($bs, "out of source prefered, sourcedir=builddir", \%tmp);
# builddir=bld/dir, sourcedir=autoconf. Should be the same as sourcedir=autoconf.