rpmbuild shebang auto required packages

NodeJS is a real pain to install, if you do not have Python >= 2.6 available on your system. So basically, you cannot install NodeJS 0.8 on SLES10 without some tricks. Compiling Python 2.7 is one of them, creating a package with the python compiled into the NodeJS install is another – of course ugly – method.

Though, there’s one big issue when packaging script languages and their shebang interpreter: rpmbuild automatically adds the shebang binary as dependency.

So if you got some script having


as the first line, the final package will require /usr/local/bin/python and failing on install.

This even gets worse, when the environment is used, such as

#!/usr/bin/env python

This will make rpmbuild actually query PATH to get the first match for python, which then will be added as implicit dependency.

Well, basically – it sucks. Especially looking for the error. But luckily it unveils a solution.

So, within the spec file (best after BuildRequires), set AutoReq to no.

AutoReq: no

At least – afterwards the package must make sure that the PATH to python is found correctly in all used scripts.