I disagree, because the requirement that the variable 'BAR_BIN' that is set is 
a requirement from Foo, not a 'feature' from Bar. Bar knows absolutely nothing 
about this variable, and is very happy to run without it - thus it has no place 
in a Bar module. To illustrate that more: what if someone tomorrow develops a 
Foo2, which requires another environment variable 'WHERE_CAN_FOO2_FIND_BAR' to 
point to the Bar executable, would you reinstall Bar and put this additional 
variable also in the module file of Bar, just because Foo2 needs it?

In my view, BAR_BIN, and WHERE_CAN_FOO2_FIND_BAR are things that are specific 
to Foo and Foo2 respectively, and should be set in their modules. The 
commonality is that I would want to use $EBROOTBAR - which is of course set by 
Bar -, to set BAR_BIN/WHERE_CAN_FOO2_FIND_BAR. I agree that this requires the 
additional assumption within the Foo module that the Bar module installs in the 
$EBROOTBAR/bin folder, which is not very nice. However, I think this is a far 
more generic assumption than when the Foo/Foo2 module has to assume that Bar 
sets BAR_BIN/WHERE_CAN_FOO2_FIND_BAR itself.

Thus, while I understand the 'if it references the tree of Bar, it should be 
set by Bar' sentiment, I think that the alternative here (setting environment 
variables required by Foo, Foo2, or whichever package comes next, in the Bar 
module) is simply worse.

So, my question remains: is it correct that I cannot access the EBROOT of 
dependencies from within modextravars? And is there an elegant way to achieve 
this?

My current, not-so-elegant way is:

modextravars = {'BAR_BIN': '$::env(EBROOTBAR)/bin'}

This works, but $::env (which reads EBROOTBAR at the time the module is loaded) 
is - as far as I know - specific for Tcl modules. Also, things like module disp 
Foo get messed up, because EBROOTBAR is not set then. Thus, I'm not very much 
in favor of this solution and looking for a way to have EasyBuild set the path 
for BAR_BIN at installation time.

Regards,

Caspar


----- Original Message -----
From: "Åke Sandgren" <ake.sandg...@hpc2n.umu.se>
To: "Caspar van Leeuwen" <caspar.vanleeu...@surfsara.nl>
Sent: Monday, 8 January, 2018 13:20:47
Subject: Re: [easybuild] Use of EBROOT of a dependency as modextravar

Any env variable that references the installation tree of Bar should be
set in the module file for Bar!

Foo can then use it. It just needs to depend on Bar.

Foo should NOT set any env variables related to Bar!

That is how modules are supposed to work.

On 01/08/2018 01:17 PM, Caspar van Leeuwen wrote:
> I'm sorry, maybe I should have clarified: Foo requires BAR_BIN to be
> present /at runtime/, so yes, I really do want it to be set in the
> module file of Foo. Foo provides a (GUI) wrapper for Bar, but it needs
> to know the location of the Bar binary. Rather than searching the path -
> as other programs might have done -, Foo uses the BAR_BIN environment
> variable to locate and call Bar (in fact, the installation instructions
> for Foo list that you have to set BAR_BIN).
> 
> Regards,
> 
> Caspar
> 
> ------------------------------------------------------------------------
> *From: *"Alan O'Cais" <a.oc...@fz-juelich.de>
> *To: *"easybuild" <easybuild@lists.ugent.be>
> *Sent: *Monday, 8 January, 2018 12:38:32
> *Subject: *Re: [easybuild] Use of EBROOT of a dependency as modextravar
> 
> I think you are misunderstanding the scope of modextravars, it is there
> to set additional variables in the resultant module file from the
> installation (it is not relevant to the install process of the software,
> only the final module file that is written). The modextravars should be
> set in the Bar easyconfig if you wish to leverage it in Foo? Otherwise
> you just use something like
> 
> preconfigopts = 'BAR_BIN=$EBROOTBAR/bin '
> 
> in the Foo easyconfig.
> 
> On 8 January 2018 at 12:29, Caspar van Leeuwen
> <caspar.vanleeu...@surfsara.nl <mailto:caspar.vanleeu...@surfsara.nl>>
> wrote:
> 
>     Dear EasyBuilders,
> 
> 
>     Question: I have a Package Foo that provides a wrapper for a
>     software package Bar. Thus, in the EasyConfig for Foo, I list Bar as
>     a dependency.
> 
> 
>     Now, Foo requires an environment variable BAR_BIN to be set that
>     points to the Bar binary. Thus, what I would like to do in the Foo
>     EasyConfig is something like:
> 
> 
>     modextravars = {‘BAR_BIN’: ‘$EBROOTBAR/bin’}
> 
> 
>     This doesn’t work: I get an error (something like ‘no variable
>     EBROOTBAR’). I presume the reason is that in the modextravars step
>     for 'Foo', the 'Bar' module isn’t actually loaded - thus EBROOTBAR
>     is not set.
> 
> 
>     I could use $root (which points to the FOO root, and //does exist
>     when modextravars is executed) and peal off the
>     …/Foo/(version)-(toolchain), then add .../Bar/(version)-(toolchain),
>     but this feels like a very dirty solution.
> 
> 
>     Does anyone know of an elegant way to achieve this? And just to
>     check: is it correct that the dependencies are not loaded when
>     modextravars is executed?
> 
> 
>     Best regards,
> 
> 
>     Caspar van Leeuwen
> 
> 
> 
> 
> -- 
> Dr. Alan O'Cais
> E-CAM Software Manager
> Juelich Supercomputing Centre
> Forschungszentrum Juelich GmbH
> 52425 Juelich, Germany
> 
> Phone: +49 2461 61 5213
> Fax: +49 2461 61 6656
> E-mail: a.oc...@fz-juelich.de <mailto:a.oc...@fz-juelich.de>
> WWW:    http://www.fz-juelich.de/ias/jsc/EN
> 
> 
> ------------------------------------------------------------------------------------------------
> ------------------------------------------------------------------------------------------------
> Forschungszentrum Juelich GmbH
> 52425 Juelich
> Sitz der Gesellschaft: Juelich
> Eingetragen im Handelsregister des Amtsgerichts Dueren Nr. HR B 3498
> Vorsitzender des Aufsichtsrats: MinDir Dr. Karl Eugen Huthmacher
> Geschaeftsfuehrung: Prof. Dr.-Ing. Wolfgang Marquardt (Vorsitzender),
> Karsten Beneke (stellv. Vorsitzender), Prof. Dr.-Ing. Harald Bolt,
> Prof. Dr. Sebastian M. Schmidt
> ------------------------------------------------------------------------------------------------
> ------------------------------------------------------------------------------------------------
> 
> 

-- 
Ake Sandgren, HPC2N, Umea University, S-90187 Umea, Sweden
Internet: a...@hpc2n.umu.se   Phone: +46 90 7866134 Fax: +46 90-580 14
Mobile: +46 70 7716134 WWW: http://www.hpc2n.umu.se

Reply via email to