Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 98 additions & 0 deletions autogen.pl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
# and Technology (RIST). All rights reserved.
# Copyright (c) 2015 IBM Corporation. All rights reserved.
#
# Copyright (c) 2021 Nanook Consulting. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
Expand Down Expand Up @@ -698,6 +699,98 @@ sub in_tarball {
return $tarball;
}

##############################################################################

sub replace_config_sub_guess {
# This could be simpler if we could use some Perl modules for this
# functionality (e.g., DateTime). But I don't want to introduce
# any CPAN dependencies here, so just do sometime simple, even if
# it's a bit laborious. Use a few private helper functions for
# this kind of functionality.

sub _get_timestamp {
my $filename = shift;

my $ret;
if (-x $filename) {
my $out = `$filename --version`;
$out =~ m/GNU config\.[a-z]+ \((.+)\)/;
$ret = $1;
}

return $ret;
}

sub _split_timestamp {
my $ts = shift;

$ts =~ m/(\d+)-(\d+)-(\d+)/;
return $1, $2, $3;
}

# Returns true if timestamp $a > timestamp $b.
sub _timestamp_gt {
my ($a, $b) = @_;

my ($year_a, $month_a, $day_a) = _split_timestamp($a);
my ($year_b, $month_b, $day_b) = _split_timestamp($b);

# Don't try to be clever -- just do a simple set of explicit
# comparisons.
if ($year_a > $year_b) {
return 1;
} elsif ($year_a < $year_b) {
return 0;
} else {
if ($month_a > $month_b) {
return 1;
} elsif ($month_a < $month_b) {
return 0;
} else {
if ($day_a > $day_b) {
return 1;
} else {
return 0;
}
}
}
}

my ($topdir) = @_;

# Find the stashed known-good files, and get their version
# timestamps.
my $cached_dir = "$topdir/config/from-savannah";
my @files = qw/config.guess config.sub/;
my %known_good_timestamps;
foreach my $file (@files) {
my $filename = "$cached_dir/upstream-$file";
my_die("Cannot find $filename")
if (! -f $filename);

my $ts = _get_timestamp($filename);
$known_good_timestamps{$file} = $ts;
}

# Find all config.guess/config.sub files in the tree. If their
# versions are older than the stashed known-good files, update
# them from the stash.
my @files;
File::Find::find(sub {
push(@files, $File::Find::name)
if ($_ eq "config.guess" ||
$_ eq "config.sub") }, $topdir);

foreach my $file (@files) {
my $base = basename($file);
my $ts = _get_timestamp($file);
if (_timestamp_gt($known_good_timestamps{$base}, $ts)) {
print("=== Replacing $file with newer version\n");
safe_system("cp -f $cached_dir/upstream-$base $file");
}
}
}

##############################################################################
##############################################################################
## main - do the real work...
Expand Down Expand Up @@ -877,6 +970,11 @@ sub in_tarball {

patch_autotools_output(".");

# Per https://github.com/open-mpi/ompi/issues/8410, replace config.sub
# and config.guess with known-good versions if the Autoconf-installed
# versions are older.
replace_config_sub_guess(".");

#---------------------------------------------------------------------------

verbose "
Expand Down
5 changes: 4 additions & 1 deletion config/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
# Copyright (c) 2014-2019 Intel, Inc. All rights reserved.
# Copyright (c) 2016 Research Organization for Information Science
# and Technology (RIST). All rights reserved.
# Copyright (c) 2021 Nanook Consulting. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
Expand All @@ -31,7 +32,9 @@ EXTRA_DIST = \
find_common_syms \
getdate.sh \
make_manpage.pl \
md2nroff.pl
md2nroff.pl \
from-savannah/upstream-config.guess \
from-savannah/upstream-config.sub

maintainer-clean-local:
rm -f prte_get_version.sh
11 changes: 11 additions & 0 deletions config/from-savannah/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
These files downloaded from
https://git.savannah.gnu.org/gitweb/?p=config.git at git hash
6faca61810d335c7837f320733fe8e15a1431fc2 on 26 Jan 2021.

They were stashed here in the PRRTE repository in response to
https://github.com/open-mpi/ompi/issues/8410, where it was determined
that the responses from `config.*` installed by Autoconf were not
sufficient for some modern platforms (e.g., Apple M1 Macs).

`autogen.pl` will copy in these files if they are, in fact, newer than
the corresponding files installed by Autoconf.
Loading