Bernd Eggink wrote:
On 18.10.2015 17:20, Willy Goiffon wrote:
Hi everyone,
I had an idea to make software patching easier, and lower the need to fork ports.
Sometimes, I just fork some port from contrib because I want to add a patch (eg: thttpd), or I need to modify a file before actually compiling the software (eg: config.h on contrib/st).
I figured out that by adding a single variable to `/etc/pkgmk.conf`, it would be easier to "tweak" sofwares by patching them beforehand:
``` /etc/pkgmk.conf [...] PKGMK_PATCH_DIR=/usr/patch
And then, have ports include something like:
``` /usr/port/contrib/example/PKgfile [...] cd $name-$version cat $PKGMK_PATCH_DIR/$name/*.diff | patch -Np1 make make DESTDIR=$PKG PREFIX=/usr MANDIR=/usr/man install
So if I need a patch for thttpd, I'll just add it to `/usr/patch/thttpd`. To have the `st` port configured with my `config.h`, I'll just create a patch for it in `/usr/patch/st`.
But you still would have to maintain an additional source (your patches) - whenever the original port changes, a patch may become obsolete, not applicable, or plainly wrong. I never include ports from contrib directly, but copy them into my own repository, update the version (most of them are outdated), adjust the Pkgfile to my needs, make patches etc. This has the advantage that everything that belongs to the port is concentrated in a single directory.
Sure you'd have to maintain the patches yourself, but you'd have to do it too in case of a fork. If you want to keep everything local to the port directory, you could just set PKGMK_PATCH_DIR=./patch In pkgmk.conf, and have everything stored along with the port itself. I think it's a non-intrusive way of allowing port customisation to every user without decreasing the quality or simplicity of existing ports. It is also easy to understand on first read, so new users would be able to get the hang of it really quickly.