r48125 - in /trunk/libparse-debcontrol-perl/debian/patches: error.diff patch.diff strict_parse.diff
azatoth-guest at users.alioth.debian.org
azatoth-guest at users.alioth.debian.org
Wed Dec 2 21:43:34 UTC 2009
Author: azatoth-guest
Date: Wed Dec 2 21:43:28 2009
New Revision: 48125
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=48125
Log:
fixing Forwarded exception code (adding overloaded class to handle values), adding DEP3 headers to patchies, adding some more tests regarding the fixed Forwarded field as before stated in this commit log
Modified:
trunk/libparse-debcontrol-perl/debian/patches/error.diff
trunk/libparse-debcontrol-perl/debian/patches/patch.diff
trunk/libparse-debcontrol-perl/debian/patches/strict_parse.diff
Modified: trunk/libparse-debcontrol-perl/debian/patches/error.diff
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libparse-debcontrol-perl/debian/patches/error.diff?rev=48125&op=diff
==============================================================================
--- trunk/libparse-debcontrol-perl/debian/patches/error.diff (original)
+++ trunk/libparse-debcontrol-perl/debian/patches/error.diff Wed Dec 2 21:43:28 2009
@@ -1,3 +1,9 @@
+Description: Updating code to utilize exceptions instead of using warn
+ This update is used for the Patch extension and the Strict extension
+Forwarded: no
+Author: Carl Fürstenberg <azatoth at gmail.com>
+
+
Index: libparse-debcontrol-perl/lib/Parse/DebControl/Error.pm
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
Modified: 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=48125&op=diff
==============================================================================
--- trunk/libparse-debcontrol-perl/debian/patches/patch.diff (original)
+++ trunk/libparse-debcontrol-perl/debian/patches/patch.diff Wed Dec 2 21:43:28 2009
@@ -1,8 +1,16 @@
+Description: Adding specific "patch" metadata parsing code
+ Per DEP3 a new formalized metadata structure is defined.
+ Though it's not 100% copmatible with normal debian/control
+ format, a separate subclass is needed
+Forwarded: no
+Author: Carl Fürstenberg <azatoth at gmail.com>
+
+
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 23:09:47.000000000 +0100
-@@ -0,0 +1,192 @@
++++ libparse-debcontrol-perl/lib/Parse/DebControl/Patch.pm 2009-12-02 22:30:24.000000000 +0100
+@@ -0,0 +1,208 @@
+package Parse::DebControl::Patch;
+=pod
+
@@ -48,10 +56,6 @@
+
+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);
+
@@ -180,26 +184,46 @@
+ }
+ }
+ 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;
-+ }
++ $data->{'Forwarded'} = new Parse::DebControl::Patch::Forwarded($data->{'Forwarded'}->[0]);
+ } else {
-+ $data->{'Forwarded'} = $Forwarded_Yes;
++ $data->{'Forwarded'} = new Parse::DebControl::Patch::Forwarded();
+ }
+
+ return $data;
++}
++
++package Parse::DebControl::Patch::Forwarded;
++
++sub new {
++ my ($class, $value) = @_;
++ my $this = {};
++
++ my $obj = bless $this, $class;
++ $obj->{value} = $value ? $value : 'yes';
++ $obj;
++}
++
++use overload 'bool' => \&check_bool, '""' => \&get_string;
++
++sub check_bool {
++ my ( $self ) = shift;
++ if( $self->{value} eq 'no' || $self->{value} eq 'not-needed' ) {
++ return 0;
++ }
++ return 1;
++}
++
++sub get_string {
++ my ( $self ) = shift;
++ return $self->{value};
+}
+
+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 23:08:51.000000000 +0100
-@@ -0,0 +1,76 @@
++++ libparse-debcontrol-perl/t/35patch.t 2009-12-02 22:33:24.000000000 +0100
+@@ -0,0 +1,95 @@
+#
+#===============================================================================
+#
@@ -220,7 +244,7 @@
+use strict;
+use warnings;
+
-+use Test::More tests => 22; # last test to print
++use Test::More tests => 31; # last test to print
+use Test::Exception;
+
+BEGIN {
@@ -236,10 +260,10 @@
+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");
++lives_ok ( sub {
++ $data = $pdc->parse_file( 'testfiles/patch1.diff' )
++ }, "Parsed patch ok");
+
+# Check From - 3 tests
+ok( exists $data->{From}->[0], "Exists first From field");
@@ -272,14 +296,33 @@
+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
++# Check if the Forwarded field is set and is set to true - 3 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\"");
++ok( $data->{Forwarded}, "Forwarded is true");
++is( $data->{Forwarded}, 'yes', "Forwarded is set to \"yes\"");
++
++#Parse file - 1 test
++lives_ok ( sub {
++ $data = $pdc->parse_file( 'testfiles/patch2.diff' )
++ }, "Parsed patch2 ok");
++# Check if the Forwarded field is set and is set to false - 3 tests
++ok( exists $data->{Forwarded}, "Exists Forwarded field");
++ok( !$data->{Forwarded}, "Forwarded is false");
++is( $data->{Forwarded}, 'not-needed', "Forwarded is set to \"not-needed\"");
++
++#Parse file - 1 test
++lives_ok ( sub {
++ $data = $pdc->parse_file( 'testfiles/patch3.diff' )
++ }, "Parsed patch3 ok");
++# Check if the Forwarded field is set and is set to true - 3 tests
++ok( exists $data->{Forwarded}, "Exists Forwarded field");
++ok( $data->{Forwarded}, "Forwarded is true");
++is( $data->{Forwarded}, 'http://www.example.com/patches?id=42', "Forwarded is set to \"http://www.example.com/patches?id=42\"");
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 23:08:51.000000000 +0100
++++ libparse-debcontrol-perl/t/testfiles/patch1.diff 2009-12-02 21:48:28.000000000 +0100
@@ -0,0 +1,27 @@
+From: Ulrich Drepper <drepper at redhat.com>
+Subject: Fix regex problems with some multi-bytes characters
@@ -308,3 +351,21 @@
+
+ * sysdeps/unix/sysv/linux/s390/bits/libc-vdso.h: New file.
+
+Index: libparse-debcontrol-perl/t/testfiles/patch2.diff
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ libparse-debcontrol-perl/t/testfiles/patch2.diff 2009-12-02 22:25:31.000000000 +0100
+@@ -0,0 +1,4 @@
++From: Fubbe Dubbe
++Author: Someone Cool
++Subject: Bla bla bla
++Forwarded: not-needed
+Index: libparse-debcontrol-perl/t/testfiles/patch3.diff
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ libparse-debcontrol-perl/t/testfiles/patch3.diff 2009-12-02 22:31:31.000000000 +0100
+@@ -0,0 +1,4 @@
++From: Fubbe Dubbe
++Author: Someone Cool
++Subject: Bla bla bla
++Forwarded: http://www.example.com/patches?id=42
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=48125&op=diff
==============================================================================
--- trunk/libparse-debcontrol-perl/debian/patches/strict_parse.diff (original)
+++ trunk/libparse-debcontrol-perl/debian/patches/strict_parse.diff Wed Dec 2 21:43:28 2009
@@ -1,3 +1,23 @@
+Description: Adding strict parser options for classical debian formats
+ Normally Parse::DebControl is rather forgiving. But sometimes you want
+ to enforce strictness as defined by the debian policy.
+ .
+ This patch adds options to anhere those rules, including:
+ * allowance of comments and to what extend
+ * allowed fields
+ * multiline or only single line fields
+ Rules are defined for
+ * debian/control - source control files
+ * DEBIAN/control - binary control files
+ * .dsc - .dsc files
+ * .changes - .change files
+ This patch also adds option singleBlock to force parsing of only one block of data
+ which might be useful when assuming there will only be one block of metadata
+ and posibillity of "junk" thereafter.
+Forwarded: no
+Author: Carl Fürstenberg <azatoth at gmail.com>
+
+
Index: libparse-debcontrol-perl/lib/Parse/DebControl.pm
===================================================================
--- libparse-debcontrol-perl.orig/lib/Parse/DebControl.pm 2009-12-02 00:32:20.000000000 +0100
More information about the Pkg-perl-cvs-commits
mailing list