[OE-core] [PATCH v2 1/3] gnu-config: improve detection of perl setup errors

Andre McCurdy armccurdy at gmail.com
Wed May 27 21:06:11 UTC 2015


Read 'autoconf --trace' output via a temp file to improve error detection.

If the command's output is read via a pipe to Autom4te::XFile then perl
setup errors (e.g. mixing host and OE perl libs) which cause the autoconf
command to segfault may go undetected.

Add a -k / --continue command line option to simulate the old behaviour.

Signed-off-by: Andre McCurdy <armccurdy at gmail.com>
---
 .../gnu-config/gnu-config/gnu-configize.in         | 32 +++++++++++++++++++---
 1 file changed, 28 insertions(+), 4 deletions(-)

diff --git a/meta/recipes-devtools/gnu-config/gnu-config/gnu-configize.in b/meta/recipes-devtools/gnu-config/gnu-config/gnu-configize.in
index d4908fc..c3dcd74 100755
--- a/meta/recipes-devtools/gnu-config/gnu-config/gnu-configize.in
+++ b/meta/recipes-devtools/gnu-config/gnu-config/gnu-configize.in
@@ -45,6 +45,7 @@ use Autom4te::General;
 use Autom4te::XFile;
 # Do not use Cwd::chdir, since it might hang.
 use Cwd 'cwd';
+use File::Temp qw/ tempfile /;
 use strict;
 
 ## ----------- ##
@@ -64,6 +65,7 @@ Operation modes:
   -V, --version            print version number, then exit
   -v, --verbose            verbosely report processing
   -f, --force              consider all files obsolete
+  -k, --continue           ignore errors when running autoconf
   -s, --symlink            install symbolic links instead of copies
   -W, --warnings=CATEGORY  report the warnings falling in CATEGORY [syntax]
 
@@ -86,6 +88,8 @@ my $configdir  = '@gnu-configdir@';
 #'/home/kergoth/code/build-arm/tmp/staging/i686-linux/share/gnu-config';
 my $autoconf   = $ENV{'AUTOCONF'}     || 'autoconf';
 
+my $ignore_autoconf_errors = 0;
+
 # use symlinks instead.
 my $symlink = 0;
 
@@ -109,6 +113,7 @@ sub parse_args ()
 {
   my $srcdir;
 
+  getopt ('k|continue'           => \$ignore_autoconf_errors);
   getopt ('s|symlink'            => \$symlink);
 
   # Even if the user specified a configure.ac, trim to get the
@@ -152,16 +157,33 @@ sub gnu_configize_current_directory ()
   my $dest;
 
   verb "$configure_ac: tracing";
-  my $traces = new Autom4te::XFile
-    ("$autoconf"
+
+  my $autoconf_cmd = "$autoconf"
      . join (' --trace=', '',
 	     # If you change this list, update the
 	     # `Autoreconf-preselections' section of autom4te.in.
 	     'AC_CONFIG_AUX_DIR:AC_CONFIG_AUX_DIR:\$1',
 	     'AC_CONFIG_SUBDIRS:AC_CONFIG_SUBDIRS:\$1',
 	     'AC_INIT',
-	    )
-     . ' |');
+	    );
+
+  # Read 'autoconf --trace' output via a temp file to improve error detection.
+  # If the command's output is read via a pipe to Autom4te::XFile then perl
+  # setup errors (e.g. mixing host and OE perl libs) which cause the autoconf
+  # command to segfault may go undetected.
+
+  my $tmp = File::Temp->new();
+
+  if ($ignore_autoconf_errors)
+    {
+      xsystem ("$autoconf_cmd > $tmp || true");
+    }
+  else
+    {
+      xsystem ("$autoconf_cmd > $tmp");
+    }
+
+  my $traces = new Autom4te::XFile ("< $tmp");
   while ($_ = $traces->getline)
     {
       $aux_dir = $1                 if /AC_CONFIG_AUX_DIR:(.*)/;
@@ -169,6 +191,8 @@ sub gnu_configize_current_directory ()
       push @subdir, split (' ', $1) if /AC_CONFIG_SUBDIRS:(.*)/;
     }
 
+  close $tmp;
+
   # The subdirs are *optional*, they may not exist.
   foreach (@subdir)
     {
-- 
1.9.1




More information about the Openembedded-core mailing list