convience PG for patch updating

René J.V. Bertin rjvbertin at gmail.com
Fri May 23 14:02:14 UTC 2025


Hi,

I thought I'd share a little PortGroup I just wrote that really helps streamlining the process of updating/refreshing/rebasing patchfiles when upgrading a port.

https://github.com/RJVB/macstrop/blob/master/_resources/port1.0/group/patch-updater-1.0.tcl

And all you need to do is include the PG while in the process of addressing that chore, because it hijacks the normal `port patch` phase so is almost completely transparent.

New patchfiles are left in a parallel `filespath` directory that maintains the same hierarchy as the "official" $filespath so once every patchfile has been processed the new directory could just replace the old.

Patches that fail to apply will of course need to be fixed by hand, but the PG includes a feature I've proposed for upstreaming years ago already, where successfully applied patchfiles are registered in the statefile and `port patch` can thus be called repeatedly without failing on already-applied patches.

I have been lazy though; the procedure *could* take a not-yet applied patchfile from the "new" filespath but for now fixes have to be applied to the "official" patchfile.

So after fixing a patchfile `patch-foo.diff` you'd need to do (assuming -p1 patches) :
```
> cd $worksrcpath 
> git add . ;# stage any new files the patch may have created
> git diff > `port dir foo`/files/patch-foo.diff ; # update the patchfile
> patch -Np1 -R -i `port dir foo`/files/patch-foo.diff
> port -no -v patch foo
```

I may update the PG so it will give priority to not-yet-applied patchfiles from the "new" filespath directory, and also make it possible to invoke it as a standalone Tcl script to perform the steps outlined above.
Contributions welcome for that! ;)

R.


More information about the macports-dev mailing list