Your message dated Wed, 18 Nov 2009 21:35:29 +0000
with message-id <[email protected]>
and subject line Bug#555805: fixed in debhelper 7.4.4
has caused the Debian Bug report #555805,
regarding Autoselect a more specific buildsystem if it is available
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
555805: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=555805
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: debhelper
Version: 7.4.3
Severity: wishlist
Tags: patch

This patch alters build system auto-selection process a bit and allows dh_auto_*
to pick up a more specific derived build system than the first buildable one
from the @BUILDSYSTEMS array. The main advantage of this method is to allow
more specific build systems which are below the main one (e.g. cmake vs
makefile) to make some compatibility non-breaking changes to the build process
in auto-selection mode.

1) The first check_auto_buildable() build system found in the order of
@BUILDSYSTEMS is always considered to be the main. The build system further in
the @BUILDSYSTEMS array may only be auto-selected if it is
check_auto_buildable() as well AND it is derived from the "main" build system
(this condition ensures it is similar to the main one).

2) The deeper a build system is in the inheritance tree, the more specific it
is assumed to be. Auto selection process chooses the most specific build system.
If a couple of build systems are found on the same specificness level, the one
coming earlier in the @BUILDSYSTEMS is preferred.

This method still allows to keep backwards compatibility because auto-selectable
build systems are shipped only with debhelper. This should be enough to ensure
that compatibility breaking changes do not to slip to derived build systems.

-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (101, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.31-1-amd64 (SMP w/1 CPU core)
Locale: LANG=lt_LT.UTF-8, LC_CTYPE=lt_LT.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages debhelper depends on:
ii  binutils                      2.20-3     The GNU assembler, linker and bina
ii  dpkg-dev                      1.15.4.1   Debian package development tools
ii  file                          5.03-3     Determines file type using "magic"
ii  html2text                     1.3.2a-14  advanced HTML to text converter
ii  man-db                        2.5.6-4    on-line manual pager
ii  perl                          5.10.1-7   Larry Wall's Practical Extraction 
ii  perl-base                     5.10.1-7   minimal Perl system
ii  po-debconf                    1.0.16     tool for managing templates file t

debhelper recommends no packages.

Versions of packages debhelper suggests:
pn  dh-make                       <none>     (no description available)

-- no debconf information
--- Begin Message ---
This patch alters build system auto-selection process a bit and allows dh_auto_*
to pick up a more specific derived build system than the first buildable one
from the @BUILDSYSTEMS array. The main advantage of this method is to allow
more specific build systems which are below the main one (e.g. cmake vs
makefile) to make some compatibility non-breaking changes to the build process
in auto-selection mode.

1) The first check_auto_buildable() build system found in the order of
@BUILDSYSTEMS is always considered to be the main. The build system further in
the @BUILDSYSTEMS array may only be auto-selected if it is
check_auto_buildable() as well AND it is derived from the "main" build system
(this condition ensures it is similar to the main one).

2) The deeper a build system is in the inheritance tree, the more specific it
is assumed to be. Auto selection process chooses the most specific build system.
If a couple of build systems are found on the same specificness level, the one
coming earlier in the @BUILDSYSTEMS is preferred.

This method still allows to keep backwards compatibility because auto-selectable
build systems are shipped only with debhelper. This should be enough to ensure
that compatibility breaking changes do not to slip to derived build systems.

Signed-off-by: Modestas Vainius <[email protected]>

---
 Debian/Debhelper/Dh_Buildsystems.pm |   41 ++++++++++++++++++++++++++++++++++-
 t/buildsystems/buildsystem_tests    |   38 ++++++++++++++++++++++----------
 2 files changed, 66 insertions(+), 13 deletions(-)

diff --git a/Debian/Debhelper/Dh_Buildsystems.pm 
b/Debian/Debhelper/Dh_Buildsystems.pm
index a9a13a2..7644d3e 100644
--- a/Debian/Debhelper/Dh_Buildsystems.pm
+++ b/Debian/Debhelper/Dh_Buildsystems.pm
@@ -54,6 +54,27 @@ sub create_buildsystem_instance {
        return $module->new(%bsopts);
 }
 
+# Checks if $class is derived from the $ref class and returns the depth of the
+# $refclass in $class inheritance tree (0 or higher). If $class is not a
+# derivative of $refclass, returns -1.
+sub get_isadepth {
+       my $class=shift;
+       my $refclass=shift;
+       $class = ref($class) if ref $class;
+       $refclass = ref($refclass) if ref $refclass;
+
+       return 0 if $class eq $refclass;
+
+       my @isa = eval('@'.$class.'::ISA');
+       for my $parent (@isa) {
+               my $depth = get_isadepth($parent, $refclass);
+               if ($depth >= 0) {
+                       return $depth + 1;
+               }
+       }
+       return -1;
+}
+
 # Similar to create_build system_instance(), but it attempts to autoselect
 # a build system if none was specified. In case autoselection fails, undef
 # is returned.
@@ -66,11 +87,29 @@ sub load_buildsystem {
        }
        else {
                # Try to determine build system automatically
+               my @buildable;
                for $system (@BUILDSYSTEMS) {
                        my $inst = create_buildsystem_instance($system, @_);
                        if ($inst->check_auto_buildable($step)) {
-                               return $inst;
+                               push @buildable, $inst;
+                       }
+               }
+               if (@buildable > 0) {
+                       return $buildable[0] if @buildable == 1;
+
+                       # If more than one build system is buildable, choose 
the first most
+                       # specific derivative of the first (aka main) buildable 
build
+                       # system.
+                       my $maxdepth = 0;
+                       my $autobs = $buildable[0];
+                       for my $bs (@buildable[1..$#buildable]) {
+                               my $depth = get_isadepth($bs, $buildable[0]);
+                               if ($depth > $maxdepth) {
+                                       $maxdepth = $depth;
+                                       $autobs = $bs;
+                               }
                        }
+                       return $autobs;
                }
        }
        return;
diff --git a/t/buildsystems/buildsystem_tests b/t/buildsystems/buildsystem_tests
index 0465a93..e68e997 100755
--- a/t/buildsystems/buildsystem_tests
+++ b/t/buildsystems/buildsystem_tests
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 
-use Test::More tests => 277;
+use Test::More tests => 283;
 
 use strict;
 use warnings;
@@ -248,10 +248,13 @@ mkdir $builddir;
        sourcedir => $tmpdir
 );
 
+$bs{makefile} = load_buildsystem("makefile", undef, %tmp);
 $bs{autoconf} = load_buildsystem("autoconf", undef, %tmp);
 $bs{cmake} = load_buildsystem("cmake", undef, %tmp);
 $bs{perl_mm} = load_buildsystem("perl_makemaker", undef, %tmp);
-$bs = load_buildsystem("makefile", undef, %tmp);
+$bs{perl_build} = load_buildsystem("perl_build", undef, %tmp);
+$bs{python_distutils} = load_buildsystem("python_distutils", undef, %tmp);
+$bs = $bs{makefile};
 
 test_check_auto_buildable($bs{autoconf}, "no configure", 0);
 test_check_auto_buildable($bs{cmake}, "no CMakeLists.txt", 0);
@@ -281,21 +284,34 @@ touch "$tmpdir/Makefile";
 test_check_auto_buildable($bs{perl_mm}, "Makefile.PL+Makefile", 1);
 
 # Perl Build.PL - handles always
-$bs = load_buildsystem("perl_build", undef, %tmp);
-test_check_auto_buildable($bs, "no Build.PL", 0);
+test_check_auto_buildable($bs{perl_build}, "no Build.PL", 0);
 touch "$tmpdir/Build.PL";
-test_check_auto_buildable($bs, "Build.PL", { configure => 1 });
+test_check_auto_buildable($bs{perl_build}, "Build.PL", { configure => 1 });
 touch "$tmpdir/Build"; # forced in source
-test_check_auto_buildable($bs, "Build.PL+Build", 1);
+test_check_auto_buildable($bs{perl_build}, "Build.PL+Build", 1);
 
 # Python Distutils
-$bs = load_buildsystem("python_distutils", undef, %tmp);
-test_check_auto_buildable($bs, "no setup.py", 0);
+test_check_auto_buildable($bs{python_distutils}, "no setup.py", 0);
 touch "$tmpdir/setup.py";
-test_check_auto_buildable($bs, "setup.py", 1);
+test_check_auto_buildable($bs{python_distutils}, "setup.py", 1);
 
 cleandir($tmpdir);
 
+# Test get_isadepth()
+my $get_isadepth = \&Debian::Debhelper::Dh_Buildsystems::get_isadepth;
+is ( &$get_isadepth($bs{autoconf}, $bs{autoconf}), 0,
+       "get_isadepth(): autoconf - same class" );
+is ( &$get_isadepth($bs{perl_build}, $bs{perl_build}), 0,
+       "get_isadepth(): perl_build - same class" );
+is ( &$get_isadepth($bs{autoconf}, $bs{makefile}), 1,
+       "get_isadepth(): autoconf vs makefile" );
+is ( &$get_isadepth($bs{cmake}, 'Debian::Debhelper::Buildsystem' ), 2,
+       "get_isadepth(): cmake vs Debian::Debhelper::Buildsystem" );
+is ( &$get_isadepth($bs{autoconf}, $bs{perl_build}), -1,
+       "get_isadepth(): autoconf vs perl_build" );
+is ( &$get_isadepth($bs{python_distutils}, $bs{makefile}), -1,
+       "get_isadepth(): python_distutils vs makefile" );
+
 ### Now test if it can autoselect a proper buildsystem for a typical package
 sub test_autoselection {
        my $system=shift;
@@ -347,9 +363,7 @@ cleandir $tmpdir;
 # CMake
 touch "$tmpdir/CMakeLists.txt";
 touch "$builddir/Makefile";
-test_autoselection("cmake",
-    { configure => "cmake", build => "makefile",
-      test => "makefile", install => "makefile", clean => "makefile" }, %tmp);
+test_autoselection("cmake", "cmake", %tmp);
 cleandir $tmpdir;
 
 ### Test Buildsystem::rmdir_builddir()
-- 
tg: (07e276d..) patch/isa_bs_autoselection (depends on: master)

--- End Message ---

--- End Message ---
--- Begin Message ---
Source: debhelper
Source-Version: 7.4.4

We believe that the bug you reported is fixed in the latest version of
debhelper, which is due to be installed in the Debian FTP archive:

debhelper_7.4.4.dsc
  to main/d/debhelper/debhelper_7.4.4.dsc
debhelper_7.4.4.tar.gz
  to main/d/debhelper/debhelper_7.4.4.tar.gz
debhelper_7.4.4_all.deb
  to main/d/debhelper/debhelper_7.4.4_all.deb



A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to [email protected],
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Joey Hess <[email protected]> (supplier of updated debhelper package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [email protected])


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Format: 1.8
Date: Wed, 18 Nov 2009 14:44:21 -0500
Source: debhelper
Binary: debhelper
Architecture: source all
Version: 7.4.4
Distribution: unstable
Urgency: low
Maintainer: Joey Hess <[email protected]>
Changed-By: Joey Hess <[email protected]>
Description: 
 debhelper  - helper programs for debian/rules
Closes: 532805 548382 554509 555659 555677 555805 555807 555899 556384
Changes: 
 debhelper (7.4.4) unstable; urgency=low
 .
   * The makefile buildsystem (and derived buildsystems cmake, autoconf, etc)
     now supports parallel building by default, as specified via
     DEB_BUILD_OPTIONS. Closes: #532805
   * dh_auto_*: Add --max-parallel option that can be used to control
     or disable parallel building. --max-parallel=1 will disable parallel
     building, while --max-parallel=N will limit the maximum number of
     parallel processes that can be specified via DEB_BUILD_OPTIONS.
   * Added some hacks to avoid warnings about unavailable jobservers when
     debhelper runs make, and the parent debian/rules was run in parallel
     mode (as dpkg-buildpackage -j currently does).
   * Thanks, Modestas Vainius for much of the work on parallel build support.
   * Add deprecation warnings for -u to the documentation, since putting
     options after -- is much more sane. (However, -u will not go away any
     time soon.) Closes: #554509
   * Separate deprecated programs in the list of commands in debhelper(7).
     Closes: #548382
   * Adjust code to add deprecation warning for compatibility level 4.
     (Man page already said it was deprecated.) Closes: #555899
   * dh_installdocs: Warn if a doc-base file cannot be parsed to find a
     document id. Closes: #555677
   * Typo. Closes: #555659
   * cmake: Set CTEST_OUTPUT_ON_FAILURE when running test suite.
     Closes: #555807 (Modestas Vainius)
   * autoconf: If configure fails, display config.log. Intended to make
     it easier to debug configure script failures on autobuilders.
     Closes: #556384
   * Improve build system autoselection process; this allows cmake to be
     autoselected for steps after configure, instead of falling back to
     makefile once cmake generated a makefile. Closes: #555805
     (Modestas Vainius)
Checksums-Sha1: 
 72684bf4512676e0e5792931473ac4414002a60d 1547 debhelper_7.4.4.dsc
 dce8fc35de852743dcaced4b69b28dac46b94c32 346944 debhelper_7.4.4.tar.gz
 c6085d152588337c16d9c91088d1de00c27427ac 456988 debhelper_7.4.4_all.deb
Checksums-Sha256: 
 c8d77d94390117dd8198e12a96080c2e734cb2ee2aef243caf8e88b9aa3105e2 1547 
debhelper_7.4.4.dsc
 832fdb0718483667e2d1400f3553de8a20bed782c77ba4538736c08b457ffa31 346944 
debhelper_7.4.4.tar.gz
 7b247d9dc292ca092f83080b56b86263bfebd728e0ee2971928fbd7cddd256bb 456988 
debhelper_7.4.4_all.deb
Files: 
 d6d3d3fd964b50715434afcf462aef31 1547 devel optional debhelper_7.4.4.dsc
 655ce94cf8c0f1d6cd1e9fe1925cb085 346944 devel optional debhelper_7.4.4.tar.gz
 61b3d758e18662b8606a8173236844c8 456988 devel optional debhelper_7.4.4_all.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iQIVAwUBSwRPpskQ2SIlEuPHAQj0JQ/9G4MHTp7ZY5O9VMmN0Ppph7YALhKI2Hs1
PPQhShPrd5Q9k1kqoAZX0mBnnxF19SbgeCHbU96vGda+PPfsdj6OJA22Er7Eo5V+
FGvRZSK/xg/iN+dhDSqjno5OxSfUTa/5kNNVHSpVJiPywvADxWft8DIZgI7kfkVB
xVqGip1HU+qoVPBCwxDYsf4H/bNXIVwofLy3TKW0QVIEDZHwKCQ9LxNRG36hKto8
Rp6SlIyz24zF2yYKUGlMxOnBlTOz1CM1+ZjttW0/KUuy86CCfMUAlJqWYeiH8cAH
mWDIFDmnl0RL5jmcukJCo9rPCCaMZuo9t720xWOt+FcZJ0a23/m4Cqrwtdpo3cyS
OVlHMyK8A6AhPXKU3GSR7RduvCk2jddfIN5rCjvNY2WLJ4LpJmHwo14bPzWwFoNt
vpiuWtqOauFhcWAeKyC1zm3uXQyiwMAdjhfwhjWgcYwMJGywZF2NSj6xnBM9eysL
0jYP81ZoDWQNPMsURViZ0BuDiZeAebVpEcUDYCWEDDTgG19Gxi0BdH6u7ilM0HeZ
LHyU92QX/LgZnTA0RtkpxNg7ZAXWlp7megXQXfKbCfQ7gGQ+u4OBCBxc2TBdKG7M
ETl9YkxP0YbBX/mDj6gpG4JF482dOmmfULO8DH8bkjH3ye4vBhyUaSc+ohNHdQXK
PYsOsmEhayE=
=CptE
-----END PGP SIGNATURE-----



--- End Message ---

Reply via email to