[wpkg-users] Greetings and some questions about wpkg

Rainer Meier r.meier at wpkg.org
Tue Oct 1 21:05:24 CEST 2013


Hi Laurent,

On 01.10.2013 10:32, laurent COOPER wrote:
> I've read this sentence :
> ----
> Normally, hosts are parsed from top to the bottom, except when the hostname is not a regular expression. So the host bronek1 will match profile1, even though it also matches b.+ and bron.+ (which are regular expressions).
> ----
>
> There is a thing I don't understand. When the hosts file is parsed, does the parser use the first match for the host and use its profiles, or does the parser use all matching profiles

I think this is not entirely correct. IF you use name attribute then WPKG first 
tries to do a literal matching. If it matches, then WPKG by default stops the 
matching process and assigns the profile specified in profile-id attribute.
However if the name attribute does not match literally then WPKG will try to use 
the name attribute as a regular expression. So name="broni." will not match 
literally but it will match as a regular expression.


> For example, if I have
> <host name="b.+" profile-id="profile1" />
> <host name="bron.+" profile-id="profile2" />
>
> and the host bronie
>
> will it match the first and use only profile1
> OR
> will it match both and use profile1 AND profile2 ?

By default it matches only profile "profile1" since it's the first one matching. 
However you can change this default by appending the /applymultiple command-line 
argument to wpkg.js or set the applyMultiple parameter in config.xml. If set to 
true then WPKG would in this example continue the matching and finally apply 
profile1 AND profile2 to the hos called bronie.


> Can I have also two entries for the same host ?
> <host name="bronie" profile-id="profile1"/>
> <host name="bronie" profile-id="profile2"/>

I thnink this is techinically allowed. But as said before by default only 
"profile1" will be matched and then WPKG stops profile evaluation.
You can also define profiles which include multiple other profiles.

It's long time I touched this part of the code but you can use this as well I 
believe:

<host name="bronie">
	<profile id="profile1" />
	<profile id="profile2" />
</host>

If in doubt, check the XSD.


> ** About the packages...
>
> I'd rather keep individual packages for my networks. Is there a way to have them in subdirectories
>
> packages / sub1/ ...
> 	/ sub2 / ...
>
> or is it only possible to have one packages directory ?

Only one packages directory - unless you're going to use XSLT to transfor 
packages.xml to include additional files as you wish. I never did this though.

You can also configure completely independent WPKG installation directories 
(with dedicated hosts, profiles and packages) using the /base argument or define 
wpkg_base in config.xml.


br,
Rainer



More information about the wpkg-users mailing list