313 ports still use ui_msg
ryandesign at macports.org
Fri Dec 17 01:34:42 PST 2010
On Dec 16, 2010, at 15:52, Jeremy Lavergne wrote:
>> What are we supposed to use?
> Notes allows you to view the message anytime and during install phase.
> ui_msg works only when ui_msg gets run in the portfile.
Which is why ui_msg is not deprecated, there are no plans to remove it from MacPorts base, and not every instance of ui_msg in every port should be replaced with notes.
A problem I have with notes, for example, is that it feels like I have less control than I have with ui_msg. Take the minivmac port for example. It requires the user to generate a particular file in a particular location, in order to build and run the software. The user might want to see this by typing "port notes minivmac", but it can't only be in the notes, since notes only display during the activate phase, and the user needs that information before the build has even started. Also, a user who has already generated that file probably doesn't want to keep being told about it every time they upgrade the port. This is currently handled nicely with ui_msg statements in a conditional checking if the file exists.
Consider mysql5. It prints a message using ui_msg advising the user they might want to install mysql5-server, but only if the user hasn't already done so; if they have, they probably don't want to keep hearing about it.
Several ports, such as whois, explain to the user where the configuration file is expected to be, and where the sample configuration file is that the user can copy; if the user already made a configuration file, they don't want to be bothered about that anymore, so it's in a conditional.
I'm not sure how best to handle these situations using notes. The best I've thought of is to define the notes normally, then in pre-activate, clear the notes if the user has already dealt with what they tell the user to do. That way "port notes" still works, but the notes don't get shown to the user every time they upgrade. But I haven't tested this strategy in practice.
More information about the macports-dev