Building & Submitting a Patch
From GeeXboX wiki
Voir cet article en français - Puede ver el articulo en espanol
Contents |
Principle of a patch
The patch is a .diff file. The program which will create this file compares the original file with the modified file and saves in a text file the modifications made to the original file to arrive at the modified file. Example :
- Original file :
#include <stdio.h>
#include <conio.h>
int main ()
{
clrscr ();
puts ("Hello");
getch ();
return(0);
}
- Modified file :
#include <stdio.h>
#include <conio.h>
void main ()
{
clrscr ();
puts ("Hello");
getch ();
return;
}
- Patch :
@@ -1,9 +1,9 @@
#include <stdio.h>
#include <conio.h>
-int main ()
+void main ()
{
clrscr ();
puts ("Hello");
getch ();
-return (0);
+return;
}
The patch indicates that the line "int main ()" was removed then replaced by "void main ()" and the line "return (0)" was replaced by "return".
Creation of a patch under Windows
Now that you've learned the principle, let's do a little practice !
Caution ! A connection ADSL is strongly recommended.
- First of all, cygwin should be installed. Do the installation leaving everything to default.
- If you modified only 1 file, launch cygwin then run the command :
diff -Naur original_file_with_path modified_file_with_path > patch_file_with_path
Example :
diff -Naur c:/original.c c:/new.c > c:/patch.diff
==> This creates the patch "c:/patch.diff" by comparing the original file "c:/original.c" with the modified file "c:/new.c".
- If you modified several files, launch cygwin then run :
diff -Naur original_directory_with_path modified_directory_with_path > patch_file_with_path
Example :
diff -Naur c:/original c:/new > c:/patch.diff
==> This creates the patch "c:/patch.diff" by comparing ALL the files of the directory "c:/original" with ALL the files of the directory "c:/new".
Note : Avoid putting useless files in the directory, this makes the patch much bigger and less clear.
Creation of a patch under Linux
It is necessary to have the Mercurial package installed to do this.
- Download the sources from the GeeXboX Mercurial repository (see This article).
- Make sure you have the lastest version of the repository:
hg pull hg update
- Set your id (this step needed only once), by creating a file $HOME/.hgrc with the following contents:
[ui] username=Firstname Lastname <your@mail.address>
- Make the desired modifications.
- If you added files, open a console, go to the directory where the sources are located and run the following command for each file :
hg add added_file
- Lastly, open a console, go to the directory where the sources are located and run the following commands:
hg commit -m "Text that describes what is accomplished with the patch" hg export tip > patch.diff
Submit the patch to the developers
In order for the developers to integrate your patch in the next version of GeeXboX, you must post the file patch.diff (with a description of what is does) to the mailing list Geexbox-Devel (see Site).

