Skip to content

Commit 9553e3f

Browse files
committed
Remove use of smartmatch in autogen.pl
Smartmatch was retroactively deprecated due to corner cases, so replace with a list search function that does basically the same thing (for our use case). We could theoretically use List::Util::any here, but some distros do not ship List::Util by default (Amazon Linux 2). Signed-off-by: Brian Barrett <bbarrett@amazon.com>
1 parent 721daed commit 9553e3f

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

autogen.pl

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,18 @@ sub debug_dump {
134134

135135
##############################################################################
136136

137+
sub list_contains {
138+
my $searched_string = shift;
139+
foreach my $str (@_) {
140+
if ($searched_string eq $str) {
141+
return 1;
142+
}
143+
}
144+
return 0;
145+
}
146+
147+
##############################################################################
148+
137149
sub read_config_params {
138150
my ($filename, $dir_prefix) = @_;
139151

@@ -1589,15 +1601,16 @@ sub replace_config_sub_guess {
15891601
dnl 3rd-party package information\n";
15901602

15911603
# Extract the OMPI options to exclude them when processing PMIx and PRRTE
1592-
if ( ! ("pmix" ~~ @disabled_3rdparty_packages && "prrte" ~~ @disabled_3rdparty_packages) ) {
1604+
if ( ! (list_contains("pmix", @disabled_3rdparty_packages) &&
1605+
list_contains("prrte", @disabled_3rdparty_packages))) {
15931606
safe_system("./config/extract-3rd-party-configure.pl -p . -n \"OMPI\" -l > config/auto-generated-ompi-exclude.ini");
15941607
}
15951608

15961609
# these are fairly one-off, so we did not try to do anything
15971610
# generic. Sorry :).
15981611

15991612
verbose "=== Libevent\n";
1600-
if ("libevent" ~~ @disabled_3rdparty_packages) {
1613+
if (list_contains("libevent", @disabled_3rdparty_packages)) {
16011614
verbose "--- Libevent disabled\n";
16021615
} else {
16031616
my $libevent_directory = "libevent-" . $libevent_version;
@@ -1612,7 +1625,7 @@ sub replace_config_sub_guess {
16121625
}
16131626

16141627
verbose "=== hwloc\n";
1615-
if ("hwloc" ~~ @disabled_3rdparty_packages) {
1628+
if (list_contains("hwloc", @disabled_3rdparty_packages)) {
16161629
verbose "--- hwloc disabled\n";
16171630
} else {
16181631
my $hwloc_directory = "hwloc-" . $hwloc_version;
@@ -1627,7 +1640,7 @@ sub replace_config_sub_guess {
16271640
}
16281641

16291642
verbose "=== PMIx\n";
1630-
if ("pmix" ~~ @disabled_3rdparty_packages) {
1643+
if (list_contains("pmix", @disabled_3rdparty_packages)) {
16311644
verbose "--- PMIx disabled\n";
16321645
} else {
16331646
# sanity check pmix files exist
@@ -1646,7 +1659,7 @@ sub replace_config_sub_guess {
16461659
}
16471660

16481661
verbose "=== PRRTE\n";
1649-
if ("prrte" ~~ @disabled_3rdparty_packages) {
1662+
if (list_contains("prrte", @disabled_3rdparty_packages)) {
16501663
verbose "--- PRRTE disabled\n";
16511664
} else {
16521665
# sanity check prrte files exist

0 commit comments

Comments
 (0)