bug#30631: Automake 1.6 fails to build with perl 5.18.2

2018-03-08 Thread Torsten Seemann
Awesome, thanks!

On 9 Mar. 2018 07:40, "Mathieu Lirzin"  wrote:

> Torsten Seemann  writes:
>
> > That patch looks good - removing List::Util altogether is probably the
> right thing. And tests too.
>
> Pushed as commit 74902aa24d4c313ab51fa684142d9240f636971a.
>
> Thanks for the review.
>
> --
> Mathieu Lirzin
> GPG: F2A3 8D7E EB2B 6640 5761  070D 0ADE E100 9460 4D37
>
>


bug#30631: Automake 1.6 fails to build with perl 5.18.2

2018-03-08 Thread Mathieu Lirzin
Torsten Seemann  writes:

> That patch looks good - removing List::Util altogether is probably the right 
> thing. And tests too.

Pushed as commit 74902aa24d4c313ab51fa684142d9240f636971a.

Thanks for the review.

-- 
Mathieu Lirzin
GPG: F2A3 8D7E EB2B 6640 5761  070D 0ADE E100 9460 4D37





bug#30631: Automake 1.6 fails to build with perl 5.18.2

2018-03-03 Thread Torsten Seemann
Mathieu,

That patch looks good - removing List::Util altogether is probably the
right thing. And tests too.

For linuxbrew, this is the patch I proposed - it uses `reduce` which has
been part of List::Util from the start (I think).
https://github.com/Linuxbrew/homebrew-core/pull/6352/files

+-use List::Util 'none';

++use List::Util 'reduce';
++sub none (&@) { my $code=shift; reduce { $a && !$code->(local $_ = $b) }
1, @_; }

We appreciate the fast response, as there is lots of infrastructure still
on Ubuntu 14 LTS which uses old Perl 5.18.

Thank you,

Torsten.



A/Prof. Torsten Seemann
*Lead Bioinformatician*
*Melbourne Bioinformatics: melbournebioinformatics.org.au
*
*Microbiological Diagnostic Unit Public Health Laboratory:
mduphl.unimelb.edu.au *
*University of Melbourne, Parkville, AUSTRALIA.*


On 4 March 2018 at 10:49, Mathieu Lirzin  wrote:

> Hello,
>
> Torsten Seemann  writes:
>
> > The problem is that automake 1.16 is importing the function "none"
> > from perl List::Util module.  Unfortunately, "none" was only added to
> > that module in v 1.33 and Perl 5.18 has an older version.  This only
> > occurs in "bin/automake.in"
> >
> > The simplest patch is for the authors to change
> >
> > use List::Util 'none'
> > =>
> > use List::Util 'any'
> >
> > And replace their use of the function (only one case) as so:
> >
> > && none {
> > =>
> > && ! any {
>
> According to [1] both 'none' and 'any' were added in List::Util 1.33.
>
> There is indeed a portability bug on the Automake side since
> 'http://configure.ac' claims to be compatible with Perl 5.6 and Looking
> at the
> perl distributions [2] it seems that 5.6.2 does not have List::Util.
>
> This requirement could probably be relaxed since Perl 5.6 is 18 years
> old, however this can't be done in the micro (bugfix) release I intend
> to make after fixing this bug.  So let's reimplement it ourselves for
> now.
>
>
>
> How does it sound?
>
> [1] https://metacpan.org/changes/distribution/Scalar-List-Utils#L156
> [2] https://www.cpan.org/src/README.html
>
> --
> Mathieu Lirzin
> GPG: F2A3 8D7E EB2B 6640 5761  070D 0ADE E100 9460 4D37
>
>


bug#30631: Automake 1.6 fails to build with perl 5.18.2

2018-03-03 Thread Mathieu Lirzin
Hello,

Torsten Seemann  writes:

> The problem is that automake 1.16 is importing the function "none"
> from perl List::Util module.  Unfortunately, "none" was only added to
> that module in v 1.33 and Perl 5.18 has an older version.  This only
> occurs in "bin/automake.in"
>
> The simplest patch is for the authors to change 
>
> use List::Util 'none'
> =>
> use List::Util 'any'
>
> And replace their use of the function (only one case) as so:
>
> && none { 
> =>
> && ! any {

According to [1] both 'none' and 'any' were added in List::Util 1.33.

There is indeed a portability bug on the Automake side since
'configure.ac' claims to be compatible with Perl 5.6 and Looking at the
perl distributions [2] it seems that 5.6.2 does not have List::Util.

This requirement could probably be relaxed since Perl 5.6 is 18 years
old, however this can't be done in the micro (bugfix) release I intend
to make after fixing this bug.  So let's reimplement it ourselves for
now.

>From 666b787749b5986f7a30453741ca206b6b6ff164 Mon Sep 17 00:00:00 2001
From: Mathieu Lirzin 
Date: Sat, 3 Mar 2018 23:50:10 +0100
Subject: [PATCH] automake: Don't rely on List::Util to provide 'none'

This change fixes automake bug#30631.

This removes the use of List::Util which is not supported by Perl 5.6,
by reimplementing the 'none' subroutine.

* lib/Automake/General.pm (none): New subroutine.
* bin/automake.in (handle_single_transform): Use it.
* t/pm/General.pl: New test.
* t/list-of-tests.mk (perl_TESTS): Add it.
---
 bin/automake.in |  3 +--
 lib/Automake/General.pm | 20 +++-
 t/list-of-tests.mk  |  1 +
 t/pm/General.pl | 27 +++
 4 files changed, 48 insertions(+), 3 deletions(-)
 create mode 100644 t/pm/General.pl

diff --git a/bin/automake.in b/bin/automake.in
index 16fb45182..a52a48951 100644
--- a/bin/automake.in
+++ b/bin/automake.in
@@ -73,7 +73,6 @@ use Automake::Wrap 'makefile_wrap';
 use Automake::Language;
 use File::Basename;
 use File::Spec;
-use List::Util 'none';
 use Carp;
 
 ## --- ##
@@ -1793,7 +1792,7 @@ sub handle_single_transform
 my $dname = $derived;
 if ($directory ne ''
 && option 'subdir-objects'
-&& none { $dname =~ /$_$/ } @dup_shortnames)
+&& none { $dname =~ /$_[0]$/ } @dup_shortnames)
   {
 # At this point, we don't clear information about what
 # parts of $derived are truly file name components.  We can
diff --git a/lib/Automake/General.pm b/lib/Automake/General.pm
index 32f5c8db7..aa2de38b8 100644
--- a/lib/Automake/General.pm
+++ b/lib/Automake/General.pm
@@ -23,7 +23,7 @@ use File::Basename;
 use vars qw (@ISA @EXPORT);
 
 @ISA = qw (Exporter);
-@EXPORT = qw ( $me);
+@EXPORT = qw (  $me);
 
 # Variable we share with the main package.  Be sure to have a single
 # copy of them: using 'my' together with multiple inclusion of this
@@ -66,5 +66,23 @@ sub uniq (@)
return wantarray ? @res : "@res";
 }
 
+# $RES
+# none (, @LIST)
+# 
+# Return 1 when no element in LIST satisfies predicate PRED otherwise 0.
+sub none (&@)
+{
+  my ($pred, @list) = @_;
+  my $res = 1;
+  foreach my $item (@list)
+{
+  if ($pred->($item))
+{
+  $res = 0;
+  last;
+}
+}
+  return $res;
+}
 
 1; # for require
diff --git a/t/list-of-tests.mk b/t/list-of-tests.mk
index 271bfb573..84dd29af0 100644
--- a/t/list-of-tests.mk
+++ b/t/list-of-tests.mk
@@ -54,6 +54,7 @@ t/pm/DisjCon2.pl \
 t/pm/DisjCon3.pl \
 t/pm/DisjConditions.pl \
 t/pm/DisjConditions-t.pl \
+t/pm/General.pl \
 t/pm/Version.pl \
 t/pm/Version2.pl \
 t/pm/Version3.pl \
diff --git a/t/pm/General.pl b/t/pm/General.pl
new file mode 100644
index 0..0caefe7cf
--- /dev/null
+++ b/t/pm/General.pl
@@ -0,0 +1,27 @@
+# Copyright (C) 2018 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see .
+
+use Automake::General;
+
+my $failed = 0;
+
+# Check 'none'.
+my $none_positive = none { $_[0] < 0 } (1, 7, 3, 8, 9);
+$failed = 1 if ($none_positive == 0);
+
+my $none_gt_8 = none { $_[0] >= 8 } (1, 7, 3, 8, 9);
+$failed = 1 if ($none_gt_8 == 1);
+
+exit $failed;
-- 
2.16.2


How does it sound?

[1] https://metacpan.org/changes/distribution/Scalar-List-Utils#L156
[2] 

bug#30631: Automake 1.6 fails to build with perl 5.18.2

2018-03-03 Thread Torsten Seemann
Hello,

I have found the same bug as you (and have a solution)

The problem is that automake 1.16 is importing the function "none" from
perl List::Util module.
Unfortunately,  "none" was only added to that module in v 1.33 and Perl
5.18 has an older version.
This only occurs in "bin/automake.in"

The simplest patch is for the authors to change

use List::Util 'none'
=>
use List::Util 'any'

And replace their use of the function (only one case) as so:

&& none {
=>
&& ! any {

I can't seem to find an online bug tracker for automake so I am guessing
the mailing list I
found your message on is all there is?

If so, could you please pass this on to the maintainers?

Best,

Torsten



A/Prof. Torsten Seemann
*Lead Bioinformatician*
*Melbourne Bioinformatics: melbournebioinformatics.org.au
*
*Microbiological Diagnostic Unit Public Health Laboratory:
mduphl.unimelb.edu.au *
*University of Melbourne, Parkville, AUSTRALIA.*


bug#30631: Automake 1.6 fails to build with perl 5.18.2

2018-02-27 Thread Andreas Schwab
I get this build failure when building automake 1.6 with perl 5.18.2:

$ make -j4
  GEN  bin/automake
  GEN  bin/aclocal
  GEN  t/ax/shell-no-trail-bslash
  GEN  t/ax/cc-no-c-o
  GEN  runtest
  GEN  doc/aclocal.1
  GEN  doc/automake.1
  GEN  lib/Automake/Config.pm
  GEN  t/ax/test-defs.sh
  GEN  bin/aclocal-1.16
  GEN  bin/automake-1.16
  GEN  doc/aclocal-1.16.1
  GEN  doc/automake-1.16.1
help2man: can't get `--help' info from automake-1.16
Try `--no-discard-stderr' if option outputs to stderr
Makefile:3694: recipe for target 'doc/automake-1.16.1' failed
make: *** [doc/automake-1.16.1] Error 255
make: *** Waiting for unfinished jobs

$ ./pre-inst-env automake-1.16 --help
"none" is not exported by the List::Util module
Can't continue after import errors at 
/home/abuild/rpmbuild/BUILD/automake-1.16/bin/automake-1.16 line 76.
BEGIN failed--compilation aborted at 
/home/abuild/rpmbuild/BUILD/automake-1.16/bin/automake-1.16 line 76.

Andreas.

-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."