Can an Rpm Spec File "Include" Other Files

can an RPM spec file include other files?

RPM does not support includes.

I have solved similar problems with either m4 macro processor or by just concatenating parts of spec (when the "include" was at the beginning).

If you only need to pass a few variables at build time, and not include several lines from another file, you can run

rpmbuild --define 'myvar SOMEVALUE' -bb myspec.spec

and you can use %myvar in the spec.

Add extra file into the rpm building process

You need to know where to place your script file on the target installation (e.g. /usr/lib/myApp/plugins/myNiceScript.py)

In the spec-File (section %install) you have to copy your script under %{buildroot} into the target directory (which has to be created first.

%install
...
# in case the dir does not exist:
mkdir -p %{buildroot}/usr/lib/myApp/plugins

cp whereitis/myNiceScript.py %{buildroot}/usr/lib/myApp/plugins

At the end you have to define the file flags in the %files section. E.g. if your file has to have 644 under root:

%files
...
%defattr(644,root,root)
/usr/lib/myApp/plugins/myNiceScript.py

If your plugins directory is to be created during installation you need to define these flags too:

%defattr(755,root,root)
%dir /usr/lib/myApp/plugins

rpm packaging: files installed using rpm but not found by other rpm which requires it

You probably disabled automatic provides. See: http://ftp.rpm.org/max-rpm/s1-rpm-depend-auto-depend.html

You either have to enable it again by deleting the line with AutoReqProv or explicitly write it in spec:

  Provides: libjaegertracing.so.0()(64bit)
Provides: libopentracing.so.1()(64bit)

The first is preferred as the second is hard to maintain.



Related Topics



Leave a reply



Submit