2.10.7. Software Collection Shebang Support

A shebang is a sequence of characters at the beginning of a script that is used as an interpreter directive. The shebang is processed by the automatic dependency generator and it points to a certain location, possibly in the system root file system.
When the automatic dependency generator processes the shebang, it adds dependencies according to the interpreters they point to. From the Software Collection point of view, there are two types of shebangs:
#!/usr/bin/env example
This shebang instructs the /usr/bin/env program to run the interpreter.
The automatic dependency generator will create a dependency on the /usr/bin/env program, as expected.
If the $PATH environment variable is redefined properly in the enable scriptlet, the example interpreter is found in the Software Collection file system hierarchy, as expected.
You are advised to rewrite the shebang in your Software Collection package so that the shebang specifies the full path to the interpreter located in the Software Collection file system hierarchy.
#!/usr/bin/example
This shebang specifies the direct path to the interpreter.
The automatic dependency generator will create a dependency on the /usr/bin/example interpreter located outside the Software Collection file system hierarchy. However, when building a package for your Software Collection, you often want to create a dependency on the %{?_scl_root}/usr/bin/example interpreter located in the Software Collection file system hierarchy.
Keep in mind that even when you properly redefine the $PATH environment variable, this has no effect on what interpreter is used. The system version of the interpreter located outside the Software Collection file system hierarchy is always used. In most cases, this is not desired.
If you are using this type of shebang and you want the shebang to point to the Software Collection file system hierarchy when building your Software Collection package, use a command like the following:
find %{buildroot} -type f | \
  xargs sed -i -e '1 s"^#!/usr/bin/example"#!%{?_scl_root}/usr/bin/example"'
where /usr/bin/example is the interpreter you want to use.