r66563 - in /trunk/dh-make-perl: debian/ lib/Debian/Control/ t/ t/dists/Strange-2.1/wanted-debian--refresh--source-format=3.0_quilt/ t/dists/Strange-2.1/wanted-debian--refresh/ t/dists/Strange-2.1/wanted-debian/
dmn at users.alioth.debian.org
dmn at users.alioth.debian.org
Tue Dec 28 17:42:30 UTC 2010
Author: dmn
Date: Tue Dec 28 17:42:19 2010
New Revision: 66563
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=66563
Log:
Control::Stanza: split dependency lists one package per line
Having them this way makes changes more VCS-friendly.
Exception are dependencies in the form ${...} which are left on a single line
(wrapped if necessary)
Modified:
trunk/dh-make-perl/debian/changelog
trunk/dh-make-perl/lib/Debian/Control/Stanza.pm
trunk/dh-make-perl/t/Control.t
trunk/dh-make-perl/t/dists/Strange-2.1/wanted-debian--refresh--source-format=3.0_quilt/control
trunk/dh-make-perl/t/dists/Strange-2.1/wanted-debian--refresh/control
trunk/dh-make-perl/t/dists/Strange-2.1/wanted-debian/control
Modified: trunk/dh-make-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/dh-make-perl/debian/changelog?rev=66563&op=diff
==============================================================================
--- trunk/dh-make-perl/debian/changelog (original)
+++ trunk/dh-make-perl/debian/changelog Tue Dec 28 17:42:19 2010
@@ -29,6 +29,8 @@
(Closes: 602059)
* Support distribution names as arguments to --cpan (Closes: #607998)
* Fix tests to stringify when comparing overloaded objects with strings
+ * Control::Stanza: split dependency lists one package per line in order to
+ make changes more VCS-friendly
-- Peter Pentchev <roam at ringlet.net> Sun, 19 Dec 2010 20:43:10 +0200
Modified: trunk/dh-make-perl/lib/Debian/Control/Stanza.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/dh-make-perl/lib/Debian/Control/Stanza.pm?rev=66563&op=diff
==============================================================================
--- trunk/dh-make-perl/lib/Debian/Control/Stanza.pm (original)
+++ trunk/dh-make-perl/lib/Debian/Control/Stanza.pm Tue Dec 28 17:42:19 2010
@@ -229,21 +229,22 @@
return $self->STORE( $field, $value );
}
-=item as_string($width)
+=item as_string([$width])
Returns a string representation of the object. Ready to be printed into a
real F<debian/control> file. Used as a stringification operator.
-If non-zero I<$width> is given, the text is wrapped at that position. If no
-I<$width> is given the text is wrapped at position 80. To disable wrapping,
-supply a value of 0.
-
-=cut
+Fields that are comma-separated use one line per item, except if they are like
+C<${some:Field}>, in which case they are wrapped at I<$width>th column.
+I<$width> defaults to 80.
+
+=cut
+
+use Text::Wrap ();
sub as_string
{
- my( $self, $width ) = @_;
-
+ my ( $self, $width ) = @_;
$width //= 80;
my @lines;
@@ -252,30 +253,52 @@
for my $k ( $self->Keys ) {
# We don't' want the internal fields showing in the output
- next if $k =~ /^-/; # _ in fielld names is replaced with dashes
+ next if $k =~ /^-/; # _ in field names is replaced with dashes
my $v = $self->FETCH($k);
next unless defined($v);
next if $self->is_dependency_list($k) and "$v" eq "";
next if $self->is_comma_separated($k) and "$v" eq "";
- my $line = "$k: $v";
-
- if( $self->is_comma_separated($k) ) {
- while( length($line) > $width and $line =~ /,/s ) {
- my $rest;
- while( length($line) > $width and $line =~ /,/s ) {
- # chop-off the last entry
- $line =~ /^(.+)\s*,\s*([^,]*)$/s;
- $line = $1;
- $rest = join( ', ', $2, $rest||() );
+ my $line;
+
+ if ( $self->is_comma_separated($k) ) {
+ # FIXME: this relies on $v being sorted
+ my ( @pre_dollar, @dollar, @post_dollar );
+ for ( @$v ) {
+ if ( /^\${.+}$/ ) {
+ push @dollar, $_;
}
-
- # at this point $line is under $width long (or can't be
- # shortened further)
- push @lines, $line . ( $rest ? ',' : '' );
- $line = " $rest" if $rest;
+ elsif (@dollar) {
+ push @post_dollar, $_;
+ }
+ else {
+ push @pre_dollar, $_;
+ }
}
+
+ if ( @pre_dollar ) {
+ $line = "$k: " . join( ",\n ", @pre_dollar );
+ local $Text::Warp::break = qr/, /;
+ local $Text::Warp::columns = $width;
+ local $Text::Wrap::separator = ",\n";
+ local $Text::Wrap::huge = 'overflow';
+ $line .= Text::Wrap::wrap( ' ', ' ', join( ', ', @dollar ) );
+ }
+ else {
+ local $Text::Warp::break = qr/, /;
+ local $Text::Warp::columns = $width;
+ local $Text::Wrap::separator = ",\n";
+ local $Text::Wrap::huge = 'overflow';
+ $line
+ = Text::Wrap::wrap( "$k: ", ' ', join( ', ', @dollar ) );
+ }
+
+ $line = join( ",\n ", $line, @post_dollar );
}
+ else {
+ $line = "$k: $v";
+ }
+
push @lines, $line if $line;
}
Modified: trunk/dh-make-perl/t/Control.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/dh-make-perl/t/Control.t?rev=66563&op=diff
==============================================================================
--- trunk/dh-make-perl/t/Control.t (original)
+++ trunk/dh-make-perl/t/Control.t Tue Dec 28 17:42:19 2010
@@ -31,11 +31,16 @@
Source: libtest-compile-perl
Section: perl
Priority: optional
-Build-Depends: debhelper (>= 7), libmodule-build-perl, libtest-simple-perl
-Build-Depends-Indep: libtest-pod-coverage-perl, libtest-pod-perl,
- libuniversal-require-perl, perl
+Build-Depends: debhelper (>= 7),
+ libmodule-build-perl,
+ libtest-simple-perl
+Build-Depends-Indep: libtest-pod-coverage-perl,
+ libtest-pod-perl,
+ libuniversal-require-perl,
+ perl
Maintainer: Debian Perl Group <pkg-perl-maintainers at lists.alioth.debian.org>
-Uploaders: Damyan Ivanov <dmn at debian.org>, Gregor Herrmann <gregoa at debian.org>,
+Uploaders: Damyan Ivanov <dmn at debian.org>,
+ Gregor Herrmann <gregoa at debian.org>,
Gunnar Wolf <gwolf at debian.org>
Standards-Version: 3.8.3
Homepage: http://search.cpan.org/dist/Test-Compile/
@@ -44,7 +49,8 @@
Package: libtest-compile-perl
Architecture: all
-Depends: ${misc:Depends}, ${perl:Depends}, libuniversal-require-perl
+Depends: ${misc:Depends}, ${perl:Depends},
+ libuniversal-require-perl
Description: check whether Perl module files compile correctly
Test::Compile can be used in module test suites to verify that everything
compiles correctly. This description is artifitially prolonged, in order to be
@@ -99,7 +105,9 @@
);
is( "$b", <<EOF );
Package: foo
-Depends: libfoo-perl (>= 0.44839848), libbar-perl,
- libbaz-perl (>= 4.59454345345485), libtreshchotka-moo (>= 5.6),
+Depends: libfoo-perl (>= 0.44839848),
+ libbar-perl,
+ libbaz-perl (>= 4.59454345345485),
+ libtreshchotka-moo (>= 5.6),
libmoo-more-java (>= 9.6544)
EOF
Modified: trunk/dh-make-perl/t/dists/Strange-2.1/wanted-debian--refresh--source-format=3.0_quilt/control
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/dh-make-perl/t/dists/Strange-2.1/wanted-debian--refresh--source-format%3D3.0_quilt/control?rev=66563&op=diff
==============================================================================
--- trunk/dh-make-perl/t/dists/Strange-2.1/wanted-debian--refresh--source-format=3.0_quilt/control (original)
+++ trunk/dh-make-perl/t/dists/Strange-2.1/wanted-debian--refresh--source-format=3.0_quilt/control Tue Dec 28 17:42:19 2010
@@ -1,7 +1,8 @@
Source: libstrange-perl
Section: perl
Priority: optional
-Build-Depends: debhelper (>= 7), perl
+Build-Depends: debhelper (>= 7),
+ perl
Maintainer: Joe Maintainer <joemaint at test.local>
Standards-Version: 3.9.1
Homepage: http://search.cpan.org/dist/Strange/
Modified: trunk/dh-make-perl/t/dists/Strange-2.1/wanted-debian--refresh/control
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/dh-make-perl/t/dists/Strange-2.1/wanted-debian--refresh/control?rev=66563&op=diff
==============================================================================
--- trunk/dh-make-perl/t/dists/Strange-2.1/wanted-debian--refresh/control (original)
+++ trunk/dh-make-perl/t/dists/Strange-2.1/wanted-debian--refresh/control Tue Dec 28 17:42:19 2010
@@ -1,7 +1,8 @@
Source: libstrange-perl
Section: perl
Priority: optional
-Build-Depends: debhelper (>= 7), perl
+Build-Depends: debhelper (>= 7),
+ perl
Maintainer: Joe Maintainer <joemaint at test.local>
Standards-Version: 3.9.1
Homepage: http://search.cpan.org/dist/Strange/
Modified: trunk/dh-make-perl/t/dists/Strange-2.1/wanted-debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/dh-make-perl/t/dists/Strange-2.1/wanted-debian/control?rev=66563&op=diff
==============================================================================
--- trunk/dh-make-perl/t/dists/Strange-2.1/wanted-debian/control (original)
+++ trunk/dh-make-perl/t/dists/Strange-2.1/wanted-debian/control Tue Dec 28 17:42:19 2010
@@ -1,7 +1,8 @@
Source: libstrange-perl
Section: perl
Priority: optional
-Build-Depends: debhelper (>= 7), perl
+Build-Depends: debhelper (>= 7),
+ perl
Maintainer: Joe Maintainer <joemaint at test.local>
Standards-Version: 3.9.1
Homepage: http://search.cpan.org/dist/Strange/
More information about the Pkg-perl-cvs-commits
mailing list