Parsing of ports.conf
Chris Pickel
chpickel at stwing.upenn.edu
Mon Mar 26 14:10:00 PDT 2007
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: This is a digitally signed message part
Url : http://lists.macosforge.org/pipermail/macports-dev/attachments/20070326/28f794aa/PGP.bin
More information about the macports-dev
mailing list