env_helper

Jeremy Huddleston jeremyhu at macports.org
Sun Mar 15 19:21:27 PDT 2009


I think this is a bit too many files lying around.  Why have separate  
directories/files for each environment variable.  It seems cleaner to  
me to have:

${etcdir}/paths.d contain a set of files (one file per port).  These  
files are newline-delimited in the form:
ENVIRONMENT_VARIABLE=VALUE

so you would have:

${etcdir}/paths.d/mysql contain:
PATH=/opt/local/lib/mysql5/bin

${etcdir}/paths.d/perl5 contain:
MANPATH=/opt/local/share/p5/man

It would be nice to actually have this be backwards compatible with  
path_helper, so if ${etcdir}/paths.d/myapp contained:
/opt/local/lib/some/bin

it would default to assume an implicit PATH=.  Similarly, it could  
support ${etcdir}/manpaths.d with an implicit MANPATH

I thought about that last year, but I never got around to doing  
anything about it ;)

On Mar 15, 2009, at 15:25, Bradley Giesbrecht wrote:

> I'm thinking I like this.
>
> I just added paths for ${PREFIX}/apach2/bin and ${PREFIX}/lib/mysql5/ 
> bin to /opt/local/etc/env_helper/paths/PATH/(apache2 & mysql5).
>
> So port apache2 and mysql5 could add /opt/local/etc/env_helper/paths/ 
> PATH/apache2 and /opt/local/etc/env_helper/paths/PATH/mysql5 during  
> install and with the one line added to .profile you pick up their  
> bin dirs.
>
> I've done the same for MANPATH where I installed p5 man pages to / 
> opt/local/share/p5/man. The p5 module man pages show up first, then  
> the port perl5.8 base modules and then the apple perl5.8 man pages.
>
> This can probably be done better but I do think this adds value with  
> little cost.
>
> //Brad
>
> On Mar 15, 2009, at 2:26 PM, Bradley Giesbrecht wrote:
>
>>
>> On Mar 15, 2009, at 1:28 PM, Bradley Giesbrecht wrote:
>>
>>> I have modeled an env setup script after the one apple supplies  
>>> at /usr/libexec/path_helper which is evaluated by /etc/profile.
>>>
>>> My idea is to add a line like this at the top of ones .profile file.
>>> eval `/opt/local/libexec/env_helper`
>>>
>>> I don't know if this list allows file attachments so if the tar  
>>> file is not attached I will upload it somewhere and send another  
>>> email with a link.
>>> If I should open a trac ticket someone tell me to and I will.
>>>
>>> I was thinking this might be a nice way to allow ports to modify  
>>> the users env in a managed fashion. They can drop their env files  
>>> in the proper place and they will be automatically added to the  
>>> users env.
>>>
>>> Also, since the files would be registered to the port if the port  
>>> is deactivated the files can be removed.
>>>
>>> I was thinking of making this as a port (env_helper or  
>>> macports_env) that other ports could use or if people thought it  
>>> useful adding it directly to macports.
>>>
>>> I started with just path vars and only bash at this point but  
>>> looking at /usr/libexc/path_helper it shouldn't be difficult to  
>>> add support for other shells.
>>>
>>> I'm simply naming the files the same as the env var and looping  
>>> over the directory.
>>>
>>>
>>> //Brad
>>
>> I modified /opt/local/libexec/env_helper to evaluate the paths so $ 
>> {PREFIX} can be used in the conf files. This would not NEED to be  
>> done because any installer could create the path properly but it  
>> does remove that necessary step.
>>
>> //Brad
>
> _______________________________________________
> macports-dev mailing list
> macports-dev at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macports-dev



More information about the macports-dev mailing list