Sunday, April 19, 2009

How to play with software patches.


In an open source world, if you are interested in contributing to an open source project by developing the source code first of all you need to build the source code. Then you have to submit the code you developed for that project through a patch or directly changing the code. If you are not a commitor for that project you can't directly change the source code. A commitor is a person who has source code modification rights for a open source project. If you are not a commitor then you have to submit what you have done through a patch.
A patch is a textual format file which contains the modifications has been done related to the original source code of a software project in open source terms. An example of an patch is as follows.

Index: Rakefile
===================================================================
--- Rakefile (revision 752423)
+++ Rakefile (working copy)
@@ -175,6 +175,12 @@
web_inf.merge project("dao-hibernate-db").package(:zip)
web_inf.include project("axis2").path_to("src/main/wsdl/*")
web_inf.include project("bpel-schemas").path_to("src/main/xsd/pmapi.xsd")
+ web_inf.include project("bpel-schemas").path_to("src/main/xsd/dmapi.xsd")
+ web_inf.include project("bpel-schemas").path_to("src/main/xsd/breaks_bdi_bpel.xsd")
+ web_inf.include project("bpel-schemas").path_to("src/main/xsd/common_bpel.xsd")
+ web_inf.include project("bpel-schemas").path_to("src/main/xsd/java_util.xsd")


In a patch file it contains details on what lines have been added with a “+” sign and what lines have been removed with a “-” sign.

Let see how to create an patch file first. As I mentioned earlier first of all you have to build the source code of the project. Here you may use an version controlling software like “SubVersion” to manage and update your local source code with the online source code repository. This version controlling tool can used to create a patch for the modifications what you have done in your local source code. In SubVersion the command is as follows.

svn diff > bug-x-free.patch

The above command will create a patch file named “bug-x-free.patch”. For more details on creating custom patches can be found on here.
Then that patch file can be submitted through the particular project issue tracker (like JIRA, Bugzilla etc.)
Then the patch will be examined by a project commitor and added to the source code.
Note: Be careful to test the local modified source code whether it's working OK before submitting the patch.

Suppose you need to add a patch file to your local source code, then you can use the following command at the root of your source directory to add the patch the source code.

patch -p0 -i bug-x-free.patch

Then your source code will be modified based on the patch file.

Suppose then you want to revert the patch you added. The reverting functionality is not supported by patch command it-self. Then what you can do is to interchange the “+” with “-” in the patch file to revert the changes as those “+” and “-” signs are used to denote the added code line and removed code lines in the source code. Then again by using the above patch command you can revert the modifications occurred by the original patch file.

11 comments:

Denis Weerasiri said...

thanks for sharing information about software patches.

free downloadable software

Denis Weerasiri said...

superb! very easy tutorial of software patches. latest software downloads

Denis Weerasiri said...

play with software patches is really interesting and ideal post . thanks for nice sharing!
free software download full versions

Denis Weerasiri said...

free download of full version software

Denis Weerasiri said...

this information is very helpful for play with software patches.


free download software full version with key

Denis Weerasiri said...

Have A Nice Fun ...... with this trick ....
Download Free Software | Free Software Download

Denis Weerasiri said...

very useful post! thanks for tips for play with software patches. http://ddlsoftwarez.blogspot.com/

Denis Weerasiri said...

that's nice thanks admin for this useful code....
Portable Software | FULL VERSION

Denis Weerasiri said...

this post is very interesting and also thanks for useful sharing of software patches.
crack software serial

Denis Weerasiri said...

this is a cool sharing to play with software patches.
Crack Software

Denis Weerasiri said...

thanks for nice sharing to play with software patches.
Download Free Software