diff options
author | Modestas Vainius <modestas@vainius.eu> | 2009-04-15 17:39:06 +0300 |
---|---|---|
committer | Joey Hess <joey@gnu.kitenet.net> | 2009-04-15 14:10:08 -0400 |
commit | 14d936391e07454c7936a28c512e8b42b26cd05e (patch) | |
tree | 3cf37c8050adf723f751663260e19afd26a899b6 /Debian/Debhelper/Buildsystem | |
parent | acd3bec058d14c227f1f45c42122caa6d7a09e89 (diff) |
debhelper modular buildsystems (try 3).
* New feature - when listing buildsystems, list their status too
(auto/specified).
* Dh_Buildsystem_Basic.pm renamed to Dh_Buildsystem.pm
* Addressed a few issues expressed in the comments, answered a few
comments.
* Cache DEB_BUILD_GNU_TYPE value. Performance hit is noticable when
listing build systems.
* is_auto_buildable() renamed to check_auto_buildable() (again).
Since there is is_buildable() now, I didn't want to use is_ for
that method.
Signed-off-by: Modestas Vainius <modestas@vainius.eu>
Diffstat (limited to 'Debian/Debhelper/Buildsystem')
-rw-r--r-- | Debian/Debhelper/Buildsystem/autotools.pm | 8 | ||||
-rw-r--r-- | Debian/Debhelper/Buildsystem/cmake.pm | 4 | ||||
-rw-r--r-- | Debian/Debhelper/Buildsystem/makefile.pm | 14 | ||||
-rw-r--r-- | Debian/Debhelper/Buildsystem/perl_build.pm | 6 | ||||
-rw-r--r-- | Debian/Debhelper/Buildsystem/perl_makemaker.pm | 26 | ||||
-rw-r--r-- | Debian/Debhelper/Buildsystem/python_distutils.pm | 15 |
6 files changed, 26 insertions, 47 deletions
diff --git a/Debian/Debhelper/Buildsystem/autotools.pm b/Debian/Debhelper/Buildsystem/autotools.pm index b94d8e17..74f1652e 100644 --- a/Debian/Debhelper/Buildsystem/autotools.pm +++ b/Debian/Debhelper/Buildsystem/autotools.pm @@ -15,9 +15,9 @@ sub DESCRIPTION { "support for building GNU Autotools based packages" } -sub is_auto_buildable { +sub check_auto_buildable { my $self=shift; - my $action=shift; + my ($action)=@_; # Handle configure; the rest - next class # XXX JEH @@ -30,6 +30,10 @@ sub is_auto_buildable { # actions, it would use the methods inherited from its parent # class. In the above example, that will try to run "make" w/o a # Makefile, which prints a useful error. + # XXX MDX I'm all for it but this will differ from current dh_auto_build + # behaviour (which is that dh_auto_build doesn't fail if + # dh_auto_configure was not run). It is your call whether you are + # willing to break this aspect of backwards compatibility. if ($action eq "configure") { return -x "configure"; } diff --git a/Debian/Debhelper/Buildsystem/cmake.pm b/Debian/Debhelper/Buildsystem/cmake.pm index ff248249..1b5dda40 100644 --- a/Debian/Debhelper/Buildsystem/cmake.pm +++ b/Debian/Debhelper/Buildsystem/cmake.pm @@ -14,11 +14,11 @@ sub DESCRIPTION { "support for building CMake based packages (outside-source tree only)" } -sub is_auto_buildable { +sub check_auto_buildable { my $self=shift; my ($action)=@_; my $ret = -e "CMakeLists.txt"; - $ret &&= $self->SUPER::is_auto_buildable(@_) if $action ne "configure"; + $ret &&= $self->SUPER::check_auto_buildable(@_) if $action ne "configure"; return $ret; } diff --git a/Debian/Debhelper/Buildsystem/makefile.pm b/Debian/Debhelper/Buildsystem/makefile.pm index 286f0f65..0595b0fa 100644 --- a/Debian/Debhelper/Buildsystem/makefile.pm +++ b/Debian/Debhelper/Buildsystem/makefile.pm @@ -8,7 +8,7 @@ package Debian::Debhelper::Buildsystem::makefile; use strict; use Debian::Debhelper::Dh_Lib; -use base 'Debian::Debhelper::Dh_Buildsystem_Basic'; +use base 'Debian::Debhelper::Dh_Buildsystem'; sub get_makecmd_C { my $self=shift; @@ -18,14 +18,6 @@ sub get_makecmd_C { return $self->{makecmd}; } -# XXX JEH I *like* this. Yay for factoring out ugly ugly stuff! -# XXX MDX TODO: this could use dh debian/rules parser. -# XXX JEH That one checks for explicit only targets, while we want -# implicit targets here too. I think the current code is ok; -# it's a bonus that it checks if the target it empty. -# Hmm, one problem is that if a target exists but will run no -# commands since it's already built, the approach below will return -# nothing and assume it doesn't exist. sub exists_make_target { my ($self, $target) = @_; my $makecmd=$self->get_makecmd_C(); @@ -61,12 +53,14 @@ sub new { return $self; } -sub is_auto_buildable { +sub check_auto_buildable { my $self=shift; my ($action) = @_; # Handles build, test, install, clean; configure - next class # XXX JEH shouldn't it also handle configure, just as a no-op? + # XXX MDX No, then cmake.mk would have no chance of hitting for + # no good reason. if (grep /^\Q$action\E$/, qw{build test install clean}) { # This is always called in the source directory, but generally # Makefiles are created (or live) in the the build directory. diff --git a/Debian/Debhelper/Buildsystem/perl_build.pm b/Debian/Debhelper/Buildsystem/perl_build.pm index 550f2a5b..63655304 100644 --- a/Debian/Debhelper/Buildsystem/perl_build.pm +++ b/Debian/Debhelper/Buildsystem/perl_build.pm @@ -8,13 +8,13 @@ package Debian::Debhelper::Buildsystem::perl_build; use strict; use Debian::Debhelper::Dh_Lib; -use base 'Debian::Debhelper::Dh_Buildsystem_Basic'; +use base 'Debian::Debhelper::Dh_Buildsystem'; sub DESCRIPTION { "support for building Perl Build.PL based packages (in-source only)" } -sub is_auto_buildable { +sub check_auto_buildable { my ($self, $action) = @_; # Handles everything @@ -25,6 +25,8 @@ sub is_auto_buildable { # succeed, silently do nothing. Perhaps it would be better, then, # to omit the test below. Then, it would try to run ./Build # which doesn't exist, which should result in a semi-useful error. + # XXX MDX Agreed. But it would not be fully backwards compatible + # (see comment in autotools.mk why). Your call. if ($action ne "configure") { $ret &&= -e "Build"; } diff --git a/Debian/Debhelper/Buildsystem/perl_makemaker.pm b/Debian/Debhelper/Buildsystem/perl_makemaker.pm index 91a0da3d..29570166 100644 --- a/Debian/Debhelper/Buildsystem/perl_makemaker.pm +++ b/Debian/Debhelper/Buildsystem/perl_makemaker.pm @@ -14,23 +14,19 @@ sub DESCRIPTION { "support for building Perl MakeMaker based packages (in-source only)" } -sub is_auto_buildable { - my ($self, $action)=@_; +sub check_auto_buildable { + my $self=shift; + my ($action)=@_; # Handles configure, install; the rest - next class if ($action eq "install") { - # This hack is needed to keep full 100% compatibility with previous - # debhelper versions. - # XXX JEH perl_makemaker comes before makefile, so - # couldn't it instead just test for Makefile.PL? - if (-e "Makefile" && - system('grep -q "generated automatically by MakeMaker" Makefile') == 0) { - return 1; - } + return -e "Makefile.PL"; } # XXX JEH why test for configure here? If building or cleaning, and # a Makefile.PL exists, we know this class can handle those # actions -- it does so by inheriting from the makefile class. + # XXX MDX Yes. But that's again different behaviour from current + # (see comment in autotools.mk). Your call. elsif ($action eq "configure") { return -e "Makefile.PL"; } @@ -57,15 +53,7 @@ sub configure { sub install { my $self=shift; my $destdir=shift; - # XXX JEH this test seems redundant with the one in - # is_auto_buildable, if we get here we know that one succeeded. - if (-e "Makefile" && - system('grep -q "generated automatically by MakeMaker" Makefile') == 0) { - $self->SUPER::install($destdir, "PREFIX=/usr", @_); - } - else { - $self->SUPER::install($destdir, @_); - } + $self->SUPER::install($destdir, "PREFIX=/usr", @_); } 1; diff --git a/Debian/Debhelper/Buildsystem/python_distutils.pm b/Debian/Debhelper/Buildsystem/python_distutils.pm index 0b8367ec..0061a442 100644 --- a/Debian/Debhelper/Buildsystem/python_distutils.pm +++ b/Debian/Debhelper/Buildsystem/python_distutils.pm @@ -9,23 +9,14 @@ package Debian::Debhelper::Buildsystem::python_distutils; use strict; use Debian::Debhelper::Dh_Lib; -use base 'Debian::Debhelper::Dh_Buildsystem_Basic'; +use base 'Debian::Debhelper::Dh_Buildsystem'; sub DESCRIPTION { "support for building Python distutils based packages" } -sub is_auto_buildable { - my $self=shift; - my $action=shift; - - # Handle build install clean; the rest - next class - # XXX JEH shouldn't it also handle configure? It would be handled - # by doing nothing, but that's what's appropriate for python. - if (grep(/^\Q$action\E$/, qw{build install clean})) { - return -e "setup.py"; - } - return 0; +sub check_auto_buildable { + return -e "setup.py"; } sub setup_py { |