Difference between revisions of "How to apply a patch to scribus sourcecode"

From Scribus Wiki
Jump to: navigation, search
m (fixed template markup)
(Create a patch)
 
(18 intermediate revisions by 2 users not shown)
Line 1: Line 1:
[[Category:Development]][[Category:FAQ]]
+
[[Category:Development]][[Category:FAQ]][[Category:Testing]]
{{Template:Update}}
 
  
== Download Scribus source via svn ==
+
<big>And also "How to create a wellformed patch for scribus"</big>
Create a SVN repository on your computer (use svn command in a console window to download the right source) 
 
  
See [[Building_SVN_versions_with_CMake]]
+
See : http://jungels.net/articles/diff-patch-ten-minutes.html
  
== Get patch file ==
+
==== Apply a patch ====
From mailing list or bug tracker
 
'''Needs to be expanded'''
 
  
== Apply the patch ==
+
* Get the patch. Usually you get download it off the [http://bugs.scribus.net Scribus bug tracker]. Its extension is usually .diff or .patch
Use the patch command in your console.
 
'''Needs to be expanded'''
 
  
== Compile the source ==
+
* Look for the svn state (version) the patch has been created for. When the bug report doesnt specify this, you can deduce that approximately with the date the patch has been created : find it with dichotomy on [http://scribus.net/websvn/listing.php?repname=Scribus&path=%2Ftrunk%2FScribus%2F websvn]. Knowing this can be required because the patch fits a specified svn state, and might not be ok in a later state. This is particularly important for patches that modify lot of files, or files that change often, or that have been changed recently. In case you dont apply the patch to the corresponding svn state of scribus, you will have to manage conflicts. This is not covered in this how-to.
Use QT Creator for code-browsing and compiling
 
'''Needs to be expanded'''
 
  
==Related==
+
* Checkout svn for that specific version, using the -r option
* [[Building_SVN_versions_with_CMake]]
+
 
 +
* Go to your svn source folder and copy the patch file there
 +
 
 +
* Apply the patch using the patch command.
 +
When the patch file has been correctly prepared with normalized options, the following command should be ok :
 +
<pre>patch -p1 < thepatchfile.patch</pre>
 +
 
 +
In case this is not OK, try <pre>patch -p0 < thedifffile.patch</pre>
 +
 
 +
In case this is not OK, have a deeper look in the patch code and choose the better options.
 +
 
 +
==== Create a patch ====
 +
 
 +
Create a patch file out of your modified source, against svn version :
 +
 
 +
* open a terminal in the 'svn' folder (not in the 'svn/scribus' folder).
 +
* create the patch using 'svn diff' command :
 +
<pre>svn diff -x -u -x -w -x -b > nameofyourpatch.patch</pre>
 +
 
 +
For ease of use, your patch file name could mention
 +
* short description of core patch feature (footnotes_crash, undo_broken...)
 +
* bug number (it will help devs to track all the patches they have to try)
 +
* date submitted
 +
* possibly the name of the author
 +
* extension should be .diff
 +
 
 +
Example : footnotes_crash_12345_popol_2015_10_19.diff
 +
 
 +
==== Links ====
 +
* See [[Building_SVN_versions_with_CMake]]
 +
* how to patch: https://github.com/aoloe/htdocs-graphicslab-archive/blob/master/ui_iv_iu/pages/Howto.Patch
 +
* Specifying patches in Homebrew formulas (https://github.com/Homebrew/homebrew/wiki/Formula-Cookbook#patches)

Latest revision as of 16:13, 22 October 2015


And also "How to create a wellformed patch for scribus"

See : http://jungels.net/articles/diff-patch-ten-minutes.html

Apply a patch

  • Get the patch. Usually you get download it off the Scribus bug tracker. Its extension is usually .diff or .patch
  • Look for the svn state (version) the patch has been created for. When the bug report doesnt specify this, you can deduce that approximately with the date the patch has been created : find it with dichotomy on websvn. Knowing this can be required because the patch fits a specified svn state, and might not be ok in a later state. This is particularly important for patches that modify lot of files, or files that change often, or that have been changed recently. In case you dont apply the patch to the corresponding svn state of scribus, you will have to manage conflicts. This is not covered in this how-to.
  • Checkout svn for that specific version, using the -r option
  • Go to your svn source folder and copy the patch file there
  • Apply the patch using the patch command.

When the patch file has been correctly prepared with normalized options, the following command should be ok :

patch -p1 < thepatchfile.patch
In case this is not OK, try
patch -p0 < thedifffile.patch

In case this is not OK, have a deeper look in the patch code and choose the better options.

Create a patch

Create a patch file out of your modified source, against svn version :

  • open a terminal in the 'svn' folder (not in the 'svn/scribus' folder).
  • create the patch using 'svn diff' command :
svn diff -x -u -x -w -x -b > nameofyourpatch.patch

For ease of use, your patch file name could mention

  • short description of core patch feature (footnotes_crash, undo_broken...)
  • bug number (it will help devs to track all the patches they have to try)
  • date submitted
  • possibly the name of the author
  • extension should be .diff

Example : footnotes_crash_12345_popol_2015_10_19.diff

Links