patch instead of reinplace?

Ryan Schmidt ryandesign at macports.org
Sat Sep 27 10:08:17 PDT 2014


On Sep 27, 2014, at 11:06 AM, Brandon Allbery wrote:
> On Sat, Sep 27, 2014 at 11:59 AM, Kurt Hindenburg wrote:
>> Hi,  I find reinplace easier and less work for new releases.  Are there reasons to use one over the other?
> 
> reinplace is appropriate for replacing self-contained "tokens" and such. When the context of an edit is important, reinplace handles context very poorly, while patch is designed to handle it and fail if the context can't be rationalized (e.g. by detecting that something moved but is otherwise the same).

Normally, if you're making a change that doesn't involve a MacPorts variable, you'll use a patchfile. If you're making a change that does involve a MacPorts variable, you'll use a patchfile to insert a placeholder (e.g. "@PREFIX@"), then use a reinplace to change the placeholder to its real value.

Remember from https://trac.macports.org/ticket/15514 that if a reinplace fails, there's currently no notice. This can mean that old bugs which were fixed with a reinplace can resurface if a port is updated and the reinplace is not adjusted. With a patch, this can't happen, since if the patch fails to apply, the build will stop with an error.

Patches provide context to the reader to let them know what's being changed. This makes it easier to see how the patch needs to be changed if a new version of the code changes things.

Patches are easy to send to upstream developers.



More information about the macports-dev mailing list