xref: /haiku/docs/develop/net/HowTo-Synchronize_with_NetBSD.rst (revision 372b901dfeada686207d00bbcce456f748bbda12)
1How to Merge Patches from NetBSD Trunk
2======================================
3
4Using the NetBSD CVS is a pain, so instead, the preferred thing to do is
5to use `the official Git mirror <https://github.com/NetBSD/src>`__. The
6code here is in the tree at a few places:\ ``inet`` is at
7``lib/libc/inet``, irs is scattered across the tree, and ``resolv`` is
8at ``lib/libc/resolv``.
9
10The preferable way to merge is to take the last commit merged from IIJ’s
11mirror (can be found in the merging commit in Haiku, if the merger has
12done their work properly) and check all commits since then to see if
13they apply or not (some apply to documentation we don’t have, etc.)
14Cherry-pick the ones that do, and download them as git-format-patch
15patches (by adding ``.patch`` onto the end of the commit URL).
16
17To convert the patches to have the correct paths to the resolv/inet/etc.
18code, use ``sed``:
19
20::
21
22   sed s%lib/libc/resolv%src/kits/network/netresolv/resolv%g -i *.patch
23
24(You’ll need to use similar commands for the ``inet`` and ``irs`` code.)
25
26Then apply the patches using ``git apply --reject file.patch``. Git will
27spew a lot of errors about files in the patch that aren’t in the tree,
28and then it will warn that some hunks are being rejected. Review the
29rejected hunks **VERY CAREFULLY**, as some code in Haiku’s NetResolv is
30not in NetBSD’s and vice versa, and so some patches may not apply
31cleanly because of that. You might have to resort to merging those hunks
32by hand, if they apply at all to Haiku’s code.
33
34Commit the changes all at once, but list all the commits merged from
35NetBSD in the commit message (see previous merges for the style to
36follow).
37