1

Requires: in the spec files sets the package dependencies, but what will happen if the repo of the requirements is not in the repolist?

Is there a way to use pre downloaded rpm files and tell the rpmbuild that the dependencies should be installed from the local file like yum localinstall.

Edik Mkoyan
  • 309
  • 2
  • 17
  • You say you want to tell `rpmbuild` but then in a comment below it implies you meant `rpm` - are you talking about "what you need to do to build an RPM" or "what the end user needs to do to install a set of RPMs?" – Aaron D. Marasco Oct 18 '22 at 15:08

1 Answers1

1

You're conflating rpm and yum when you mention repolist.

  • rpm is a lower level and only knows about RPM files
  • yum collects sets of RPMs into repositories and sits on top of RPM to handle dependencies

Now, to answer the question - rpmbuild does not need anything from the Requires field to build the RPM. If it does, then the RPMs should be listed as BuildRequires in the specfile and only be in Requires if the end user needs it to be installed to run the final product. For example, to build you might need foo-devel but at runtime you only need libfoo. Those should be declared appropriately.

Even if you fix the Requires vs. BuildRequires fields, it still won't help you - rpmbuild cannot install RPMs itself because you should never run rpmbuild as root. An error in a specfile can very easily nuke an entire machine if it's run as root.

Aaron D. Marasco
  • 6,506
  • 3
  • 26
  • 39
  • as I understand BuildRequires is used to define the packaged that rpmbuild needs during the installation, a compiler for example. My problem is eliminating the need of adding yum private repository before installing the Required: package. I other words I have the rpm files, can I pack those in a wrapper rpm package. – Edik Mkoyan Oct 18 '22 at 04:58
  • Yes, `BuildRequires` is used to tell `rpmbuild` what packages you need to _build_ the RPM, not _install_ the RPM which is what you do on a target machine. Your original question is talking about telling `rpmbuild` - not `rpm`. No, you cannot put RPM files into another RPM because the `rpm` process is non-reentrant. You need to wrap them all up in a tarball with a shell script for the end user. – Aaron D. Marasco Oct 18 '22 at 15:06