2

I am on Fedora 31 and I do software development. I need to work with code in many source RPM packages for relatively short periods of time. For this reason, I'd like to simply build the package, but not actually perform the "install" step most of the time.

Is there a way to do this using RPM yum or DNF? To clarify, I would like to build the project as specified in the specfile, in order to have running binaries, but not "install" it; that is, I do not want the built files to be actually copied into the system's filesystem structure.

1
  • Seems to me that rpmbuild -bc would build ("make") the binaries but stop short of the installation. Does that sound like what you want?
    – Jeff Schaller
    Commented Jun 3, 2020 at 16:33

2 Answers 2

2

Building RPMs should not install any of the resulting binaries onto your system (at least I have never observed that behavior using rpmbuild). Though it does normally require installing the SRPM and any build dependencies required to build the package.

If your intention is to avoid having to install SRPM packages into your system to get the SOURCES and SPEC of each project, I would recommend mock from the RPM people. It should be available in the main Fedora repositories: dnf install mock

mock is a wrapper around rpmbuild that utilizes chroots to build RPMs directly from SRPMs. This has the bonus benefit of not having to install SRPMs or any build dependencies on your main system since they are installed inside the chroot.

It can also build SRPMs directly from local directories or source control.

1

the %install step when building an rpm doesn't actually install the binaries on your system, it installs the binaries in the RPM_BUILD_ROOT, that is justs one of the rpm build steps.

Your workflow could look like this:

  • rpm -i *.src.rpm : install the source rpm. This will just unpack the src.rpm and put the source files, spec file etc under ~/rpmbuild.
  • You can then cd ~/rpmbuild/SPEC/ where you will find the spec file to build the rpm files.
  • [optionally] you can do some modifications to the sources, spec file etc
  • now build the rpm packages using rpmbuild -ba the.spec

This is explained here in more detail: https://blog.packagecloud.io/eng/2015/04/20/working-with-source-rpms/.

NOTE: if you just want to rebuild a source rpm, without any changes, you can always try rpmbuild --rebuild the.src.rpm

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .