[SCM] Packaging ofParse::Debcontrol in Debian branch, master, updated. debian/2.005-3-6-g220e70a

gregor herrmann gregoa at debian.org
Fri Aug 3 11:47:43 UTC 2012


The following commit has been merged in the master branch:
commit 883adf97ac5923840e4c66e74284099186122e2f
Author: Dima Kogan <dima at secretsauce.net>
Date:   Thu Aug 2 17:14:13 2012 -0700

    Fixed improperly-handled comment stripping.
    
    Closes: #640063, #675134

diff --git a/debian/patches/0005-More-thorough-comment-parsing.patch b/debian/patches/0005-More-thorough-comment-parsing.patch
new file mode 100644
index 0000000..fb9bc24
--- /dev/null
+++ b/debian/patches/0005-More-thorough-comment-parsing.patch
@@ -0,0 +1,63 @@
+Index: libparse-debcontrol-perl/t/31stripcomments.t
+===================================================================
+--- libparse-debcontrol-perl.orig/t/31stripcomments.t	2012-08-02 17:30:19.000000000 -0700
++++ libparse-debcontrol-perl/t/31stripcomments.t	2012-08-02 17:40:23.000000000 -0700
+@@ -1,6 +1,6 @@
+ #!/usr/bin/perl -w
+ 
+-use Test::More tests => 24;
++use Test::More tests => 28;
+ 
+ BEGIN {
+         chdir 't' if -d 't';
+@@ -54,3 +54,23 @@
+ 	ok($data->[0]->{Key1} eq "value", "...first value is correct");
+ 	ok($data->[0]->{Key2} eq "value2", "...second value is correct");
+ 
++	# Comments in the middle of an indented block
++        my $test_str = <<'EOF';
++Key1: value,
++      next1,
++      next2,
++#hello there
++#
++      next3
++EOF
++        my $val_ref = "value,next1,next2,next3";
++
++	ok($data = $pdc->parse_mem($test_str, {stripComments => 1}), "Parse with comments in indented block");
++        $data->[0]->{Key1} =~ s/^\s*//mg; # strip leading whitespace
++        $data->[0]->{Key1} =~ s/\n//g;    # collapse newlines
++	ok($data->[0]->{Key1} eq $val_ref, "...value is correct");
++
++	ok($data = $pdc->parse_mem($test_str, {verbMultiLine => 1, stripComments => 1}), "Parse with comments in indented block");
++        $data->[0]->{Key1} =~ s/^\s*//mg;# strip leading whitespace
++        $data->[0]->{Key1} =~ s/\n//g;   # collapse newlines
++	ok($data->[0]->{Key1} eq $val_ref, "...value is correct");
+Index: libparse-debcontrol-perl/lib/Parse/DebControl.pm
+===================================================================
+--- libparse-debcontrol-perl.orig/lib/Parse/DebControl.pm	2012-08-02 17:30:31.000000000 -0700
++++ libparse-debcontrol-perl/lib/Parse/DebControl.pm	2012-08-02 17:39:45.000000000 -0700
+@@ -390,9 +390,19 @@
+                 next if $line =~ /^\#/;
+             }
+         } elsif( $options->{stripComments} ){
+-            next if $line =~ /^\s*\#[^\#]/;
+-            $line =~ s/\#$//;
+-            $line =~ s/(?<=[^\#])\#[^\#].*//;
++
++            # skip all lines that contain ONLY comments
++            next if $line =~ /^\s*              # leading whitespace
++                              \#                # comment character
++                              (?:[^\#] | $)/x;  # anything else (to not react to ##)
++
++            # cut off everything past the first non-## comment character
++            $line =~ s/ (?<=[^\#])              # 0-width non-#
++                        \#                      # #
++                        (?:[^\#] | $)           # non-# or end-of-line
++                        .*//x;                  # everything-else. Replace.
++
++            # Comments have been cut off, so ## -> #
+             $line =~ s/\#\#/\#/;
+         }
+ 
diff --git a/debian/patches/0006-Better-line-number-tracking.patch b/debian/patches/0006-Better-line-number-tracking.patch
new file mode 100644
index 0000000..82d42db
--- /dev/null
+++ b/debian/patches/0006-Better-line-number-tracking.patch
@@ -0,0 +1,21 @@
+Index: libparse-debcontrol-perl/lib/Parse/DebControl.pm
+===================================================================
+--- libparse-debcontrol-perl.orig/lib/Parse/DebControl.pm	2012-08-02 17:23:47.000000000 -0700
++++ libparse-debcontrol-perl/lib/Parse/DebControl.pm	2012-08-02 17:24:02.000000000 -0700
+@@ -379,6 +379,8 @@
+ 
+ 	foreach my $line (<$handle>)
+ 	{
++		$linenum++;
++
+ 		#Sometimes with IO::Scalar, lines may have a newline at the end
+ 
+ 		#$line =~ s/\r??\n??$//; #CRLF fix, but chomp seems to clean it
+@@ -406,7 +408,6 @@
+             $line =~ s/\#\#/\#/;
+         }
+ 
+-		$linenum++;
+ 		if($line =~ /^[^\t\s]/)
+ 		{
+ 			#we have a valid key-value pair
diff --git a/debian/patches/series b/debian/patches/series
index 3149698..8425e96 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -2,3 +2,5 @@
 0002-Strict-parse.patch
 0003-Parse-DebControl-Patch.patch
 0004-Manpage-spelling-fixes.patch
+0005-More-thorough-comment-parsing.patch
+0006-Better-line-number-tracking.patch

-- 
Packaging ofParse::Debcontrol in Debian



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