r47870 - in /trunk/libparse-debcontrol-perl/debian/patches: series strict_parse.diff

azatoth-guest at users.alioth.debian.org azatoth-guest at users.alioth.debian.org
Sat Nov 28 02:37:58 UTC 2009


Author: azatoth-guest
Date: Sat Nov 28 02:37:53 2009
New Revision: 47870

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=47870
Log:
better name of the patch

Added:
    trunk/libparse-debcontrol-perl/debian/patches/strict_parse.diff
Modified:
    trunk/libparse-debcontrol-perl/debian/patches/series

Modified: trunk/libparse-debcontrol-perl/debian/patches/series
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libparse-debcontrol-perl/debian/patches/series?rev=47870&op=diff
==============================================================================
--- trunk/libparse-debcontrol-perl/debian/patches/series (original)
+++ trunk/libparse-debcontrol-perl/debian/patches/series Sat Nov 28 02:37:53 2009
@@ -1,1 +1,1 @@
-strict_parse_comments.diff
+strict_parse.diff

Added: trunk/libparse-debcontrol-perl/debian/patches/strict_parse.diff
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libparse-debcontrol-perl/debian/patches/strict_parse.diff?rev=47870&op=file
==============================================================================
--- trunk/libparse-debcontrol-perl/debian/patches/strict_parse.diff (added)
+++ trunk/libparse-debcontrol-perl/debian/patches/strict_parse.diff Sat Nov 28 02:37:53 2009
@@ -1,0 +1,122 @@
+Index: libparse-debcontrol-perl/lib/Parse/DebControl.pm
+===================================================================
+--- libparse-debcontrol-perl.orig/lib/Parse/DebControl.pm	2009-11-28 03:32:51.000000000 +0100
++++ libparse-debcontrol-perl/lib/Parse/DebControl.pm	2009-11-28 03:32:49.000000000 +0100
+@@ -273,12 +273,16 @@
+ 		chomp $line;
+ 		
+ 
+-		if($options->{stripComments}){
+-			next if $line =~ /^\s*\#[^\#]/;
+-			$line =~ s/\#$//;
+-			$line =~ s/(?<=[^\#])\#[^\#].*//;
+-			$line =~ s/\#\#/\#/;
+-		}
++        if( $options->{strict} ) {
++            if ( $options->{type} eq 'debian/control' ) {
++                next if $line =~ /^\#/;
++            }
++        } elsif( $options->{stripComments} ){
++            next if $line =~ /^\s*\#[^\#]/;
++            $line =~ s/\#$//;
++            $line =~ s/(?<=[^\#])\#[^\#].*//;
++            $line =~ s/\#\#/\#/;
++        }
+ 
+ 		$linenum++;
+ 		if($line =~ /^[^\t\s]/)
+@@ -314,14 +318,69 @@
+ 			}
+ 
+ 		}elsif($line =~ /^([\t\s])(.*)/)
+-		{
+-			#appends to previous line
++        {
++            #appends to previous line
++
++            unless($lastfield)
++            {
++                $this->_dowarn("Parse error on line $linenum of data; indented entry without previous line");
++                return $structs;
++            }
++            if( $options->{strict} ) {
++                my $key = $lastfield;
++                if(
++                    $options->{type} eq 'debian/control' && (
++                        $key eq 'source'
++                        || $key eq 'maintainer'
++                        || $key eq 'section'
++                        || $key eq 'priority'
++                        || $key eq 'package'
++                        || $key eq 'architecture'
++                        || $key eq 'essential'
++                        || $key eq 'standards-version'
++                        || $key eq 'homepage'
++                    )
++                    || $options->{type} eq 'DEBIAN/control' && (
++                        $key eq 'source'
++                        || $key eq 'maintainer'
++                        || $key eq 'changed-by'
++                        || $key eq 'section'
++                        || $key eq 'priority'
++                        || $key eq 'package'
++                        || $key eq 'architecture'
++                        || $key eq 'essential'
++                        || $key eq 'version'
++                        || $key eq 'installed-size'
++                        || $key eq 'homepage'
++                    )
++                    || $options->{type} eq '.dsc'  && (
++                        $key eq 'format'
++                        || $key eq 'date'
++                        || $key eq 'source'
++                        || $key eq 'version'
++                        || $key eq 'maintainer'
++                        || $key eq 'architecture'
++                        || $key eq 'standards-version'
++                        || $key eq 'homepage'
++                    )
++                    || $options->{type} eq '.changes'  && (
++                        $key eq 'format'
++                        || $key eq 'date'
++                        || $key eq 'source'
++                        || $key eq 'architecture'
++                        || $key eq 'version'
++                        || $key eq 'distribution'
++                        || $key eq 'urgency'
++                        || $key eq 'maintainer'
++                        || $key eq 'changed-by'
++                        || $key eq 'closes'
++                    )
++                ) {
++                    $this->_dowarn("Parse error on line $linenum of data; field $lastfield for type $options->{type} may not span multiple lines");
++                    return $structs;
++                }
++            }
+ 
+-			unless($lastfield)
+-			{
+-				$this->_dowarn("Parse error on line $linenum of data; indented entry without previous line");
+-				return $structs;
+-			}
+ 			if($options->{verbMultiLine}){
+ 				$data->{$lastfield}.="\n$1$2";
+ 			}elsif($2 eq "." ){
+@@ -501,6 +560,17 @@
+ 		it is off by default so we don't have to scrub over all the text for
+ 		performance reasons.
+ 
++    strict - Tries to parse obeying the strict rules for real debian control files.
++        This will force comment stripping for debian/control (must start line) and for
++        other files will check if a field may span multiple lines.
++
++    type - If the strict option is choosen, then this parameter defines what format
++        we have. Available formats is:
++            - debian/control
++            - DEBIAN/control
++            - .dsc
++            - .changes
++
+ =back
+ 
+ =over 4




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