In the gtkglarea spec file on the previous page you may have noticed some information mentioning a patch. While reading this section of the tutorial it may be useful to look at that spec file for your reference.
Why Create a Patch?
When creating a package the source0 should always be the upstream version of the package. Don’t download a copy of the package to your computer and make that the source. Point the source0 to the tar package on-line or wherever the upstream version is kept. If anything must be changed to get the package to build, install, or to improve the output from rpmlint, then you need to create a patch if you don’t have access to change the upstream version. You can also submit patches to other people for bug fixes if you discover how to fix an error on someone elses package.
Creating the Patch
Creating a patch is actually very easy. On your desktop, or somewhere else easily accessible, download the source for the package. Then extract the tar file for the package twice to create two copies of the package. In one copy make all the changes to the source that you need to make. This will be the revised version. Leave the other copy alone as a plain copy of the current upstream source. Then run:
diff -urN [upstream-directory] [revised-diretory] > information.patch
Afterwards place the patch into ~/rpmbuild/SOURCES/. Now when you build the package if you’ve properly included the patch information in the spec file, the rpm will be created with whatever changes you made to the source code as specified in the patch. Notice in the gtkglarea spec file below source0 there is the line Patch0:gtkglarea.patch. This specifies the location of the patch. Then include the line %patch0 -p1 after the %prep section (refer to gtkglarea spec file). That’s all that has to be done.