Why does rpmbuild add dependencies automatically while building an rpm?

Solution Unverified - Updated -

Environment

  • Red Hat Enterprise Linux 5/6
  • rpm-build

Issue

  • Building an rpm from the source and spec file.
  • The source contains various scripts and few binaries.
  • The spec file doesn't contain the Requires: section which should let rpmbuild to build rpm without any dependencies.
  • Why does rpmbuild add dependencies automatically while building the rpm containing scripts?

Resolution

  • The binary rpm-build while building the package, extracts the source as per mentioned in the spec 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 via rpm.
  • 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 add python in the dependency of that rpm 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