This is an automated email from the git hooks/post-receive script.

js pushed a commit to branch master
in repository libkavorka-perl.

commit a216d482b260c5bfa929e0bb86c887d5f4c9ca44
Author: Jonas Smedegaard <d...@jones.dk>
Date:   Thu Dec 15 02:32:44 2016 +0100

    Fix dependency on Data::Alias: Add patch 1001 to use recent Perl instead of 
Data::Alias. (Build-)depend on recent perl favored over libdata-alias-perl. 
Closes: Bug#834800. Thanks to Daniel Dehennin.
---
 .../1001_remove-data-alias-dependency.patch        | 148 +++++++++++++++++++++
 debian/patches/README                              |   3 +
 debian/patches/series                              |   1 +
 debian/rules                                       |   3 +-
 4 files changed, 154 insertions(+), 1 deletion(-)

diff --git a/debian/patches/1001_remove-data-alias-dependency.patch 
b/debian/patches/1001_remove-data-alias-dependency.patch
new file mode 100644
index 0000000..1494003
--- /dev/null
+++ b/debian/patches/1001_remove-data-alias-dependency.patch
@@ -0,0 +1,148 @@
+Description: Data::Alias is broken on perl >= 5.24
+ The Data::Alias module itself explains:
+ .
+ > you should prefer to use the core facility rather than use this
+ > module. If you are already using this module and are now using a
+ > sufficiently recent Perl, you should attempt to migrate to the core
+ > facility
+ .
+ The idea is to use core refaliasing when available and Data::Alias
+ otherwise.
+ .
+ This patch is a merge of the 2 commits of the pull request.
+Author: Daniel Dehennin <daniel.dehen...@baby-gnu.org>
+Origin: https://github.com/tobyink/p5-kavorka/pull/19
+Bug: https://github.com/tobyink/p5-kavorka/issues/18
+Bug-Debian: https://bugs.debian.org/834800
+Last-Update: 2016-12-15
+
+--- a/lib/Kavorka/Signature.pm
++++ b/lib/Kavorka/Signature.pm
+@@ -19,6 +19,8 @@
+ use Moo;
+ use namespace::sweep;
+ 
++use constant HAS_REFALIASING => ($] >= 5.022);
++
+ has package           => (is => 'ro');
+ has _is_dummy         => (is => 'ro');
+ has params            => (is => 'ro',  default => sub { +[] });
+@@ -276,13 +278,45 @@
+       or $slurpy && $slurpy->name =~ /\A\%/
+       or $slurpy && $slurpy->name =~ /\A\$/ && 
$slurpy->type->is_a_type_of(Types::Standard::HashRef()))
+       {
+-              require Data::Alias;
+               my $ix  = 1 + $self->last_position;
+-              my $str = sprintf(
++              my $str;
++              if (HAS_REFALIASING) {
++                      my $format = <<'EOF';
++local %%_;
++{
++      use Carp qw(croak);
++      use experimental 'refaliasing';
++
++      if ($#_==%d && ref($_[%d]) eq q(HASH)) {
++              \%%_ = \%%{$_[%d]};
++      }
++      else {
++              # Make a hash reference from array refalias does not work
++              # Manual build
++              my $slice_length = ($#_ + 1 - %d);
++              if ($slice_length %% 2 != 0) {
++                      # Seems to be what t/10positional.t wants
++                      croak("Odd number of elements in anonymous hash");
++              }
++              my $i = %d;
++              while ($i <= $#_) {
++                      my $key = $_[$i];
++                      \$_{$key} = \$_[$i+1];
++                      $i += 2;
++              }
++      }
++};
++EOF
++                      $str = sprintf($format,($ix) x 5,);
++              }
++              else {
++                      require Data::Alias;
++                      $str = sprintf(
+                       'local %%_; { use warnings FATAL => qw(all); 
Data::Alias::alias(%%_ = ($#_==%d && ref($_[%d]) eq q(HASH)) ? %%{$_[%d]} : @_[ 
%d .. $#_ ]) };',
+                       ($ix) x 4,
+               );
+-              
++              }
++
+               unless ($slurpy or $self->yadayada)
+               {
+                       my @allowed_names = map +($_=>1), map 
@{$_->named_names}, $self->named_params;
+--- a/lib/Kavorka/TraitFor/Parameter/alias.pm
++++ b/lib/Kavorka/TraitFor/Parameter/alias.pm
+@@ -9,6 +9,8 @@
+ 
+ use Moo::Role;
+ 
++use constant HAS_REFALIASING => ($] >= 5.022);
++
+ around _injection_assignment => sub
+ {
+       my $next = shift;
+@@ -17,8 +19,21 @@
+       
+       if ($self->kind eq 'my')
+       {
+-              require Data::Alias;
+-              return sprintf('Data::Alias::alias(my %s = do { %s });', $var, 
$val);
++              my $format;
++              if (HAS_REFALIASING) {
++                      $format = <<'EOF';
++my %s;
++{
++      use experimental 'refaliasing';
++      \%s = \do { %s };
++};
++EOF
++                      return sprintf($format, ($var) x 2, $val);
++              }
++              else {
++                      require Data::Alias;
++                      return sprintf('Data::Alias::alias(my %s = do { %s 
});', $var, $val);
++              }
+       }
+       elsif ($self->kind eq 'our')
+       {
+--- a/lib/Kavorka/TraitFor/Parameter/ref_alias.pm
++++ b/lib/Kavorka/TraitFor/Parameter/ref_alias.pm
+@@ -9,6 +9,8 @@
+ 
+ use Moo::Role;
+ 
++use constant HAS_REFALIASING => ($] >= 5.022);
++
+ around _injection_assignment => sub
+ {
+       my $next = shift;
+@@ -17,8 +19,21 @@
+       
+       if ($self->kind eq 'my')
+       {
+-              require Data::Alias;
+-              return sprintf('Data::Alias::alias(my %s = %s{ +do { %s } });', 
$var, $self->sigil, $val);
++              my $format;
++              if (HAS_REFALIASING) {
++                      $format = <<'EOF';
++my %s;
++{
++      use experimental 'refaliasing';
++      \%s = \%s{ +do { %s } };
++};
++EOF
++                      return sprintf($format, ($var) x 2, $self->sigil, $val);
++              }
++              else {
++                      require Data::Alias;
++                      return sprintf('Data::Alias::alias(my %s = %s{ +do { %s 
} });', $var, $self->sigil, $val);
++              }
+       }
+       elsif ($self->kind eq 'our')
+       {
diff --git a/debian/patches/README b/debian/patches/README
new file mode 100644
index 0000000..80c1584
--- /dev/null
+++ b/debian/patches/README
@@ -0,0 +1,3 @@
+0xxx: Grabbed from upstream development.
+1xxx: Possibly relevant for upstream adoption.
+2xxx: Only relevant for official Debian release.
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..27a338e
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+1001_remove-data-alias-dependency.patch
diff --git a/debian/rules b/debian/rules
index b739e0a..c10a23b 100755
--- a/debian/rules
+++ b/debian/rules
@@ -24,12 +24,13 @@ pkg = $(DEB_SOURCE_PACKAGE)
 
 # Needed by upstream build and (always) at runtime
 #  * Recent Scalar::List::Utils needed for Sub::Util
-perl-deps = data-alias exporter-tiny module-runtime padwalker
+perl-deps = exporter-tiny module-runtime padwalker
 perl-deps += parse-keyword return-type type-tiny
 perl-deps += match-simple namespace-sweep
 deps = $(patsubst %,$(comma) lib%-perl,$(perl-deps))
 deps +=, libmoo-perl (>= 1.003001)
 deps +=, libscalar-list-utils-perl (>= 1:1.40)
+deps +=, perl (>= 5.22) | libdata-alias-perl
 deps +=, perl (>= 5.14)
 
 # Needed (often) at runtime

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libkavorka-perl.git

_______________________________________________
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits

Reply via email to