r56123 - in /trunk/dh-make-perl: lib/Debian/Rules.pm t/rules.t
dmn at users.alioth.debian.org
dmn at users.alioth.debian.org
Thu Apr 15 09:22:24 UTC 2010
Author: dmn
Date: Thu Apr 15 09:22:17 2010
New Revision: 56123
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=56123
Log:
Rules/drop_quilt: more careful white-space trimming
the old code removed the new line character too when --with=quilt is
at the end of the line
Modified:
trunk/dh-make-perl/lib/Debian/Rules.pm
trunk/dh-make-perl/t/rules.t
Modified: trunk/dh-make-perl/lib/Debian/Rules.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/dh-make-perl/lib/Debian/Rules.pm?rev=56123&op=diff
==============================================================================
--- trunk/dh-make-perl/lib/Debian/Rules.pm (original)
+++ trunk/dh-make-perl/lib/Debian/Rules.pm Thu Apr 15 09:22:17 2010
@@ -299,7 +299,14 @@
# drop --with=quilt from dh command line
for (@$lines) {
- s/dh (.*)--with[= ]quilt\s*/dh $1/g;
+ while ( /dh (.*)--with[= ]quilt(.*)\n/ ) {
+ my ( $before, $after ) = ( $1, $2 );
+ $after =~ s/\s+$//; # remove trailing spaces
+ $after =~ s/^\s+// if $before =~ /\s$/; # collapse adjascent spaces
+ $before =~ s/\s+$// if $after eq ''; # more trailing spaces
+ $after =~ s/^\s+// if $before eq ''; # extra leading space
+ s/dh (.*)--with[= ]quilt(.*)\n/dh $before$after\n/;
+ }
}
}
Modified: trunk/dh-make-perl/t/rules.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/dh-make-perl/t/rules.t?rev=56123&op=diff
==============================================================================
--- trunk/dh-make-perl/t/rules.t (original)
+++ trunk/dh-make-perl/t/rules.t Thu Apr 15 09:22:17 2010
@@ -3,7 +3,7 @@
use strict;
use warnings;
-use Test::More tests => 3;
+use Test::More tests => 8;
BEGIN {
use_ok('Debian::Rules');
@@ -14,3 +14,32 @@
is( @{ $r->lines }, 3, 'lines initialized properly' );
ok( $r->is_dh7tiny, "Detects simple dh7tiny-style rules" );
+
+$r = Debian::Rules->new(
+ { lines => [
+ "#!/usr/bin/make -f\n",
+ "%:\n",
+ "\tdh \$\@ --with=quilt\n",
+ "\n",
+ "# something else goes here\n",
+ ]
+ }
+);
+ok( $r->is_dh7tiny, "Detects dh7 in dh7tiny+quilt" );
+ok( $r->is_quiltified, "Detects --with=quilt" );
+$r->drop_quilt;
+is( $r->lines->[2], "\tdh \$\@\n", 'Dequiltification works' );
+is( scalar @{ $r->lines }, 5, "Dequiltification doesn't cut lines" );
+
+$r = Debian::Rules->new(
+ { lines => [
+ "#!/usr/bin/make -f\n",
+ "%:\n",
+ "\tdh --with=quilt \$\@\n",
+ "\n",
+ "# something else goes here\n",
+ ]
+ }
+);
+$r->drop_quilt;
+is( $r->lines->[2], "\tdh \$\@\n", 'Dequiltification works with --with=quilt in the middle' );
More information about the Pkg-perl-cvs-commits
mailing list