rpmbuild, environment modules and zsh

Mike Miller mtmiller at ieee.org
Sat Sep 13 01:12:04 UTC 2014


On Fri, Sep 12, 2014 at 13:43:43 -0300, Fabricio Cannini wrote:
> Hi there
> 
> When packaging a software, i usually use environment modules [
> http://modules.sourceforge.net/ ] to configure things like compilers,
> libraries and etc.
> 
> It all used to work fine when my user account used bash as shell, but since
> I've changed to zsh, I always have to explicitly run 'source
> /etc/profile.d/modules.sh' after '%build' so that the 'module' command will
> work ok. I even explicitly set '%__build_shell' to '/bin/bash' , but it did
> not help.
> 
> I'm using :
> 
> - centos 6.5 x86_64
> - rpm-build 4.8.0-37
> - environment-modules 3.2.10-1
> - zsh 4.3.10-7
> 
> Does anybody have a clue of what happened when I switched from bash to zsh ?

Hi Fabricio, I have also run into this problem when building
modules-based rpms when the user shell is zsh or (sadly) tcsh.

I think the reason why the module command works when your shell is bash
is because bash is the only shell that supports exporting shell
functions (export -f). In all other shells, the module command is a
shell function or alias, but can't be exported through the environment
to subshells. Since /etc/profile.d/modules.sh is only loaded in
interactive shells, it isn't loaded by the rpm build shell scriptlets
for example.

The only solution I've found is to start an interactive bash shell
before rpmbuild, or source the file as you've done.

HTH,

-- 
mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.rpm.org/pipermail/rpm-list/attachments/20140912/e9a8e4cc/attachment.asc>


More information about the Rpm-list mailing list