From 766a32b097376bf044a5b69192bba7104bb52b35 Mon Sep 17 00:00:00 2001 From: Joe Stassi <50463978+gmao-jstassi@users.noreply.github.com> Date: Mon, 30 Dec 2024 12:04:26 -0500 Subject: [PATCH] Bugfix/jstassi/#364 g5 modules perl wrapper (#365) * update g5_modules_perl_wrapper script to remove loadmodules option from call to g5_modules * Modified the expand function in Perl_Config.pm so that environment variables will be correctly expanded in the string if the variables are defined. --------- Co-authored-by: rtodling --- GMAO_etc/Perl_Config.pm | 4 +++- GMAO_etc/g5_modules_perl_wrapper | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/GMAO_etc/Perl_Config.pm b/GMAO_etc/Perl_Config.pm index ab772c4c..a183192d 100644 --- a/GMAO_etc/Perl_Config.pm +++ b/GMAO_etc/Perl_Config.pm @@ -101,7 +101,9 @@ sub expand { #------------------------------------------ foreach $var (@vars) { - ($varname = $var) =~ s/[\$[{}]]//g; + ($varname = $var) =~ s/\$//; # remove '$' + $varname =~ s/\{//; # remove '{' + $varname =~ s/}//; # remove '}' $val_ENV = $ENV{$varname}; $val_eval = eval($var); diff --git a/GMAO_etc/g5_modules_perl_wrapper b/GMAO_etc/g5_modules_perl_wrapper index 5d08e8e3..9e7dd3fe 100644 --- a/GMAO_etc/g5_modules_perl_wrapper +++ b/GMAO_etc/g5_modules_perl_wrapper @@ -37,12 +37,14 @@ # conflict with calling script # 05Feb2018 Stassi Get $bindir from @ARGV, if calling script does not # reside is same directory as this script +# 23Dec2024 Stassi Remove option to call g5_modules with loadmodules +# argument ######################################################################## use strict; use warnings; my ($scriptname, $g5_modules); -my ($BASEDIR, @libmods, $modinit, $loadmodules, @usemods); +my ($BASEDIR, @libmods, $modinit, @usemods); my (@fields, $LD_LIBRARY_PATH); my ($arch, $node); my ($baselib, $status); @@ -94,7 +96,6 @@ sub g5_mpw_get_expected_values { #------------------------------------ chomp( $BASEDIR = `$g5_modules basedir` ); chomp( @libmods = (`$g5_modules modules`) ); - chomp( $loadmodules = `$g5_modules loadmodules` ); chomp( @usemods = (`$g5_modules usemodules`) ); chomp( $modinit = `$g5_modules modinit` ); @@ -137,7 +138,6 @@ sub g5_mpw_set_env_variables { do $modinit; module ("purge"); - if ($loadmodules) { module ("load modules") }; if (@usemods) { foreach ( @usemods ) { module ("use -a $_") } } foreach ( @libmods ) { module ("load $_") }; print " for $node\n";