Skip to content

How to Write a Patch

You create one or more .patch files with diff and stick them in the osg directory. Then you declare the patch files in the header of the spec file with a line like Patch0: py24compat.patch and in the %prep section, just after%setup, you add a %patch line to actually apply the patch, like this: %patch0 -p1 (where the -p1 indicates that it should strip off the first leading component of the path in each file mentioned in the .patch file) Look at the mash package for an example.

The easiest way to actually create the patch in the first place is to use a utility called quilt. First you run osg-build quilt on the package directory and it will create a _quilt subdirectory that has the expanded sources and patches.

  • cd into _quilt/pegasus-source-2.3.0, then run quilt push -a to apply any patches that already exist (there are none for pegasus but there might be for other packages).
  • run quilt new py24compat.patch to name your new patch file.
  • run quilt add <filename> for each file you want to make changes to (you must run this before making any changes).
  • actually make the changes.
  • run quilt refresh -p1 to have quilt add those changes into the .patch file. (The -p1 option to quilt refresh must be the same as the -p1 option to %patch0 in your spec file).
  • copy patches/py24compat.patch into the pegasus/osg directory and edit the spec file as above.

Don't forget to git add your new patch file before committing. Once you've tested your patch successfully, you should make that bug report and send them the patch. A bug report is looked on more favorably if it includes a patch to fix the problem.