r48091 - in /trunk/libparse-debcontrol-perl/debian/patches: patch.diff series strict_parse.diff
azatoth-guest at users.alioth.debian.org
azatoth-guest at users.alioth.debian.org
Tue Dec 1 21:45:08 UTC 2009
Author: azatoth-guest
Date: Tue Dec 1 21:44:59 2009
New Revision: 48091
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=48091
Log:
split out patch from strict diff
Added:
trunk/libparse-debcontrol-perl/debian/patches/patch.diff
Modified:
trunk/libparse-debcontrol-perl/debian/patches/series
trunk/libparse-debcontrol-perl/debian/patches/strict_parse.diff
Added: trunk/libparse-debcontrol-perl/debian/patches/patch.diff
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libparse-debcontrol-perl/debian/patches/patch.diff?rev=48091&op=file
==============================================================================
--- trunk/libparse-debcontrol-perl/debian/patches/patch.diff (added)
+++ trunk/libparse-debcontrol-perl/debian/patches/patch.diff Tue Dec 1 21:44:59 2009
@@ -1,0 +1,309 @@
+Index: libparse-debcontrol-perl/lib/Parse/DebControl/Patch.pm
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ libparse-debcontrol-perl/lib/Parse/DebControl/Patch.pm 2009-12-01 22:43:22.000000000 +0100
+@@ -0,0 +1,191 @@
++package Parse::DebControl::Patch;
++=pod
++=head1 NAME
++
++Parse::DebControl::Patch - Easy OO parsing of debian patch file metadata (DEP3) data
++
++=head1 SYNOPSIS
++
++ use Parse::DebControl::Patch
++
++ $parser = new Parse::DebControl::Patch;
++
++ $data = $parser->parse_mem($control_data, $options);
++ $data = $parser->parse_file('./debian/control', $options);
++ $data = $parser->parse_web($url, $options);
++
++=head1 DESCRIPTION
++
++ The patch-file metadata specification (DEP3) diverts from the normal debian/control
++ rules primarly of the "free-form" field specification. To handle this we most create
++ an parser specifically for this format and hardcode these rules direclty into the code.
++
++ As we will always only have one block of data, we will return the hashref directly
++ instead of enclosing it into an array.
++
++ The field B<Forwarded> is magic and will always exists in the out data, even if not specified
++ in the indata. It can only have three values, I<yes>, I<no>, and I<not-needed>. If not specified
++ it will have the value I<yes>.
++
++=head1 COPYRIGHT
++
++Parse::DebControl is copyright 2003,2004 Jay Bonci E<lt>jaybonci at cpan.orgE<gt>.
++Parse::DebControl::Patch is copyright 2009 Carl Fürstenberg E<lt>azatoth at gmail.comE<gt>.
++This program is free software; you can redistribute it and/or modify it under
++the same terms as Perl itself.
++
++=cut
++use strict;
++use warnings;
++
++use base 'Parse::DebControl';
++
++use Exporter::Lite;
++
++
++our $Forwarded_Yes = 1,
++our $Forwarded_No = 2,
++our $Forwarded_NotNeeded = 3,
++
++our @EXPORT_OK = qw($Forwared_Yes $Forwared_No $Forwared_NotNeeded);
++
++our $VERSION = '0.1';
++
++sub _parseDataHandle
++{
++ my ($this, $handle, $options) = @_;
++
++ unless($handle)
++ {
++ throw Parse::DebControl::Error("_parseDataHandle failed because no handle was given. This is likely a bug in the module");
++ }
++
++ if($options->{tryGzip})
++ {
++ if(my $gunzipped = $this->_tryGzipInflate($handle))
++ {
++ $handle = new IO::Scalar \$gunzipped
++ }
++ }
++
++ my $data = $this->_getReadyHash($options);
++
++ my $linenum = 0;
++ my $lastfield = "";
++ my $begun = 0;
++ my $dpatch = 0;
++ my $freeform = "";
++ my $in_freeform = 0;
++ my $freeform_fields = [];
++
++ foreach my $line (<$handle>)
++ {
++ next if $line =~ /^\s*$/ and not $begun;
++
++ if( $line =~ /^#\s*$/ and not $begun ) {
++ $dpatch = 1;
++ next;
++ }
++ if( $line =~ /^#\s$/ and not $begun ) {
++ $dpatch = 1;
++ }
++ $begun = 1;
++ if( $dpatch ) {
++ unless( $line =~ s/^# // ) {
++ throw Parse::DebControl::Error::Parse("We are in dpatch mode, and a non-shell-comment line found", $linenum, $line);
++ }
++ }
++
++ chomp $line;
++
++
++ $linenum++;
++ if( $in_freeform ) {
++ if( $line =~ /^---/ ) {
++ # we need to prohibit --- lines in freeform
++ last;
++ }
++ if( $line =~ /^$/ ) {
++ chomp $freeform;
++ push @$freeform_fields, $freeform;
++ $freeform = "";
++ $in_freeform = 0;
++ } else {
++ $freeform .= "$line\n";
++ }
++ next;
++ } else {
++ if( $line =~ /^$/ ) {
++ $in_freeform = 1;
++ $freeform = "";
++ next;
++ }
++ }
++
++ if( $line =~ /^---/ ) {
++ last;
++ } elsif($line =~ /^[^\t\s]/) {
++ #we have a valid key-value pair
++ if($line =~ /(.*?)\s*\:\s*(.*)$/)
++ {
++ my $key = $1;
++ my $value = $2;
++
++ if($options->{discardCase})
++ {
++ $key = lc($key);
++ }
++
++ push @{$data->{$key}}, $value;
++
++ $lastfield = $key;
++ }else{
++ throw Parse::DebControl::Error::Parse('invalid key/value stansa', $linenum, $line);
++ }
++
++ } elsif($line =~ /^([\t\s])(.*)/) {
++ #appends to previous line
++
++ unless($lastfield)
++ {
++ throw Parse::DebControl::Error::Parse('indented entry without previous line', $linenum, $line);
++ }
++ if($2 eq "." ){
++ $data->{$lastfield}->[scalar @{$data->{$lastfield}}] .= "\n";
++ }else{
++ my $val = $2;
++ $val =~ s/[\s\t]+$//;
++ $data->{$lastfield}->[scalar @{$data->{$lastfield}}] .= "\n$val";
++ }
++ }else{
++ # we'll ignore if junk comes after the metadata usually
++ last;
++ }
++
++ }
++
++ if( scalar @$freeform_fields ) {
++ if( exists $data->{'Description'} ) {
++ push @{$data->{'Description'}}, @$freeform_fields;
++ } elsif( exists $data->{'Subject'} ) {
++ push @{$data->{'Subject'}}, @$freeform_fields;
++ } else {
++ throw Parse::DebControl::Error::Parse('Freeform field found without any Subject or Description fields');
++ }
++ }
++ if( exists $data->{'Forwarded'} ) {
++ if( $data->{'Forwarded'}->[0] eq 'no' ) {
++ $data->{'Forwarded'} = $Forwarded_No;
++ } elsif( $data->{'Forwarded'}->[0] eq 'not-needed' ) {
++ $data->{'Forwarded'} = $Forwarded_NotNeeded;
++ } else {
++ $data->{'Forwarded'} = $Forwarded_Yes;
++ }
++ } else {
++ $data->{'Forwarded'} = $Forwarded_Yes;
++ }
++
++ return $data;
++}
++
++1;
+Index: libparse-debcontrol-perl/t/35patch.t
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ libparse-debcontrol-perl/t/35patch.t 2009-12-01 22:43:22.000000000 +0100
+@@ -0,0 +1,76 @@
++#
++#===============================================================================
++#
++# FILE: 35patch.t
++#
++# DESCRIPTION:
++#
++# FILES: ---
++# BUGS: ---
++# NOTES: ---
++# AUTHOR: (), <>
++# COMPANY:
++# VERSION: 1.0
++# CREATED: 2009-11-29 19.13.10 CET
++# REVISION: ---
++#===============================================================================
++
++use strict;
++use warnings;
++
++use Test::More tests => 22; # last test to print
++use Test::Exception;
++
++BEGIN {
++ chdir 't' if -d 't';
++ use lib '../blib/lib', 'lib/', '..';
++}
++
++my $pdc;
++my $data;
++
++#Object initialization - 2 tests
++
++BEGIN { use_ok( 'Parse::DebControl::Patch' ) };
++ok($pdc = new Parse::DebControl::Patch(), "Parser object creation works fine");
++
++$pdc = new Parse::DebControl::Patch();
++
++#Parse file - 1 test
++ok($data = $pdc->parse_file( 'testfiles/patch1.diff' ), "Parsed patch ok");
++
++# Check From - 3 tests
++ok( exists $data->{From}->[0], "Exists first From field");
++is( $data->{From}->[0], "Ulrich Drepper <drepper\@redhat.com>", "Single From field");
++ok( ! exists $data->{From}->[1], "No second From field");
++
++# Check Subject - 5 tests
++ok( exists $data->{Subject}->[0], "Exists first Subject field");
++ok( exists $data->{Subject}->[1], "Exists second Subject field");
++is( $data->{Subject}->[0], "Fix regex problems with some multi-bytes characters", "First paragraph of Subject");
++is( $data->{Subject}->[1],
++ "* posix/bug-regex17.c: Add testcases.\n".
++ "* posix/regcomp.c (re_compile_fastmap_iter): Rewrite COMPLEX_BRACKET\n".
++ " handling.", "Second paragraph of Subject"
++);
++ok( ! exists $data->{Subject}->[2], "No third Subject field");
++
++# Check Origin - 3 tests
++ok( exists $data->{Origin}->[0], "Exists first Origin field");
++is( $data->{Origin}->[0], "upstream, http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=bdb56bac", "Single Origin address");
++ok( ! exists $data->{Origin}->[1], "No second Origin field");
++
++# Check Bug - 3 tests
++ok( exists $data->{Bug}->[0], "Exists first Bug field");
++is( $data->{Bug}->[0], "http://sourceware.org/bugzilla/show_bug.cgi?id=9697", "Single Bug field");
++ok( ! exists $data->{Bug}->[1], "No second Bug field");
++
++# Check Bug-Debian - 3 tests
++ok( exists $data->{"Bug-Debian"}->[0], "Exists first Bug-Debian field");
++is( $data->{"Bug-Debian"}->[0], "http://bugs.debian.org/510219", "Single Bug-Debian field");
++ok( ! exists $data->{"Bug-Debian"}->[1], "No second Bug-Debian field");
++
++# Check if the Forwarded field is set and is set to true - 2 tests
++# Test file doesn't include a forwared field, so it should default to true
++ok( exists $data->{Forwarded}, "Exists Forwarded field");
++is( $data->{Forwarded}, $Parse::DebControl::Patch::Forwarded_Yes, "Forwarded is set to \"yes\"");
+Index: libparse-debcontrol-perl/t/testfiles/patch1.diff
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ libparse-debcontrol-perl/t/testfiles/patch1.diff 2009-12-01 22:43:22.000000000 +0100
+@@ -0,0 +1,27 @@
++From: Ulrich Drepper <drepper at redhat.com>
++Subject: Fix regex problems with some multi-bytes characters
++
++* posix/bug-regex17.c: Add testcases.
++* posix/regcomp.c (re_compile_fastmap_iter): Rewrite COMPLEX_BRACKET
++ handling.
++
++Origin: upstream, http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=bdb56bac
++Bug: http://sourceware.org/bugzilla/show_bug.cgi?id=9697
++Bug-Debian: http://bugs.debian.org/510219
++
++diff --git a/ChangeLog b/ChangeLog
++index 182bd26..8829b44 100644
++--- a/ChangeLog
+++++ b/ChangeLog
++@@ -1,3 +1,10 @@
+++2009-01-04 Paolo Bonzini <bonzini at gnu.org>
+++
+++ [BZ 9697]
+++ * posix/bug-regex17.c: Add testcases.
+++ * posix/regcomp.c (re_compile_fastmap_iter): Rewrite COMPLEX_BRACKET
+++ handling.
+++
++ 2009-01-05 Martin Schwidefsky <schwidefsky at de.ibm.com>
++
++ * sysdeps/unix/sysv/linux/s390/bits/libc-vdso.h: New file.
++
Modified: trunk/libparse-debcontrol-perl/debian/patches/series
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libparse-debcontrol-perl/debian/patches/series?rev=48091&op=diff
==============================================================================
--- trunk/libparse-debcontrol-perl/debian/patches/series (original)
+++ trunk/libparse-debcontrol-perl/debian/patches/series Tue Dec 1 21:44:59 2009
@@ -1,1 +1,2 @@
strict_parse.diff
+patch.diff
Modified: 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=48091&op=diff
==============================================================================
--- trunk/libparse-debcontrol-perl/debian/patches/strict_parse.diff (original)
+++ trunk/libparse-debcontrol-perl/debian/patches/strict_parse.diff Tue Dec 1 21:44:59 2009
@@ -1,83 +1,7 @@
-Index: libparse-debcontrol-perl/t/34strict.t
-===================================================================
---- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ libparse-debcontrol-perl/t/34strict.t 2009-12-01 20:45:05.000000000 +0100
-@@ -0,0 +1,71 @@
-+#
-+#===============================================================================
-+#
-+# FILE: 34strict.t
-+#
-+# DESCRIPTION:
-+#
-+# FILES: ---
-+# BUGS: ---
-+# NOTES: ---
-+# AUTHOR: (), <>
-+# COMPANY:
-+# VERSION: 1.0
-+# CREATED: 2009-11-28 17.38.03 CET
-+# REVISION: ---
-+#===============================================================================
-+
-+use strict;
-+use warnings;
-+
-+use Test::More tests => 8; # last test to print
-+use Test::Exception;
-+
-+BEGIN {
-+ chdir 't' if -d 't';
-+ use lib '../blib/lib', 'lib/', '..';
-+}
-+
-+
-+my $mod = "Parse::DebControl";
-+my $pdc;
-+my $data;
-+
-+#Object initialization - 2 tests
-+
-+use_ok($mod);
-+ok($pdc = new Parse::DebControl(), "Parser object creation works fine");
-+
-+$pdc = new Parse::DebControl(1);
-+
-+ok($data = $pdc->parse_mem("Source: foo\n#This is a comment\nPackage: bar\#another comment\n#thid comment\nPriority: required", {strict => 1, type => 'debian/control'}), "Comments parse out correctly");
-+throws_ok {
-+ $pdc->parse_mem(
-+ "Source: foo\n#This is a comment\nPackage: bar\#another comment\n#thid comment\nPriority: required",
-+ {strict => 1, type => 'DEBIAN/control'}
-+ )
-+} 'Parse::DebControl::Error::Parse', "Error thrown";
-+throws_ok {
-+ $pdc->parse_mem(
-+ "Source: foo\nPackage: bar\nExtra: candy for me",
-+ {strict => 1, type => 'debian/control'}
-+ )
-+} 'Parse::DebControl::Error::Parse', "Error thrown for the extra field";
-+lives_ok {
-+ $pdc->parse_mem(
-+ "Format: 1.8\nSource: bar\n\nExtra: candy for me",
-+ {strict => 1, type => '.dsc', singleBlock => 1}
-+ )
-+} "Error not thrown when ignoring junk";
-+throws_ok {
-+ $pdc->parse_mem(
-+ "Source: foo\nPackage: bar\n\nExtra: candy for me",
-+ {strict => 1, type => 'debian/control'}
-+ )
-+} 'Parse::DebControl::Error::Parse', "Error thrown for the extra block";
-+lives_ok {
-+ $pdc->parse_mem(
-+ "Format: 1.8\nSource: bar\nX-Extra: candy for me",
-+ {strict => 1, type => '.dsc'}
-+ )
-+} "Error not thrown when local fields is used";
Index: libparse-debcontrol-perl/lib/Parse/DebControl/Error.pm
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ libparse-debcontrol-perl/lib/Parse/DebControl/Error.pm 2009-12-01 21:13:49.000000000 +0100
++++ libparse-debcontrol-perl/lib/Parse/DebControl/Error.pm 2009-12-01 22:43:08.000000000 +0100
@@ -0,0 +1,104 @@
+use strict;
+use warnings;
@@ -183,319 +107,10 @@
+}
+
+1;
-Index: libparse-debcontrol-perl/lib/Parse/DebControl/Patch.pm
-===================================================================
---- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ libparse-debcontrol-perl/lib/Parse/DebControl/Patch.pm 2009-12-01 21:18:01.000000000 +0100
-@@ -0,0 +1,191 @@
-+package Parse::DebControl::Patch;
-+=pod
-+=head1 NAME
-+
-+Parse::DebControl::Patch - Easy OO parsing of debian patch file metadata (DEP3) data
-+
-+=head1 SYNOPSIS
-+
-+ use Parse::DebControl::Patch
-+
-+ $parser = new Parse::DebControl::Patch;
-+
-+ $data = $parser->parse_mem($control_data, $options);
-+ $data = $parser->parse_file('./debian/control', $options);
-+ $data = $parser->parse_web($url, $options);
-+
-+=head1 DESCRIPTION
-+
-+ The patch-file metadata specification (DEP3) diverts from the normal debian/control
-+ rules primarly of the "free-form" field specification. To handle this we most create
-+ an parser specifically for this format and hardcode these rules direclty into the code.
-+
-+ As we will always only have one block of data, we will return the hashref directly
-+ instead of enclosing it into an array.
-+
-+ The field B<Forwarded> is magic and will always exists in the out data, even if not specified
-+ in the indata. It can only have three values, I<yes>, I<no>, and I<not-needed>. If not specified
-+ it will have the value I<yes>.
-+
-+=head1 COPYRIGHT
-+
-+Parse::DebControl is copyright 2003,2004 Jay Bonci E<lt>jaybonci at cpan.orgE<gt>.
-+Parse::DebControl::Patch is copyright 2009 Carl Fürstenberg E<lt>azatoth at gmail.comE<gt>.
-+This program is free software; you can redistribute it and/or modify it under
-+the same terms as Perl itself.
-+
-+=cut
-+use strict;
-+use warnings;
-+
-+use base 'Parse::DebControl';
-+
-+use Exporter::Lite;
-+
-+
-+our $Forwarded_Yes = 1,
-+our $Forwarded_No = 2,
-+our $Forwarded_NotNeeded = 3,
-+
-+our @EXPORT_OK = qw($Forwared_Yes $Forwared_No $Forwared_NotNeeded);
-+
-+our $VERSION = '0.1';
-+
-+sub _parseDataHandle
-+{
-+ my ($this, $handle, $options) = @_;
-+
-+ unless($handle)
-+ {
-+ throw Parse::DebControl::Error("_parseDataHandle failed because no handle was given. This is likely a bug in the module");
-+ }
-+
-+ if($options->{tryGzip})
-+ {
-+ if(my $gunzipped = $this->_tryGzipInflate($handle))
-+ {
-+ $handle = new IO::Scalar \$gunzipped
-+ }
-+ }
-+
-+ my $data = $this->_getReadyHash($options);
-+
-+ my $linenum = 0;
-+ my $lastfield = "";
-+ my $begun = 0;
-+ my $dpatch = 0;
-+ my $freeform = "";
-+ my $in_freeform = 0;
-+ my $freeform_fields = [];
-+
-+ foreach my $line (<$handle>)
-+ {
-+ next if $line =~ /^\s*$/ and not $begun;
-+
-+ if( $line =~ /^#\s*$/ and not $begun ) {
-+ $dpatch = 1;
-+ next;
-+ }
-+ if( $line =~ /^#\s$/ and not $begun ) {
-+ $dpatch = 1;
-+ }
-+ $begun = 1;
-+ if( $dpatch ) {
-+ unless( $line =~ s/^# // ) {
-+ throw Parse::DebControl::Error::Parse("We are in dpatch mode, and a non-shell-comment line found", $linenum, $line);
-+ }
-+ }
-+
-+ chomp $line;
-+
-+
-+ $linenum++;
-+ if( $in_freeform ) {
-+ if( $line =~ /^---/ ) {
-+ # we need to prohibit --- lines in freeform
-+ last;
-+ }
-+ if( $line =~ /^$/ ) {
-+ chomp $freeform;
-+ push @$freeform_fields, $freeform;
-+ $freeform = "";
-+ $in_freeform = 0;
-+ } else {
-+ $freeform .= "$line\n";
-+ }
-+ next;
-+ } else {
-+ if( $line =~ /^$/ ) {
-+ $in_freeform = 1;
-+ $freeform = "";
-+ next;
-+ }
-+ }
-+
-+ if( $line =~ /^---/ ) {
-+ last;
-+ } elsif($line =~ /^[^\t\s]/) {
-+ #we have a valid key-value pair
-+ if($line =~ /(.*?)\s*\:\s*(.*)$/)
-+ {
-+ my $key = $1;
-+ my $value = $2;
-+
-+ if($options->{discardCase})
-+ {
-+ $key = lc($key);
-+ }
-+
-+ push @{$data->{$key}}, $value;
-+
-+ $lastfield = $key;
-+ }else{
-+ throw Parse::DebControl::Error::Parse('invalid key/value stansa', $linenum, $line);
-+ }
-+
-+ } elsif($line =~ /^([\t\s])(.*)/) {
-+ #appends to previous line
-+
-+ unless($lastfield)
-+ {
-+ throw Parse::DebControl::Error::Parse('indented entry without previous line', $linenum, $line);
-+ }
-+ if($2 eq "." ){
-+ $data->{$lastfield}->[scalar @{$data->{$lastfield}}] .= "\n";
-+ }else{
-+ my $val = $2;
-+ $val =~ s/[\s\t]+$//;
-+ $data->{$lastfield}->[scalar @{$data->{$lastfield}}] .= "\n$val";
-+ }
-+ }else{
-+ # we'll ignore if junk comes after the metadata usually
-+ last;
-+ }
-+
-+ }
-+
-+ if( scalar @$freeform_fields ) {
-+ if( exists $data->{'Description'} ) {
-+ push @{$data->{'Description'}}, @$freeform_fields;
-+ } elsif( exists $data->{'Subject'} ) {
-+ push @{$data->{'Subject'}}, @$freeform_fields;
-+ } else {
-+ throw Parse::DebControl::Error::Parse('Freeform field found without any Subject or Description fields');
-+ }
-+ }
-+ if( exists $data->{'Forwarded'} ) {
-+ if( $data->{'Forwarded'}->[0] eq 'no' ) {
-+ $data->{'Forwarded'} = $Forwarded_No;
-+ } elsif( $data->{'Forwarded'}->[0] eq 'not-needed' ) {
-+ $data->{'Forwarded'} = $Forwarded_NotNeeded;
-+ } else {
-+ $data->{'Forwarded'} = $Forwarded_Yes;
-+ }
-+ } else {
-+ $data->{'Forwarded'} = $Forwarded_Yes;
-+ }
-+
-+ return $data;
-+}
-+
-+1;
-Index: libparse-debcontrol-perl/t/35patch.t
-===================================================================
---- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ libparse-debcontrol-perl/t/35patch.t 2009-12-01 20:45:05.000000000 +0100
-@@ -0,0 +1,76 @@
-+#
-+#===============================================================================
-+#
-+# FILE: 35patch.t
-+#
-+# DESCRIPTION:
-+#
-+# FILES: ---
-+# BUGS: ---
-+# NOTES: ---
-+# AUTHOR: (), <>
-+# COMPANY:
-+# VERSION: 1.0
-+# CREATED: 2009-11-29 19.13.10 CET
-+# REVISION: ---
-+#===============================================================================
-+
-+use strict;
-+use warnings;
-+
-+use Test::More tests => 22; # last test to print
-+use Test::Exception;
-+
-+BEGIN {
-+ chdir 't' if -d 't';
-+ use lib '../blib/lib', 'lib/', '..';
-+}
-+
-+my $pdc;
-+my $data;
-+
-+#Object initialization - 2 tests
-+
-+BEGIN { use_ok( 'Parse::DebControl::Patch' ) };
-+ok($pdc = new Parse::DebControl::Patch(), "Parser object creation works fine");
-+
-+$pdc = new Parse::DebControl::Patch();
-+
-+#Parse file - 1 test
-+ok($data = $pdc->parse_file( 'testfiles/patch1.diff' ), "Parsed patch ok");
-+
-+# Check From - 3 tests
-+ok( exists $data->{From}->[0], "Exists first From field");
-+is( $data->{From}->[0], "Ulrich Drepper <drepper\@redhat.com>", "Single From field");
-+ok( ! exists $data->{From}->[1], "No second From field");
-+
-+# Check Subject - 5 tests
-+ok( exists $data->{Subject}->[0], "Exists first Subject field");
-+ok( exists $data->{Subject}->[1], "Exists second Subject field");
-+is( $data->{Subject}->[0], "Fix regex problems with some multi-bytes characters", "First paragraph of Subject");
-+is( $data->{Subject}->[1],
-+ "* posix/bug-regex17.c: Add testcases.\n".
-+ "* posix/regcomp.c (re_compile_fastmap_iter): Rewrite COMPLEX_BRACKET\n".
-+ " handling.", "Second paragraph of Subject"
-+);
-+ok( ! exists $data->{Subject}->[2], "No third Subject field");
-+
-+# Check Origin - 3 tests
-+ok( exists $data->{Origin}->[0], "Exists first Origin field");
-+is( $data->{Origin}->[0], "upstream, http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=bdb56bac", "Single Origin address");
-+ok( ! exists $data->{Origin}->[1], "No second Origin field");
-+
-+# Check Bug - 3 tests
-+ok( exists $data->{Bug}->[0], "Exists first Bug field");
-+is( $data->{Bug}->[0], "http://sourceware.org/bugzilla/show_bug.cgi?id=9697", "Single Bug field");
-+ok( ! exists $data->{Bug}->[1], "No second Bug field");
-+
-+# Check Bug-Debian - 3 tests
-+ok( exists $data->{"Bug-Debian"}->[0], "Exists first Bug-Debian field");
-+is( $data->{"Bug-Debian"}->[0], "http://bugs.debian.org/510219", "Single Bug-Debian field");
-+ok( ! exists $data->{"Bug-Debian"}->[1], "No second Bug-Debian field");
-+
-+# Check if the Forwarded field is set and is set to true - 2 tests
-+# Test file doesn't include a forwared field, so it should default to true
-+ok( exists $data->{Forwarded}, "Exists Forwarded field");
-+is( $data->{Forwarded}, $Parse::DebControl::Patch::Forwarded_Yes, "Forwarded is set to \"yes\"");
-Index: libparse-debcontrol-perl/t/testfiles/patch1.diff
-===================================================================
---- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ libparse-debcontrol-perl/t/testfiles/patch1.diff 2009-12-01 20:45:05.000000000 +0100
-@@ -0,0 +1,27 @@
-+From: Ulrich Drepper <drepper at redhat.com>
-+Subject: Fix regex problems with some multi-bytes characters
-+
-+* posix/bug-regex17.c: Add testcases.
-+* posix/regcomp.c (re_compile_fastmap_iter): Rewrite COMPLEX_BRACKET
-+ handling.
-+
-+Origin: upstream, http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=bdb56bac
-+Bug: http://sourceware.org/bugzilla/show_bug.cgi?id=9697
-+Bug-Debian: http://bugs.debian.org/510219
-+
-+diff --git a/ChangeLog b/ChangeLog
-+index 182bd26..8829b44 100644
-+--- a/ChangeLog
-++++ b/ChangeLog
-+@@ -1,3 +1,10 @@
-++2009-01-04 Paolo Bonzini <bonzini at gnu.org>
-++
-++ [BZ 9697]
-++ * posix/bug-regex17.c: Add testcases.
-++ * posix/regcomp.c (re_compile_fastmap_iter): Rewrite COMPLEX_BRACKET
-++ handling.
-++
-+ 2009-01-05 Martin Schwidefsky <schwidefsky at de.ibm.com>
-+
-+ * sysdeps/unix/sysv/linux/s390/bits/libc-vdso.h: New file.
-+
Index: libparse-debcontrol-perl/lib/Parse/DebControl.pm
===================================================================
---- libparse-debcontrol-perl.orig/lib/Parse/DebControl.pm 2009-12-01 01:39:34.000000000 +0100
-+++ libparse-debcontrol-perl/lib/Parse/DebControl.pm 2009-12-01 20:45:05.000000000 +0100
+--- libparse-debcontrol-perl.orig/lib/Parse/DebControl.pm 2009-12-01 22:38:56.000000000 +0100
++++ libparse-debcontrol-perl/lib/Parse/DebControl.pm 2009-12-01 22:43:08.000000000 +0100
@@ -13,10 +13,94 @@
use IO::Scalar;
use Compress::Zlib;
@@ -885,3 +500,79 @@
=back
=over 4
+Index: libparse-debcontrol-perl/t/34strict.t
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ libparse-debcontrol-perl/t/34strict.t 2009-12-01 22:43:08.000000000 +0100
+@@ -0,0 +1,71 @@
++#
++#===============================================================================
++#
++# FILE: 34strict.t
++#
++# DESCRIPTION:
++#
++# FILES: ---
++# BUGS: ---
++# NOTES: ---
++# AUTHOR: (), <>
++# COMPANY:
++# VERSION: 1.0
++# CREATED: 2009-11-28 17.38.03 CET
++# REVISION: ---
++#===============================================================================
++
++use strict;
++use warnings;
++
++use Test::More tests => 8; # last test to print
++use Test::Exception;
++
++BEGIN {
++ chdir 't' if -d 't';
++ use lib '../blib/lib', 'lib/', '..';
++}
++
++
++my $mod = "Parse::DebControl";
++my $pdc;
++my $data;
++
++#Object initialization - 2 tests
++
++use_ok($mod);
++ok($pdc = new Parse::DebControl(), "Parser object creation works fine");
++
++$pdc = new Parse::DebControl(1);
++
++ok($data = $pdc->parse_mem("Source: foo\n#This is a comment\nPackage: bar\#another comment\n#thid comment\nPriority: required", {strict => 1, type => 'debian/control'}), "Comments parse out correctly");
++throws_ok {
++ $pdc->parse_mem(
++ "Source: foo\n#This is a comment\nPackage: bar\#another comment\n#thid comment\nPriority: required",
++ {strict => 1, type => 'DEBIAN/control'}
++ )
++} 'Parse::DebControl::Error::Parse', "Error thrown";
++throws_ok {
++ $pdc->parse_mem(
++ "Source: foo\nPackage: bar\nExtra: candy for me",
++ {strict => 1, type => 'debian/control'}
++ )
++} 'Parse::DebControl::Error::Parse', "Error thrown for the extra field";
++lives_ok {
++ $pdc->parse_mem(
++ "Format: 1.8\nSource: bar\n\nExtra: candy for me",
++ {strict => 1, type => '.dsc', singleBlock => 1}
++ )
++} "Error not thrown when ignoring junk";
++throws_ok {
++ $pdc->parse_mem(
++ "Source: foo\nPackage: bar\n\nExtra: candy for me",
++ {strict => 1, type => 'debian/control'}
++ )
++} 'Parse::DebControl::Error::Parse', "Error thrown for the extra block";
++lives_ok {
++ $pdc->parse_mem(
++ "Format: 1.8\nSource: bar\nX-Extra: candy for me",
++ {strict => 1, type => '.dsc'}
++ )
++} "Error not thrown when local fields is used";
More information about the Pkg-perl-cvs-commits
mailing list