Issue
I have a rpm generation process for my custom software and scripts package where in i am trying to minimize repeated work via generic automation as much as possible. I am almost done except one small quirk which is instead of manually specifying the large list of files that need to be in the rpm package i want the list to be auto generated and captured at run time somehow. Is this possible ?
Ex:- I am trying to do like below in the rpm spec file.In %files section and it blows up. The files section is very long and so hence i want to reduce getting that list manually via UNIX command and paste it inside the spec file.
# Author : Anand Kulkarni - 29/02/2020.
# Description : squirrel-client rpm specfile.
# Version : squirrel-client-1.0
Summary:squirrel linux client with mssql, sybase, oracle and mysql drivers for connectivity.
Name:squirrel-client
Version:1.0
Release:1
License:GPL
BuildArch:noarch
Group:Application/misc
Source:%{name}-%{version}.tar.gz
URL:www.github.com/anandkulkarnisg
Distribution:Fedora Linux 31
Vendor:Anand Kulkarni
Packager:Anand Kulkarni
%description
This rpm provides simply installable rpm package for squirrel linux client. It includes mssql, sybase and oracle drivers for connection installed.
%prep
rm -rf $RPM_BUILD_DIR/%{name}-%{version}
tar -xzvf $RPM_BUILD_DIR/%{name}-%{version}.tar.gz
%setup
buildRpmMakeFile /opt/squirrel-client-1.0 installers/Makefile
%build
%install
cd installers
make buildroot
make install
%post
chown -R anand:anand /home/anand/.squirrel-sql/
%files
listFiles /opt/squirrel-client-1.0 f
Solution
You want the -f
option for %files
:
The -f option is used to direct RPM to read the %files list from the named file. Like the %files list in a spec file, the file named using the -f option should contain one filename per line and also include any of the directives named in this section.
From the older-but-still-valid Maximum RPM.
Answered By - Aaron D. Marasco