Porting Practice

Vidar Karlsen vidar at karlsen.tech
Sun Jul 5 08:18:20 UTC 2020


> On 5 Jul 2020, at 02:46, Brandon helsley <brandon.helsley at hotmail.com> wrote:

[…]

> The documentation for (diff -u) says "To create a suitable diff for a single patch, copy the file that needs patching to something.orig, save the changes to something and then create the patch:"
> % diff -u something.orig something > something.diff
> 
> Im not sure really the meaning of this documentation. What file needs patching, which file to copy, where to save changes to exactly, and how and why the svn method is different. Which method should I choose? I know it says that unified diff and svn are preffered but since I am new maybe the (diff -u) command would be easier to begin with? Please help and include anything that's relevant even if i didn't mention it. I'm really excited to get started and will absorb like a sponge any know how that's offered!!!

For making changes to a port, I find ’svn diff’ to be the easiest way by far. I tend to do this:
1. svn up my work-in-progress ports tree
2. Make the changes and run tests (portlint, poudriere testport etc)
3. cd /ports; svn diff thecategory/theport > /portpatches/thecategory_theport_version.diff (change the paths to the dirs of your choice)
4. Upload the .diff file to Bugzilla

Since I use svn in step 1, svn takes care of tracking the changes so I don’t need to keep .orig files and run diff by hand.

The diffing that Jonathan mentioned is more applicable if you have to make changes to the upstream code itself in order for it to work on FreeBSD. I personally do that in the port’s ‘work’ dir and create the patches with ‘make makepatch’, and there I need to create .orig files (cp file.c file.c.orig before making changes).


Hope this helps,
Vidar Karlsen


More information about the freebsd-ports mailing list