Skip to content

Creating an RPM packaging workspace

Creating an RPM packaging workspace

To create an RPM package, you must first create a separate directory for your RPM packaging workspace. An RPM package consists of an archive of source code and a spec file. The spec file contains project metadata and different sections that you use to define how to compile project source code.

Prerequisites

  • A host machine that runs on CentOS Stream, Fedora, or RHEL

Procedure

  1. Install the tools required to build RPM packages, as well as dependencies required by the sample application:

    console sudo dnf install rpmdevtools createrepo rpm-build rpm-devel cmake make gcc-c++ \ boost-devel vsomeip3-devel

  2. From your home directory, run the rpmdev-setuptree utility to create a file structure for the RPM packaging workspace:

    console cd && rpmdev-setuptree

  3. Verify that rpmdev-setuptree created the required directories:

    ```console $ tree ~/rpmbuild/ /home//rpmbuild/ |-- BUILD |-- RPMS |-- SOURCES |-- SPECS |-- SRPMS

    5 directories, 0 files ```

The required directories each serve a unique purpose:

  • BUILD: The location of various %buildroot directories. These are useful for investigating a failed build if the log output is inconclusive.
  • RPMS: The location of your binary RPM packages. This directory contains subdirectories for different architectures.
  • SOURCES: The location of your source code. Package your source code in a tar archive and copy it to the SOURCES directory. At build time, the rpmbuild build tool extracts your software from this directory.
  • SPECS: The location of your spec files.
  • SRPMS: The location of your SRPM packages.

Next steps