Improving <setenv>

Mark Ellis mark.uzumati at virgin.net
Wed Mar 20 02:24:36 PST 2002


On 2002.03.19 16:57 Neven Has wrote:
> On Tue, Mar 19, 2002 at 02:21:35PM +0000, Mark Ellis wrote:
> > >     <setenv variable1="value1" variable2="value2">
> > >         <!-- Whatever needs variables set. -->
> > >     </setenv>
> >
> > I kinda like the idea, but foresee a few problems. Firstly, you
> could
> > never validate this through a DTD, ever, unless you had a DTD with
> all
> > the variables you could ever want as attributes.
> 
> Hm, true. Well, not so much because of DTD validation, it's probably
> not a very good thing in general for attribute _names_ to be just
> about anything.
> 
> > On an aesthetic note,
> > do we want more "nesting" elements than we already have ?
> 
> I agree that we have a lot of those already, but to me, for something
> like
> <setenv>, nesting seems like the only solution.
> It feels somehow natural too. :)
> 
> > As an alternative to another nesting element, we could put env
> settings
> > on the current nesting elements, maybe, probably makes little
> > difference.
> 
> The same as with <su> and "user" (as I said in another mail), I think
> that doing that would limit us a lot. If we ever start wanting to use
> this for some elements outside <package> or <chroot> or some other
> nesting element, we wouldn't be able to.
> 

No, you're right, it could get a bit limiting. Ok, how about a general 
parent element, can't think of a name at the moment, that encapsulates 
environment variable setting, effective user and group, and anything 
else we think we need later. Might be a bit tidier. This element would 
of course only change the environment for the items that were specified.

This still leaves the next problem...

> > As to the validation problem, the only thing that springs
> > to mind is to have one "env" attribute that contained a string of
> > 'variable=value' s, separated by something you are certain will not
> > appear in the strings themselves.
> 
> It's an option, but IMHO not very nice.
> 
> Something "in the spirit of XML" ;) would probably be:
> 
> <setenv>
>     <variables>
>         <variable>CPPFLAGS</variable>
>         <value>-Dre_max_failures=re_max_failures2</value>
>     </variables>
> 
>     <body>
>         <configure/> <!-- Whatever... -->
>     </body>
> </setenv>
> 
> but I'm afraid to even suggest that, since it's introducing yet
> another depth level.
> 
> And the above without <variable> and <body> would have the same
> problem
> we're trying to avoid with <package> now, by putting <name> and
> <version>
> under <info>.
> 
> And if we only remove <body>, we would again stay with "naked"
> elements. :)
> 

Not ideal is it. I guess this one goes in the 'to think on' tray then.

> > Would this then clear the environment space and put only these in,
> or
> > add
> > them to the current space ?
> 
> There is <setenv mode="append"> implemented in nALFS from few versions
> ago.
> That seems like a good solution, if I'm understanding you correctly?
> 

Sounds perfect.

Mark
-- 
Unsubscribe: send email to listar at linuxfromscratch.org
and put 'unsubscribe alfs-discuss' in the subject header of the message



More information about the alfs-discuss mailing list