Expand ENV variables in RHS of option list options
Updating the comet simfactory files once more after a module update, I find myself reminded that while we use the module
command in envsetup
we are not really reaping much of a benefit from it b/c we cannot use eg HDF5HOME
in comet.cfg
since those files, while they look like they may, are not actually parsed by make, and thus things like HDF5_DIR=$(HDF5HOME)
do not work.
Thus one has to repeat the full path to eg HDF5 in HDF5_DIR
etc. each time the modules are updated or risk that ini file and cfg get out of sync (irrespective of how happy / unhappy one is with having build information in the ini files to begin with).
Inspired by #332 a possible way to use them would be to not set HDF5_DIR
in comet.cfg
at all and instead add lines like:
export HDF5_DIR=$HDF5HOME
to envsetup
in comet.ini
. While this works it requires sufficiently much knowledge of almost forgotten Cactus lore (namely that Cactus is supposed to used ENV variables as a sources of configure options) that I am feeling somewhat uncomfortable with it (at the very least one would have to add a comment to comet.cfg
that HDF5_DIR
is actually supplied by envsetup
).
Thus branch rhaas/expenv
adds explicit code to expand ENV variables of the form $(FOO)
when the options are read in from config-info
.
The branch can be found here: https://bitbucket.org/cactuscode/cactus/src/3894ff8129fafd018c2810173b0a9763e95b8612/?at=rhaas%2Fenvexp with the actually interesting commit being: https://bitbucket.org/cactuscode/cactus/commits/a5c6260e94ec23472db8de0cd9835bc4f2584af6
Comments (7)
-
reporter -
reporter - edited description
-
reporter - changed status to open
-
reporter Unless objected I will apply this after 2020-01-10.
-
reporter @Steven R. Brandt and I had a some offline discussion and iterated over the best regular expression to use. In he course of this we realised that
$(...)
cannot be used b/c there is already an option list that relies on$(…)
being expanded as only a make variable to setC_MAKE_DEPENDS
usingCC
which is only known tomake
but not in the environment (usually). -
reporter - changed status to resolved
-
reporter Turns out that simfactory already supported something very similar via its used of
@ENV(FOO)@
syntax in option lists. See https://bitbucket.org/simfactory/simfactory2/commits/8eae826ee6372ed6b3d44b3f4428e06969be8185#Lmdb/optionlists/sciama.cfgT12 - Log in to comment
Pull request is here: https://bitbucket.org/cactuscode/cactus/pull-requests/75/rhaas-envexp/diff
I have done my very best to make the regular expression as incomprehensible as Perl lets me (well I could pick a separator more confusing than
#
I guess, but am doing a good job otherwise I think).Comments on both whether this is a desirable feature to begin with and on the implementation would be welcome.
Please review.