logo

Creating patches

Published on Asterisk :: The Open Source PBX & Telephony Platform

Preparing your environment

When you would like to make a change to the Asterisk source code that you would like to contribute to the project, be sure to start with a fresh checkout from SVN.


 # cd /usr/src
 # svn checkout http://svn.digium.com/svn/asterisk/trunk asterisk

Creating a patch

After making your changes, make sure you are still in sync with svn.


# cd /usr/src/asterisk
# svn update

Now, it is time to create your patch. To create a patch that contains all of your changes, use the following command.


# cd /usr/src/asterisk
# svn diff > all_changes.patch

To create a patch that contains only the changes to a specific file, you would issue this command.


# cd /usr/src/asterisk
# svn diff channels/chan_sip.c > sip_changes.patch

This can also be used with a list of files.


# cd /usr/src/asterisk
# svn diff channels/chan_iax2.c channels/iax2-parser.c\
      channels/iax2-parser.h > iax_changes.patch

Applying a patch

This is how to apply a patch.


# cd /usr/src/asterisk
# patch -p0 < /path/to/thepatch

You will then see some output as to whether or not the patch applied correctly.


Source URL: http://www.asterisk.org/developers/patch-howto