r53208 - in /trunk/dh-make-perl: TODO lib/DhMakePerl.pm

dmn at users.alioth.debian.org dmn at users.alioth.debian.org
Mon Feb 22 19:36:15 UTC 2010


Author: dmn
Date: Mon Feb 22 19:36:03 2010
New Revision: 53208

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=53208
Log:
move detection of mimimum debhelper/quilt version to a new subroutine

Modified:
    trunk/dh-make-perl/TODO
    trunk/dh-make-perl/lib/DhMakePerl.pm

Modified: trunk/dh-make-perl/TODO
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/dh-make-perl/TODO?rev=53208&op=diff
==============================================================================
--- trunk/dh-make-perl/TODO (original)
+++ trunk/dh-make-perl/TODO Mon Feb 22 19:36:03 2010
@@ -33,6 +33,3 @@
 * detect needed debhelper version
   - if Module::AutoInstall is used, 7.2.13 is needed for proper --skipdeps
     passing
-  - rules overrides need 7.0.50
-  - dh --with needs 7.0.8 and quilt 0.46-7
-  + all this (and possibly others) should go in a specialized subroutine

Modified: trunk/dh-make-perl/lib/DhMakePerl.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/dh-make-perl/lib/DhMakePerl.pm?rev=53208&op=diff
==============================================================================
--- trunk/dh-make-perl/lib/DhMakePerl.pm (original)
+++ trunk/dh-make-perl/lib/DhMakePerl.pm Mon Feb 22 19:36:03 2010
@@ -259,6 +259,7 @@
                 warn "Dependencies not updated.\n";
             }
 
+            $self->discover_utility_deps($control);
             $control->prune_perl_deps();
 
             $self->backup_file( $self->debian_file('control') );
@@ -1304,9 +1305,8 @@
 =item add_quilt( $control )
 
 Plugs quilt into F<debian/rules> and F<debian/control>. Depends on
-F<debian/rules> being in DH7 three-liner format. Also bumps the debhelper
-build-dependency to 7.0.50 (the first version to support overrides) and adds
-debian/README.source documenting quilt usage.
+F<debian/rules> being in DH7 three-liner format. Also adds debian/README.source
+documenting quilt usage.
 
 =cut
 
@@ -1331,13 +1331,6 @@
         'override_dh_auto_clean: unpatch',
         "\tdh_auto_clean"
         unless grep /override_dh_auto_clean:.*unpatch/, @rules;
-
-    # add build-dependency on quilt
-    $control->source->Build_Depends->add('quilt');
-
-    # bump build-dependency of DH to 7.0.50
-    $control->source->Build_Depends->add('debhelper (>= 7.0.50)');
-        # a later prune() will remove redundant >= 7
 
     # README.source
     my $quilt_mini_doc = <<EOF;
@@ -1380,7 +1373,7 @@
 
 =item drop_quilt( $control )
 
-removes quilt from F<debian/rules> and F<debian/control>. Expects that
+removes quilt from F<debian/rules>. Expects that
 L<|add_quilt> was used to add quilt to F<debian/rules>.
 
 If F<debian/README.source> exists, references to quilt are removed from it (and
@@ -1435,15 +1428,6 @@
     # drop --with=quilt from dh command line
     for(@rules) {
         s/dh (.*)--with[= ]quilt\s*/dh $1/g;
-    }
-
-    # remove build-dependency on quilt
-    $control->source->Build_Depends->remove('quilt');
-
-    # if no overrides are used, lower dh dependency from 7.0.50 to 7
-    if( not grep /^override_dh_/, @rules ) {
-        $control->source->Build_Depends->remove('debhelper (>= 7.0.50)');
-        $control->source->Build_Depends->add('debhelper (>= 7)');
     }
 
     # README.source
@@ -2174,6 +2158,54 @@
     return ( -f $self->main_file('Build.PL') ) ? "Module-Build" : "MakeMaker";
 }
 
+=item discover_utility_deps
+
+Determines whether a certain version of L<debhelper(1)> or L<quilt(1)> is
+needed by the build process.
+
+The following special cases are detected:
+
+=over
+
+=item dh --with=quilt
+
+C<dh --with=quilt> needs debhelper 7.0.8 and quilt 0.46-7.
+
+=item quilt.make
+
+If F</usr/share/quilt/quilt.make> is included in F<debian/rules>, a
+build-dependency on C<quilt> is added.
+
+=item dhebhelper override targets
+
+Targets named C<override_dh_...> are supported by debhelper since 7.0.50
+
+=back
+
+=cut
+
+sub discover_utility_deps {
+    my ( $self, $control ) = @_;
+
+    my $deps = $control->source->Build_Depends;
+
+    # remove any existing dependencies
+    $deps->remove( 'quilt', 'debhelper' );
+
+    # start with the minimum
+    $deps->add( Debian::Dependency->new( 'debhelper', $self->cfg->dh ) );
+
+    my $rules = $self->_file_r( $self->debian_file('rules') );
+    while ( defined( $_ = <$rules> ) ) {
+        $deps->add( 'debhelper (>= 7.0.8)', 'quilt (>= 0.46-7)' )
+            if /dh\s+.*--with[= ]quilt/;
+        $deps->add('debhelper (>= 7.0.50)')
+            if /^override_dh_/;
+        $deps->add('quilt')
+            if m{^include /usr/share/quilt/quilt.make};
+    }
+}
+
 sub _warn_incomplete_copyright {
     my $self = shift;
 




More information about the Pkg-perl-cvs-commits mailing list