env_helper

Rainer Müller raimue at macports.org
Wed Mar 18 11:44:51 PDT 2009


Rainer Müller wrote:
> To address the issues mentioned above and support a little bit more we
> would have to split it into env and profile:
> 
> ${etcdir}/env-avail.d/:
>   apache2
>   mysql5
> ${etcdir}/env.d/:
>   apache2 -> ../env-avail.d/apache2
>   mysql5 -> ../env-avail.d/mysql5
> ${etcdir}/profile-avail.d/:
>   bash-completion
>   trac-tools
> ${etcdir}/profile.d/:
>   trac-tools -> ../profile-avail.d/trac-tools
> 
> (Think of trac-tools making [1] available, as I can't think of another
> existing port right now).
> 
> env.d is meant to contain files in the equal sign separated format which
> are concatenated. Rules for concatenation are The order has yet to be
> defined (possible using 00foo through 99bar in the symlinks?).
> 
> profile.d is meant to contain arbitrary shell scripts registering
> aliases/functions etc.
> 
> And then we would have a `port env` command which operates on these dirs
> and files as follows:
> 
> port env --enable bash-completion
> port env --disable bash-completion
>   Creates/removes a symlink in profile.d pointing to profile-avail.d

What I was proposing here is probably totally wrong. I should have
thought longer about it before proposing ;-)

If I as a user want control, which is what I said as intention for the
text above, this should not be done on the system level. And by
${prefix}/etc we are talking about the system, not individual user
settings. Could probably do something like that symlinking stuff in
$HOME, but it is not appropriate for ${prefix}/etc.

> port env --update
>   Generates or updates ${etcdir}/profile based on the current symlink
>   layout, which is then used by `port env` as traversing all the files
>   each time a shell is spawned is probably a bit slow. Could also
>   generate ${etcdir}/profile.csh or similar. Needs to be run
>   after --enable/--disable or port installes/upgrades to apply changes.
>   Ideally port would check for file modification time of ${etcdir}/*.d/
>   after activation and recommend to run env-update if necessary.
> 
> A user would only need to add this line to his .profile to load MacPorts:
>   [ -f /opt/local/etc/profile ] && source /opt/local/etc/profile

What is left is the caching, I would still prefer that.

Rainer


More information about the macports-dev mailing list