The current implementation was purely "code to the goal" and improvements in this area would be welcome. - kvv On Mar 26, 2007, at 2:10 PM, Chris Pickel wrote:
I've been reading through the source for macports, figuring out how it goes about its business, and one particular part struck me as odd--the parsing of conf_files, i.e. ports.conf. The relevant code is at darwinports.tcl, lines 223-233
For each line in a conf file, for each bootstrap option, this code tests if it is of the format (roughly) of "<that_option> <a_setting>", and if so, sets the option. As a result, any line which is not of that format will be silently ignored. So, if the user makes a typo, or an option is deprecated in a later version of MacPorts, there is no message to that effect.
It also seems like the "Tcl way" (insofar as I've learned it in the past few days) would be to sandbox a Tcl interpreter for the purpose of parsing the file. Then, in addition to getting error messages for errors, you could set the prefix and later write "sources_conf ${prefix}/etc/ports/sources.conf", the benefit of which is I think fairly obvious.
Mainly, I am wondering if anyone here knows a reason (other than, at this point, backwards-compatibility) why it is done the way it is. If not, I'm going to have a go tonight at rewriting it in what I hope will be a more sensible manner.
Regards,
Chris Pickel