commit:     e01367fa6ba7e5418ec7c58ff64c68c0ee65c7d2
Author:     Kent Fredric <kentnl <AT> gentoo <DOT> org>
AuthorDate: Sat Jul  9 12:56:23 2016 +0000
Commit:     Kent Fredric <kentnl <AT> gentoo <DOT> org>
CommitDate: Sat Jul  9 12:57:14 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e01367fa

dev-perl/CGI-FormBuilder: Fix tests failing after perl 5.18

Certian tests relied on implict hash ordering to be predictable.

This patches those tests to make the data ordered to be predictable.

Bug: https://rt.cpan.org/Ticket/Display.html?id=81650

Package-Manager: portage-2.3.0
RepoMan-Options: --include-arches="alpha amd64 amd64-fbsd arm arm64 hppa ia64 
m68k mips nios2 ppc ppc64 riscv s390 sh sparc sparc-fbsd x86 x86-fbsd"

 .../CGI-FormBuilder/CGI-FormBuilder-3.90.0.ebuild  |   5 +-
 .../files/CGI-FormBuilder-3.90.0-rt81650.patch     | 155 +++++++++++++++++++++
 2 files changed, 159 insertions(+), 1 deletion(-)

diff --git a/dev-perl/CGI-FormBuilder/CGI-FormBuilder-3.90.0.ebuild 
b/dev-perl/CGI-FormBuilder/CGI-FormBuilder-3.90.0.ebuild
index 0bb4577..1baac2a 100644
--- a/dev-perl/CGI-FormBuilder/CGI-FormBuilder-3.90.0.ebuild
+++ b/dev-perl/CGI-FormBuilder/CGI-FormBuilder-3.90.0.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2015 Gentoo Foundation
+# Copyright 1999-2016 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 # $Id$
 
@@ -16,6 +16,9 @@ SLOT="0"
 KEYWORDS="~amd64 ~x86"
 IUSE=""
 
+PATCHES=(
+       "${FILESDIR}/${P}-rt81650.patch"
+)
 # Templates that can be used - but they are optional
 #      >=dev-perl/HTML-Template-2.60.0
 #      >=dev-perl/text-template-1.430.0

diff --git 
a/dev-perl/CGI-FormBuilder/files/CGI-FormBuilder-3.90.0-rt81650.patch 
b/dev-perl/CGI-FormBuilder/files/CGI-FormBuilder-3.90.0-rt81650.patch
new file mode 100644
index 0000000..08c4f98
--- /dev/null
+++ b/dev-perl/CGI-FormBuilder/files/CGI-FormBuilder-3.90.0-rt81650.patch
@@ -0,0 +1,155 @@
+diff -Naur CGI-FormBuilder-3.09/t/1c-validate.t 
CGI-FormBuilder-3.09b/t/1c-validate.t
+--- CGI-FormBuilder-3.09/t/1c-validate.t       2013-11-30 00:10:36.000000000 
+0000
++++ CGI-FormBuilder-3.09b/t/1c-validate.t      2016-05-11 13:10:45.680369595 
+0000
+@@ -174,11 +174,11 @@
+ for my $t (@test) {
+ 
+     my $form = CGI::FormBuilder->new( %{ $t->{opt} }, debug => $DEBUG );
+-    while(my($f,$o) = each %{$t->{mod} || {}}) {
+-        $o->{name} = $f;
+-        $form->field(%$o);
++    for my $field ( sort keys %{ $t->{mod} || {} } ) {
++        my $object = $t->{mod}->{$field};
++        $object->{name} = $field;
++        $form->field( %{ $object } );
+     }
+-
+     # just try to validate
+     ok($form->validate, $t->{pass} || 0);
+ }
+diff -Naur CGI-FormBuilder-3.09/t/1d-messages.t 
CGI-FormBuilder-3.09b/t/1d-messages.t
+--- CGI-FormBuilder-3.09/t/1d-messages.t       2013-11-30 00:10:36.000000000 
+0000
++++ CGI-FormBuilder-3.09b/t/1d-messages.t      2016-05-11 13:08:33.159540213 
+0000
+@@ -70,8 +70,9 @@
+ my $locale = "fb_FAKE";
+ my $messages = "messages.$locale";
+ open(M, ">$messages") || warn "Can't write $messages: $!";
+-while (my($k,$v) = each %messages) {
+-    print M join(' ', $k, ref($v) ? @$v : $v), "\n";
++for my $k ( sort keys %messages ) {
++  my $v = $messages{$k};
++  print M join(' ', $k, ref($v) ? @$v : $v), "\n";
+ }
+ close(M);
+ 
+@@ -123,7 +124,7 @@
+ # Final test set is to just make sure we have all the keys for all modules
+ require CGI::FormBuilder::Messages::default;
+ my %need = CGI::FormBuilder::Messages::default->messages;
+-my @keys = keys %need;
++my @keys = sort keys %need;
+ for my $pm (@pm) {
+     my($lang) = $pm =~ /([a-z]+_[A-Z]+)/;
+     my $skip = $lang ? undef : "skip: Can't get language from $pm";
+diff -Naur CGI-FormBuilder-3.09/t/2a-template-html.t 
CGI-FormBuilder-3.09b/t/2a-template-html.t
+--- CGI-FormBuilder-3.09/t/2a-template-html.t  2013-11-30 00:10:36.000000000 
+0000
++++ CGI-FormBuilder-3.09b/t/2a-template-html.t 2016-05-11 13:11:57.438740284 
+0000
+@@ -102,18 +102,19 @@
+ my $seq = $ARGV[0] || 1;
+ 
+ # Cycle thru and try it out
+-for (@test) {
++for my $test_item (@test) {
+     my $form = CGI::FormBuilder->new(
+                     debug => $DEBUG,
+                     action => 'TEST',
+                     title  => 'TEST',
+-                    %{ $_->{opt} },
++                    %{ $test_item->{opt} },
+                );
+ 
+     # the ${mod} key twiddles fields
+-    while(my($f,$o) = each %{$_->{mod} || {}}) {
+-        $o->{name} = $f;
+-        $form->field(%$o);
++    for my $field ( sort keys %{ $test_item->{mod} || {} } ) {
++        my $object = $test_item->{mod}->{$field};
++        $object->{name} = $field;
++        $form->field( %{ $object } );
+     }
+ 
+     #
+diff -Naur CGI-FormBuilder-3.09/t/2b-template-text.t 
CGI-FormBuilder-3.09b/t/2b-template-text.t
+--- CGI-FormBuilder-3.09/t/2b-template-text.t  2013-11-30 00:10:36.000000000 
+0000
++++ CGI-FormBuilder-3.09b/t/2b-template-text.t 2016-05-11 13:11:29.861982062 
+0000
+@@ -97,18 +97,19 @@
+ my $seq = $ARGV[0] || 1;
+ 
+ # Cycle thru and try it out
+-for (@test) {
++for my $test_item (@test) {
+     my $form = CGI::FormBuilder->new(
+                     debug => $DEBUG,
+                     action => 'TEST',
+                     title  => 'TEST',
+-                    %{ $_->{opt} },
++                    %{ $test_item->{opt} },
+                );
+ 
+     # the ${mod} key twiddles fields
+-    while(my($f,$o) = each %{$_->{mod} || {}}) {
+-        $o->{name} = $f;
+-        $form->field(%$o);
++    for my $field ( sort keys %{ $test_item->{mod} || {} } ) {
++        my $object = $test_item->{mod}->{$field};
++        $object->{name} = $field;
++        $form->field( %{ $object } );
+     }
+ 
+     #
+diff -Naur CGI-FormBuilder-3.09/t/2d-template-fast.t 
CGI-FormBuilder-3.09b/t/2d-template-fast.t
+--- CGI-FormBuilder-3.09/t/2d-template-fast.t  2013-11-30 00:10:36.000000000 
+0000
++++ CGI-FormBuilder-3.09b/t/2d-template-fast.t 2016-05-11 13:15:58.497630259 
+0000
+@@ -135,18 +135,19 @@
+ my $seq = $ARGV[0] || 1;
+ 
+ # Cycle thru and try it out
+-for (@test) {
++for my $test_item (@test) {
+     my $form = CGI::FormBuilder->new(
+                     debug => $DEBUG,
+                     action => 'TEST',
+                     title  => 'TEST',
+-                    %{ $_->{opt} },
++                    %{ $test_item->{opt} },
+                );
+ 
+     # the ${mod} key twiddles fields
+-    while(my($f,$o) = each %{$_->{mod} || {}}) {
+-        $o->{name} = $f;
+-        $form->field(%$o);
++    for my $field ( sort keys %{ $test_item->{mod} || {} } ) {
++        my $object = $test_item->{mod}->{$field};
++        $object->{name} = $field;
++        $form->field( %{ $object } );
+     }
+ 
+     #
+diff -Naur CGI-FormBuilder-3.09/t/2e-template-ssi.t 
CGI-FormBuilder-3.09b/t/2e-template-ssi.t
+--- CGI-FormBuilder-3.09/t/2e-template-ssi.t   2013-11-30 00:10:36.000000000 
+0000
++++ CGI-FormBuilder-3.09b/t/2e-template-ssi.t  2016-05-11 13:12:37.526388964 
+0000
+@@ -102,18 +102,19 @@
+ my $seq = $ARGV[0] || 1;
+ 
+ # Cycle thru and try it out
+-for (@test) {
++for my $test_item (@test) {
+     my $form = CGI::FormBuilder->new(
+                     debug => $DEBUG,
+                     action => 'TEST',
+                     title  => 'TEST',
+-                    %{ $_->{opt} },
++                    %{ $test_item->{opt} },
+                );
+ 
+     # the ${mod} key twiddles fields
+-    while(my($f,$o) = each %{$_->{mod} || {}}) {
+-        $o->{name} = $f;
+-        $form->field(%$o);
++    for my $field ( sort keys %{ $test_item->{mod} || {} } ) {
++        my $object = $test_item->{mod}->{$field};
++        $object->{name} = $field;
++        $form->field( %{ $object } );
+     }
+ 
+     #

Reply via email to