[wpkg-users] [Bug 262] Wrong variable apply order

bugzilla-daemon at bugzilla.wpkg.org bugzilla-daemon at bugzilla.wpkg.org
Tue Jan 10 10:32:00 CET 2012


http://bugzilla.wpkg.org/show_bug.cgi?id=262

Rainer Meier <r.meier at wpkg.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |r.meier at wpkg.org

--- Comment #1 from Rainer Meier <r.meier at wpkg.org>  ---
The issue is a bit more complex. Initially Brent A Nelson brought up an issue
in WPKG 1.2.0 about variable resolve and recursive substitution.

Actually WPKG 1.2.0 had no clearly defined way of evaluating variables. So in
WPKG 1.2.1-RC27 an improvement on variable resolving was done. The order of
resolving (including support for recursive resolve) was clearly defined.

See the full conversation here:
<http://lists.wpkg.org/pipermail/wpkg-users/2011-October/008096.html>

Here's the change log entry:

Changes 2011-10-20, v1.2.1-RC27 by Rainer Meier <r.meier (at) wpkg.org>
MOD: Changed variable expansion order. Now the order is clearly defined as
     follows:
     - Host variables
     - Profile variables (in reverse order, dependencies first)
     - Package variables
     This way package variables can refer to profile variables.
     Profile variables in turn can refer to host variables.
     Variables can always also include the value of variables already defined
     using the %VARIABLE% syntax in the value attribute of the variable
     definition. So for example a package variable can refer to a profile
     variable. A package variable can also refer to a variable defined within
     the same package as long as the variable it refers to appears before the
     one referring to it.
     Thanks to Brent A Nelson for pointing us to the issue.
     Thanks to Stefan Pendl for analyzing the issue.
MOD: Improved variable reading using caches for host and profile variables.


So to summarize the wiki entry currently seems to be just wrong at time of
writing. For WPKG 1.2.0 variable resolve order was not defined and recursive
substitution did not work.

Now WPKG 1.3.0 clearly defines that first the host variables are read, then the
profile variable and at the end the package variables. This means that in all
cases packages can overwrite variables. I still believe this makes most sense
since packages are the most detailed "leaf"-entity in WPKG. Doing evaluation
the other way around.

If you want to define a variable in a package which can be "overriden" by a
previously evaluated definition (e.g. on host or profile level) then you can
use conditional variables in WPKG 1.3.0 or newer in order to define the
variable only if it has not been defined already.

Potentially the following (untested) might do it on package level:

<variable name="VAR" value="test">
  <condition>
    <check type="host" condition="environment" value="VAR=^%VAR%$" />
  </condition>
</variable>


However it's untested by me. But you get the idea.

-- 
Configure bugmail: http://bugzilla.wpkg.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.



More information about the wpkg-users mailing list