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

From Scribus Wiki
Jump to: navigation, search
(added Testing category)
(Create a patch)
 
(10 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
[[Category:Development]][[Category:FAQ]][[Category:Testing]]
 
[[Category:Development]][[Category:FAQ]][[Category:Testing]]
 +
 +
<big>And also "How to create a wellformed patch for scribus"</big>
  
 
See : http://jungels.net/articles/diff-patch-ten-minutes.html
 
See : http://jungels.net/articles/diff-patch-ten-minutes.html
  
{{Template:Update}}
+
==== Apply a 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
  
== Download Scribus source via svn ==
+
* 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.
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]]
+
* Checkout svn for that specific version, using the -r option
  
== Get patch file ==
+
* Go to your svn source folder and copy the patch file there
From mailing list or bug tracker
 
'''Needs to be expanded'''
 
: Is there a direct way people can download patches beside copy/paste from ML or downloading from Mantis?
 
  
 +
* 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>
  
Or create a patch file out of your modified source, agains svn version :
+
In case this is not OK, try <pre>patch -p0 < thedifffile.patch</pre>
svn diff -x -u -x -w -x -b > nameofyourpatch.patch
 
  
== Apply the patch ==
+
In case this is not OK, have a deeper look in the patch code and choose the better options.
Use the patch command in your console.
 
'''Needs to be expanded'''
 
  
== Compile the source ==
+
==== Create a patch ====
Use QT Creator for code-browsing and compiling
 
'''Needs to be expanded'''
 
=== Linux ===
 
  
=== OS X ===
+
Create a patch file out of your modified source, against svn version :
* [[Macports]]
 
* [[Scribus and Homebrew]]
 
  
=== Windows ===
+
* 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>
  
==Related==
+
For ease of use, your patch file name could mention
* [[Building_SVN_versions_with_CMake]]
+
* 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
  
<hr />
+
Example : footnotes_crash_12345_popol_2015_10_19.diff
  
=TODO=
+
==== Links ====
*Add sub-sections for all major platforms
+
* See [[Building_SVN_versions_with_CMake]]
* Add a.l.e's page on how to patch: https://github.com/aoloe/htdocs-graphicslab-archive/blob/master/ui_iv_iu/pages/Howto.Patch  
+
* how to patch: https://github.com/aoloe/htdocs-graphicslab-archive/blob/master/ui_iv_iu/pages/Howto.Patch  
=== OS X ===
 
 
* Specifying patches in Homebrew formulas (https://github.com/Homebrew/homebrew/wiki/Formula-Cookbook#patches)
 
* 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