[debhelper-devel] [Git][debian/debhelper][master] Buildsystems: Avoid picking a redundant build system during clean
Niels Thykier
gitlab at salsa.debian.org
Sun Apr 8 08:44:42 UTC 2018
Niels Thykier pushed to branch master at Debian / debhelper
Commits:
03ac69c9 by Niels Thykier at 2018-04-08T08:42:45+00:00
Buildsystems: Avoid picking a redundant build system during clean
Signed-off-by: Niels Thykier <niels at thykier.net>
- - - - -
5 changed files:
- debian/changelog
- lib/Debian/Debhelper/Buildsystem.pm
- lib/Debian/Debhelper/Buildsystem/cmake.pm
- lib/Debian/Debhelper/Buildsystem/makefile.pm
- lib/Debian/Debhelper/Buildsystem/meson.pm
Changes:
=====================================
debian/changelog
=====================================
--- a/debian/changelog
+++ b/debian/changelog
@@ -4,6 +4,13 @@ debhelper (11.2.1) UNRELEASED; urgency=medium
target buildsystems. Thanks to Helmut Grohne, Adrian Bunk
and Tobias Frost for the reports and debugging.
(Closes: #895174, #895181)
+ * Buildsystems: Avoid choosing a build system for the clean
+ step if it is not necessary. Previously, debhelper could
+ choose a "random" build system that would prefer building
+ in a separate build directory on the basis that the build
+ directory should be removed. With this, change we only
+ choose such a build system if there is a build directory
+ to remove.
-- Niels Thykier <niels at thykier.net> Sun, 08 Apr 2018 07:13:22 +0000
=====================================
lib/Debian/Debhelper/Buildsystem.pm
=====================================
--- a/lib/Debian/Debhelper/Buildsystem.pm
+++ b/lib/Debian/Debhelper/Buildsystem.pm
@@ -399,6 +399,17 @@ sub mkdir_builddir {
}
}
+sub check_auto_buildable_clean_oos_buildir {
+ my $this = shift;
+ my ($step) = @_;
+ # This only applies to clean
+ return 0 if $step ne 'clean';
+ my $builddir = $this->get_builddir;
+ # If there is no builddir, then this rule does not apply.
+ return 0 if not defined($builddir) or not -d $builddir;
+ return 1;
+}
+
sub _cd {
my ($this, $dir)=@_;
verbose_print("cd $dir");
=====================================
lib/Debian/Debhelper/Buildsystem/cmake.pm
=====================================
--- a/lib/Debian/Debhelper/Buildsystem/cmake.pm
+++ b/lib/Debian/Debhelper/Buildsystem/cmake.pm
@@ -50,7 +50,7 @@ sub check_auto_buildable {
if (-e $this->get_sourcepath("CMakeLists.txt")) {
my $ret = ($step eq "configure" && 1) ||
$this->get_targetbuildsystem->check_auto_buildable(@_);
- if ($step eq "clean" && defined($this->get_builddir())) {
+ if ($this->check_auto_buildable_clean_oos_buildir(@_)) {
# Assume that the package can be cleaned (i.e. the build directory can
# be removed) as long as it is built out-of-source tree and can be
# configured.
=====================================
lib/Debian/Debhelper/Buildsystem/makefile.pm
=====================================
--- a/lib/Debian/Debhelper/Buildsystem/makefile.pm
+++ b/lib/Debian/Debhelper/Buildsystem/makefile.pm
@@ -134,9 +134,8 @@ sub check_auto_buildable {
# This is always called in the source directory, but generally
# Makefiles are created (or live) in the build directory.
return 1;
- } elsif ($step eq "clean" && defined $this->get_builddir() &&
- $this->check_auto_buildable("configure"))
- {
+ } elsif ($this->check_auto_buildable_clean_oos_buildir(@_)
+ and $this->check_auto_buildable('configure')) {
# Assume that the package can be cleaned (i.e. the build directory can
# be removed) as long as it is built out-of-source tree and can be
# configured. This is useful for derivative buildsystems which
=====================================
lib/Debian/Debhelper/Buildsystem/meson.pm
=====================================
--- a/lib/Debian/Debhelper/Buildsystem/meson.pm
+++ b/lib/Debian/Debhelper/Buildsystem/meson.pm
@@ -32,7 +32,7 @@ sub check_auto_buildable {
# Handle configure explicitly; inherit the rest
return 1 if $step eq "configure";
my $ret = $this->get_targetbuildsystem->check_auto_buildable(@_);
- if ($ret == 0 and $step eq 'clean' and defined($this->get_builddir())) {
+ if ($ret == 0 and $this->check_auto_buildable_clean_oos_buildir(@_)) {
# Assume that the package can be cleaned (i.e. the build directory can
# be removed) as long as it is built out-of-source tree and can be
# configured.
View it on GitLab: https://salsa.debian.org/debian/debhelper/commit/03ac69c9ec0a1ab6539993f1d52644adc639dcb5
---
View it on GitLab: https://salsa.debian.org/debian/debhelper/commit/03ac69c9ec0a1ab6539993f1d52644adc639dcb5
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/debhelper-devel/attachments/20180408/9d358223/attachment-0001.html>
More information about the debhelper-devel
mailing list