4

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.
tux3
  • 7,171
  • 6
  • 39
  • 51
user746184
  • 105
  • 1
  • 10
  • 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 Apr 17 '15 at 20:48
  • 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 Apr 17 '15 at 20:53
  • 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 Apr 17 '15 at 20:58

1 Answers1

4

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

Satish
  • 16,544
  • 29
  • 93
  • 149
  • what does second argument of install represents? "/etc/rc.d/init.d...." - represents – user746184 Apr 17 '15 at 21:49
  • I want my destination file (hostname.js) to be copied to /usr/share/gnome-shell/js/ui/hostname.js. So should I write above path after $RPM_BUILD_ROOT ? I have tried it, hostname.js got added to SRPM but not RPM. @EtanReisner – user746184 Apr 17 '15 at 22:18
  • 1
    install command should come under %install section. AND file (hostname.js) should be added in %files section with permissions like %files ... %defattr(644,root,root) /usr/share/gnome-shell/js/ui/hostname.js – user746184 Apr 17 '15 at 22:59
  • I just put example, you can change path according your need. – Satish Apr 19 '15 at 13:17