Why does rpmbuild add dependencies automatically while building an rpm?
Environment
- Red Hat Enterprise Linux 5/6
rpm-build
Issue
- Building an
rpm
from the source andspec
file. - The source contains various scripts and few binaries.
- The
spec
file doesn't contain theRequires:
section which should letrpmbuild
to build rpm without any dependencies. - Why does
rpmbuild
add dependencies automatically while building therpm
containing scripts?
Resolution
- The binary
rpm-build
while building the package, extracts the source as per mentioned in thespec
file. - During that process, it runs
file
command on all the files present in the source if those files are required to be put as they are viarpm
. - This is done by the script
/usr/lib/rpm/find-requires
which adds the dependencies automatically. - For example, if the file to be deployed is a
python
script, then/usr/lib/rpm/find-requires
will automatically addpython
in the dependency of thatrpm
package.
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Comments