Bug #605 -- Conditional execution

Alex Potter spambin at apcuk.dyndns.org
Sat Jan 31 20:58:15 PST 2004


On Sat, 31 Jan 2004 17:04:22 -0700, Kevin P. Fleming thusly spake in
<401C4286.1010309 at linuxfromscratch.org>:

> Gerard Beekmans wrote:
> 
>> So, my question to you guys is: what will it take to get this feature
>> implemented? I can justify spending work hours on this, to a certain
>> degree, so I'm perfectly willing to help out implementing it. However,
>> my coding skills aren't up to snuff with what you'd expect to see
>> quality wise, so I'm not sure I could pull it off properly.
> 
> OK, I have begun working on this, I'm about 30% of the way there. I have 
> some issues for the group, though:
> 
> - was <if>/<then>/<else> support added in DTD 3.1 or 3.0? I am adding it 
> to nALFS and allowing it be used to match the 3.1 DTD (even though James 
> as already removed it from the 3.1 syntax document), but I need to know 
> if it was in the 3.0 DTD as well.
> 
> - I'm not keen on the <if> syntax at all... it seems cumbersome and will 
> be hard to extend in the future. For DTD 3.2, I'd like to propose the 
> following:
> 
> <if>
>    <test>0/1/true/false/yes/no</test>
>    <and>
>      <or>
>        <test>"shell test function expression"</test>
>        <package-built>package-name</package-built>
>      </or>
>      <package-version condition="eq">3.1.2</package-version>
>    </and>
>    <then>
>      ...
>    </then>
>    <else>
>      ...
>    </else>
> </if>
> 
> Well, the logic there is bogus, but you see the point: add <and>/<or> 
> elements to construct boolean logic (multiple conditions inside <if> 
> would be implicitly <and>ed) and provide 
> <test>/<package-built>/<package-version> tests. This allows for future 
> extensibility, is easier syntax to use and can be used for more complex 
> tests than the existing syntax.
> 
> Thoughts?

Do you mean something like
if <test> then
	pass_action
else
	fail_action
endif

where <test> =[ [not]"shell test function expression" ]
       [[&& or || [not]]<package-built>package-name</package-built>]
       [[&& or || [not] ] <package-version condition="[eq | ge |le]">
		3.1.2</package-version>]

and actions may include further if statements or any legal code for the
element that encloses the outermost if.

Sorry that my xml isn't up to proper notation for the above.

I think your "implicit AND" may well prove to be a PITA.....
-- 
Alex Potter

The email address above is a spamtrap.
Please reply to alexp -at- apcuk -dot- dyndns -dot- org




More information about the alfs-discuss mailing list