
Sometimes there is the need for simple patches to build rpm packages properly. Most packages know this one by heart, but just in case I wont to write it down here.
To create patches, first unpack the sources and create a copy of the sources under a new name. The best is to use a name with a suffix, like ProgramDir_new. Afterwards, change into the _new directory, modify whatever you need to modify and go back to the main directory.
After that, call the diff tool, save the ouput as a patch and move the patch to where you need it:
diff -uNr ProgramDir ProgramDir_new > my-changes.patch mv my-changes.patch ~/rpm-system/SOURCES/.
The u is for the right patch format, the N includes new files, the r is for recursive.
Now add the patch as another source in your rpm spec file and call the patch algorithm during the preparations:
Source0: http://program.com/files/%{name}_%{version}.tar.gz
Patch0: my-changes.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
[...]
%prep
%setup -q
%patch -p1
That’s it.
