wiki:SubmittingPatches/Svn

Using Git for creating patches is highly recommended over SVN.

How To Create a Patch Using SVN

The first step is to prepare your work environment, before you are ready to contribute to the OpenWrt project. This requires everytime that you start with a fresh checkout from SVN (this example assumes that SVN is already installed on your local system, and uses the trunk development branch as example).

 # cd ~/src
 # svn co svn://svn.openwrt.org/openwrt/trunk/

When this has taken place you can go ahead and make your local changes. When the changes to a specific file are done, then ensure you are still in sync with svn.

 # cd ~/src/trunk
 # svn up

Patches for the OpenWrt base system

When the local source is in sync with SVN it is recommended to begin with the actual testing of the new changes - does everything compile as expected or have new issues emerged.

When the changes compile without unexpected erors then it is time to create the actual patch. To create a patch (with the help of SVN) that is applicable with -p1, you need to go to the parent directory of your checkout.

 # cd ~/src/trunk/..

Then you can create a patch with the changes for directory-x.

 # svn diff trunk/directory-x > all_changes.patch

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

 # cd ~/src/trunk/..
 # svn diff trunk/directory-x/channels/foo.c > foo_changes.patch

The above command can also be used with a specified list of files.

 # cd ~/src/trunk/..
 # svn diff trunk/directory-x/sub-directory/foo-23.c trunk/directory-x/sub-directory/foo-45.c trunk/directory-x/sub-directory/foo-67.c > foo_changes.patch

If you created new files or directories which should be included in the patch, you have to add them to your work copy first.

 # cd ~/src/trunk/directory-x
 # svn add new-subdirectory/ new-file.c
 # cd ~/src/trunk/..
 # svn diff trunk/directory-x/changed-file.c trunk/directory-x/new-subdirectory/ new-file.c > changes_and_additions.patch

Hereafter the finished patch file is submitted to openwrt-devel as described above.

Patches for feeds using svn

Patches for feeds work mostly the same, except your base directory to call svn diff in is ~/src/trunk/feeds, e.g.

 # cd ~/src/trunk/feeds/feedname/..
 # svn diff feedname/directory-x > changes_and_additions.patch
Last modified 5 years ago Last modified on 2013-07-08T18:15:39+02:00