3
votes

I am modifying gnome-shell-3.8.xx.rpm package. I have created several patches for rpm and they are working fine. Now I want to add new source file in rpm but I am not able to find how to do it?

For patches I have followed below approach:

  1. Download source rpm.
  2. install rpm which creates BUILD, BUILDROOT, RPMS, SOURCES SPECES SRPMS directories.
  3. copy my patches in SOURCES directory.
  4. Modify the SPEC file to include my patches
  5. Create new package with rpmbuild -bb SPEC/spec_file command.
1
What problem are you having exactly? The patches create a new file and you want that included in the generated package? You have applied your patches in the spec file use %patch##? To package a file you need to copy it somewhere appropriate during %install and potentially add it to the list of files under %files. - Etan Reisner
Besides the patch, I want to include a new file. I have made patch file for Makefile but I am not getting where should I put my new file and where is the list of all source file present in rpmbuild directory hierarchy? - user746184
You have a new file in addition to the new patches? You just put that in SOURCES and add it as a Source## line the way the other sources (and patches with Patch##) work. Then do what I said above. - Etan Reisner

1 Answers

3
votes

Drop your patch or any other file you want to include (RPM) put all them in SOURCE directory

 ../SOURCES/package-1.0-my.patch
 ../SOURCES/service.init

Add in SPEC file

Source1:  service.init
Patch0: package-1.0-my.patch

Add in %pre section:

%prep
%setup ...
%patch0 -p1
...
...
install -p -D -m 755 %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/service.init

Build RPM:

rpmbuild -ba ../SPEC/package.spec

Notes: Above Source1 is example you can use your file name instead of service.init and change path to install specific location