diff options
author | Modestas Vainius <modestas@vainius.eu> | 2009-11-18 14:16:41 -0500 |
---|---|---|
committer | Joey Hess <joey@gnu.kitenet.net> | 2009-11-18 14:16:41 -0500 |
commit | 758ce0bb1fbb505aa05f2dd3ac85d7d084b94312 (patch) | |
tree | 58aa6852c13e83aecdaaa000a0e3f4f17d99dcf1 /Debian/Debhelper/Dh_Buildsystems.pm | |
parent | 93cab1844819ee8f761606f6ccc511ebf07d2213 (diff) |
Improve build system auto-selection process
This patch alters semantics of check_auto_buildable() a bit. Now it can
also indicate if the source has already been partitially built with the
build system and if so, such build system may be auto-selected over a less
specific its parent (in the inheritance tree) even if the latter is earlier
in the @BUILDSYSTEMS array.
However, this still leaves a requirement that a derivative build system
must not do anything that may break packages of the parent build system.
Otherwise, introduction of a new derivative build system might break
packages which already had that build system implemented via overrides...
Signed-off-by: Modestas Vainius <modestas@vainius.eu>
Diffstat (limited to 'Debian/Debhelper/Dh_Buildsystems.pm')
-rw-r--r-- | Debian/Debhelper/Dh_Buildsystems.pm | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/Debian/Debhelper/Dh_Buildsystems.pm b/Debian/Debhelper/Dh_Buildsystems.pm index a9a13a29..2893c1a4 100644 --- a/Debian/Debhelper/Dh_Buildsystems.pm +++ b/Debian/Debhelper/Dh_Buildsystems.pm @@ -14,6 +14,8 @@ use File::Spec; use base 'Exporter'; our @EXPORT=qw(&buildsystems_init &buildsystems_do &load_buildsystem &load_all_buildsystems); +use constant BUILD_STEPS => qw(configure build test install clean); + # Historical order must be kept for backwards compatibility. New # build systems MUST be added to the END of the list. our @BUILDSYSTEMS = ( @@ -66,14 +68,26 @@ sub load_buildsystem { } else { # Try to determine build system automatically + my $selected; + my $selected_level = 0; for $system (@BUILDSYSTEMS) { my $inst = create_buildsystem_instance($system, @_); - if ($inst->check_auto_buildable($step)) { - return $inst; + + # Only derived (i.e. more specific) build system can be + # considered beyond the currently selected one. + next if defined $selected && !$inst->isa(ref $selected); + + # If the build system says it is auto-buildable at the current + # step and it can provide more specific information about its + # status than its parent (if any), auto-select it. + my $level = $inst->check_auto_buildable($step); + if ($level > $selected_level) { + $selected = $inst; + $selected_level = $level; } } + return $selected; } - return; } sub load_all_buildsystems { @@ -189,7 +203,7 @@ sub buildsystems_do { $step =~ s/^dh_auto_//; } - if (grep(/^\Q$step\E$/, qw{configure build test install clean}) == 0) { + if (grep(/^\Q$step\E$/, BUILD_STEPS) == 0) { error("unrecognized build step: " . $step); } |