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
-
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 -
From your
homedirectory, run therpmdev-setuptreeutility to create a file structure for the RPM packaging workspace:console cd && rpmdev-setuptree -
Verify that
rpmdev-setuptreecreated 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%buildrootdirectories. 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 atararchive and copy it to theSOURCESdirectory. At build time, therpmbuildbuild tool extracts your software from this directory.SPECS: The location of your spec files.SRPMS: The location of your SRPM packages.
Next steps