[wpkg-users] [Bug 260] Feature Request - WPKG to automatically create variables
bugzilla-daemon at bugzilla.wpkg.org
bugzilla-daemon at bugzilla.wpkg.org
Tue May 8 14:33:15 CEST 2012
http://bugzilla.wpkg.org/show_bug.cgi?id=260
--- Comment #5 from Rainer Meier <r.meier at wpkg.org> ---
OK, I am back with one additional response.
In fact I did not want to force-close the issue without re-thinking about a
proper solution. So there was one more potential improvement coming to my mind
which might satisfy all requirements.
I thought if we would have the possibility to define WPKG-wide variables
directly in wpkg.xml it would perfectly allow to evaluate global variables
within WPKGs own logic without even having to modify WPKG and hard-code some
variables.
So I did implement exactly this. Now WPKG 1.3.1-RC11 allows to define variables
globally in config.xml. It even allows some program logic (conditional
variables) to be applied. Therefore it provides quite a flexible way of doing
exactly what you have asked for.
In addition it will not break any existing installation since by default
config.xml does not come with globally-defined variables.
This implementation would also allow one to define the SOFTWARE variable or any
other global variable which is traditionally defined by WPKG-client before
wpkg.js is invoked. Thus effectively removing the requirement to write a
wrapper scripts. At least as long as the conditional-variable possibilities of
WPKG are sufficient to handle the variable evaluation.
Change notes:
NEW: Added possibility to specify variables in config.xml. All variables
defined in config.xml are WPKG-wide and globally defined during WPKG
execution. However these variables might be overwritten by host-,
profile- or package variables.
Configuration variables are an alternative way to specify global
environment variables in central location when not using a WPKG wrapper
script or WPKG-client or any other WPKG launcher with capabilities to
define global environment variables before wpkg.js is launched.
Variables are also allowed to use conditional expressions and therefore
allow variable evaluation based on system parameters like architecture,
file existence etc.
Example:
<config>
<variables>
<variable name="PROG_FILES32" value="%ProgramFiles%"
architecture="x86" />
<variable name="PROG_FILES32" value="%ProgramFiles(x86)%"
architecture="x64" />
</variables>
</config>
The example above defines the PROG_FILES32 environment variable to point
to the 32-bit program installation folder on 64-bit and 32-bit Windows.
Example:
<config>
<variables>
<variable name="DESKTOP" value="%ALLUSERSPROFILE%\Desktop"
os="windows xp" />
<variable name="DESKTOP" value="%PUBLIC%\Desktop"
os="Windows 7" />
</variables>
</config>
The example above defines a variable named DESKTOP which points to the
location of the public desktop. Therefore accessing %DESKTOP% in packages
will point to the right location on either Windows XP or 7.
This is supposed to support an enhancement request reported in Bug 260.
Thanks to Peter Hoeg for reporting.
I have also checked in an updated wpkg.xml which includes some example
variables. The XSD files for config.xml have been updated as well in terms of
new nodes and documentation.
As usual you can get the updated code from SVN:
<http://wpkg.svn.sourceforge.net/viewvc/wpkg/wpkg/stable/src/main/resources/wpkg/>
--
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