Make the reinplace warning an error
This changes the warning "reinplace didn't change anything in" to an error. This will force maintainers to fix these issues. This can be bypassed by using the quiet (-q) option. Two tests are added to verify the code.
Closes: https://trac.macports.org/ticket/60844
It's an easy change to the code, certainly, and I do want to make this change, but it's going to break so many ports.
I'd prefer this to be an opt-in option, enabled via a new parameter.
This is similar in spirit to optional "strict" mode, used in some CMake (and/or Configure) scripts.
Just an example of port where reinplace is used to adjust different files. Not all of them contains pattern: https://github.com/macports/macports-ports/blob/master/emulators/xhyve/Portfile#L31-L36
Another example of port which uses reinplace to clean up platform-specified traces to make universal variant: https://github.com/macports/macports-ports/blob/master/devel/icu/Portfile#L98-L116
@kurthindenburg do you see any another way to solve that issues after your patch? Call sed by hand instead of reinplace?
I think this should not be a default option. Totally agree with @mascguy – opt-in is fine.
Just an example of port where
reinplaceis used to adjust different files. Not all of them contains pattern: https://github.com/macports/macports-ports/blob/master/emulators/xhyve/Portfile#L31-L36
Use reinplace's -q flag in this case.
Another example of port which uses
reinplaceto clean up platform-specified traces to make universal variant: https://github.com/macports/macports-ports/blob/master/devel/icu/Portfile#L98-L116
You can use -q here too if there's no better solution. A better solution might be to do the reinplace only if you know it will replace something. I haven't tried to determine if that's workable in that specific situation.
@ryandesign thanks for -q option. It is that I'm looking for.