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

dmn at users.alioth.debian.org dmn at users.alioth.debian.org
Wed Feb 24 20:15:39 UTC 2010


Author: dmn
Date: Wed Feb 24 20:15:27 2010
New Revision: 53322

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=53322
Log:
add_quilt(): add --with=quilt to dh calls in dh7tiny-style rules

falls back to quilt.make + $(QUILT_STAMPFN) + unpatch for non-dh7tiny rules

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=53322&op=diff
==============================================================================
--- trunk/dh-make-perl/TODO (original)
+++ trunk/dh-make-perl/TODO Wed Feb 24 20:15:27 2010
@@ -25,6 +25,4 @@
   files and look them in the apt file contents. Lots of work for little gain.
 * --refresh: add --only <file> option: done, but "--only control" also
   touches d/rules if quilt is used
-* quiltification: switch to "--with quilt" in d/rules and adjust build deps
-  in non-'3.0 (quilt)' source formats
 * --make should use Debian::Control::FromCPAN for dependencies

Modified: trunk/dh-make-perl/lib/DhMakePerl.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/dh-make-perl/lib/DhMakePerl.pm?rev=53322&op=diff
==============================================================================
--- trunk/dh-make-perl/lib/DhMakePerl.pm (original)
+++ trunk/dh-make-perl/lib/DhMakePerl.pm Wed Feb 24 20:15:27 2010
@@ -1317,20 +1317,50 @@
     tie @rules, 'Tie::File', $self->debian_file('rules')
         or die "Unable to read rules: $!";
 
-    splice @rules, 1, 0, ( '', 'include /usr/share/quilt/quilt.make' )
-        unless grep /quilt\.make/, @rules;
-
-    push @rules,
-        '',
-        'override_dh_auto_configure: $(QUILT_STAMPFN)',
-        "\tdh_auto_configure"
-        unless grep /QUILT_STAMPFN/, @rules;
-
-    push @rules,
-        '',
-        'override_dh_auto_clean: unpatch',
-        "\tdh_auto_clean"
-        unless grep /override_dh_auto_clean:.*unpatch/, @rules;
+    my $quiltified = 0;
+    my $dh7tiny = 0;
+
+    # check if rules are dh7-tiny
+    for ( my $i = 1; $i < @rules; $i++ ) {
+        if (    $rules[$i] eq '%:'
+            and $i + 1 < @rules
+            and $rules[ $i + 1 ] =~ /^\tdh .*\$\@/ )
+        {
+            $dh7tiny = 1;
+
+            if ( $rules[ $i + 1 ] =~ /--with[ =]quilt/ ) {
+                $quiltified = 1;
+                last;
+            }
+        }
+    }
+
+    unless ($quiltified) {
+        if ($dh7tiny) {
+            for (@rules) {
+                # add --with=quilt to every dh call
+                s/(?<=\s)dh /dh --with=quilt /
+                    unless /--with[= ]quilt/;   # unless it is already there
+            }
+        }
+        else {
+            # non-dh7tiny
+            splice @rules, 1, 0, ( '', 'include /usr/share/quilt/quilt.make' )
+                unless grep /quilt\.make/, @rules;
+
+            push @rules,
+                '',
+                'override_dh_auto_configure: $(QUILT_STAMPFN)',
+                "\tdh_auto_configure"
+                unless grep /QUILT_STAMPFN/, @rules;
+
+            push @rules,
+                '',
+                'override_dh_auto_clean: unpatch',
+                "\tdh_auto_clean"
+                unless grep /override_dh_auto_clean:.*unpatch/, @rules;
+        }
+    }
 
     # README.source
     my $quilt_mini_doc = <<EOF;




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