Packaging sample applications with RPM¶
Use this workflow to package a sample application that is available upstream. The sample application has several services:
engine-service
: A service with a single event that signals when the car is in reverse.radio-service
: A service that emulates a radio, regularly publishing information about the current song, radio station, and volume. It accepts requests to turn the radio on and off, change the channel, and adjust the volume. If the engine service is available, theradio-service
listens for events and temporarily lowers the radio volume while the car is in reverse.radio-client
: A command line program that displays the current state of the radio service and enables you to control it. The keyboard controls are displayed on the screen.
Procedure
-
Clone the sample application repository:
-
Create a
tar
archive using upstream samples: -
Move the
.tar
archive of your software to the~/rpmbuild/SOURCES
directory: -
From the
~/rpmbuild/SPECS/
directory, create aspec
file for a new RPM package calledauto-apps
:This command creates a spec file named
auto-apps.spec
. -
Modify the
~/rpmbuild/SPECS/auto-apps.spec
file with a text editor:auto-apps.spec fileName: auto-apps Version: 0.1 Release: 1%{?dist} Summary: A test RPM of auto-apps License: MIT Source0: auto-apps-%{version}.tar.gz BuildRequires: cmake make gcc-c++ boost-devel vsomeip3-devel %description Sample auto applications %prep %autosetup %build %cmake %cmake_build %install %cmake_install %files %{_bindir}/engine-service %{_bindir}/radio-client %{_bindir}/radio-service %changelog * Tue Feb 20 2024 your_name <your_email> - Initial packaging
Be sure to update the
%build
,%install
, and%files
sections of the spec file. This spec file is a minimal working spec file for the sampleauto-apps
applications. You can further customize the spec file to control your RPM build process. For more information about spec files and how to customize them, see the RPM packaging Guide on GitHub. -
Build the binary RPM:
-
Create a directory for your RPM package repository, move your
.rpm
file to this directory, and initialize the directory as an RPM package repository:
Your RPM package repository is now ready, and it contains your software packaged as a .rpm
file. When you build the AutoSD image, include the RPM
package repository in the build manifest to enable the OS image to incorporate your software.