User Tools

Site Tools


docs:spec_patching

Page contains my notes how to fix and patch packages from PLD repository.

In building enviroment try to build package (it will be python-PythonMagick in my example). Below comamnd downloads current version of spec, sources patches) and starts to build:

[matkor@appserver3 ~/rpm/packages]$ ./builder -v  python-PythonMagick.spec

If it fails let's uncompress sources only by issuing -bp switch.

[matkor@appserver3 ~/rpm/packages]$ ./builder -v  -bp python-PythonMagick.spec

Now we can make backup of file we wish to edit

[matkor@appserver3 ~/rpm/BUILD/PythonMagick-0.9.1/m4]$ cp -p ax_python.m4 ax_python.m4.ac_python_fix

Pls use non present in source postifx ( in above exmple:.ac_python_fix) - we will use it to generate patch file later.

Now we can test if our fixes helped if so, generate patch file to be included in spec file:

[matkor@appserver3 ~/rpm/BUILD/PythonMagick-0.9.1]$ gendiff . .ac_python_fix
[matkor@appserver3 ~/rpm/BUILD/PythonMagick-0.9.1]$ gendiff . .ac_python_fix  >../../packages/python-PythonMagick/python-PythonMagick-ac_python_fix.patch

Note we generate patch from main dir of build dir, and we use package name as prefix for patch name (it helps include patch in spec and filter all patches)

Add generated patch to spec file by adding:

Patch0:     %{name}-ac_python_fix.patch

and in %setup section of spec file:

%patch0 -p1

If now builds is satisfactory we should publish our fix to repository, by adding patch:

[matkor@appserver3 ~/rpm/packages/python-PythonMagick]$ cvs add python-PythonMagick-ac_python_fix.patch 
cvs server: scheduling file `python-PythonMagick-ac_python_fix.patch' for addition
cvs server: use 'cvs commit' to add this file permanently

Updating Release number, and comitting changes:

[matkor@appserver3 ~/rpm/packages/python-PythonMagick]$ cvs commit -m "- Release 2. Autoconf Python headers detection fix."  python-PythonMagick.spec  python-PythonMagick-ac_python_fix.patch
docs/spec_patching.txt · Last modified: 2010-05-19 15:17 by Mateusz Korniak