diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..0d20b6487c61e7d1bde93acf4a14b7a89083a16d --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.pyc diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000000000000000000000000000000000000..ec97a48ebf1ba3caec169e93bc3b0309af6bb442 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,8 @@ +image: "ubuntu:18.04" + +before_script: + - apt-get update && apt-get install -y python3-nose python3-lxml python3-yaml + +tests: + script: + - nosetests3 -w tests/ diff --git a/packages/diffmerge.xml b/packages/diffmerge.xml new file mode 100755 index 0000000000000000000000000000000000000000..1a647be70218864a8d4b8cbf916fb63359ea1d27 --- /dev/null +++ b/packages/diffmerge.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<packages:packages xmlns:packages="http://www.wpkg.org/packages"> + + <package id="diffmerge" name="DiffMerge English" revision="%version%.1" reboot="false" priority="72"> + <variable name="version" value="4.2.0.697" /> + + <check type="uninstall" condition="exists" path="SourceGear DiffMerge %version%.stable (x64)" /> + + <install cmd='msiexec /l* %WPKGLOGDIR%\diffmerge-%version%.log /qn /i "%WPKGSOFTWARE%\diffmerge\DiffMerge_%version%.stable_x64.msi"' /> + <install cmd='cmd /c del /q "%Public%\Desktop\DiffMerge.lnk"' > + <exit code="any" /> + </install> + + <upgrade include="remove" /> + <upgrade include="install" /> + + <remove cmd='msiexec /qn /x {F6BEC317-F689-4158-B1F0-F229B794CFBA}' > + <!-- 1605 - already removed --> + <exit code="1605" /> + </remove> + + </package> + + </packages:packages> diff --git a/packages/djvu_desktop.xml b/packages/djvu_desktop.xml new file mode 100755 index 0000000000000000000000000000000000000000..daa3a965f3daa792e7cd6a286f804ef1e54104c0 --- /dev/null +++ b/packages/djvu_desktop.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<packages:packages xmlns:packages="http://www.wpkg.org/packages"> + + <package id="djvu_desktop" name="DjVu desktop" revision="%version%.1" reboot="false" priority="91"> + <variable name="version" value="2.1" /> + <check type="uninstall" condition="exists" path="WinDjView %version%" /> + + <install cmd='cmd /c "%WPKGSOFTWARE%\djvu\WinDjView-%version%-Setup.exe" /S' /> + + <upgrade include="remove" /> + <upgrade include="install" /> + + <remove cmd='cmd /c %WPKGSOFTWARE%\wpkg\tools\waitforprocess.cmd Au_.exe' /> + <remove cmd='"%PROGRAMFILES%\WinDjView\uninstall.exe" /S' /> + <remove cmd='cmd /c %WPKGSOFTWARE%\wpkg\tools\waitforprocess.cmd Au_.exe' /> + + </package> + +</packages:packages> diff --git a/tests/config.yml b/tests/config.yml new file mode 100644 index 0000000000000000000000000000000000000000..887008bfbd54434d5f8ca283e37c369169f34c3a --- /dev/null +++ b/tests/config.yml @@ -0,0 +1,46 @@ +--- +package_dir: ../packages + +package_glob: ../packages/*.xml + +# tests_to_skip is a dict of lists. The key is the name +# of a test to skip, and then with with a value which is +# the list of filenames for which the test should not +# be run. The filename should be relative to package_dir +# +# Example: suppose you want to skip the test test_example +# for files 7zip.xml and winscp.xml in package_dir +# +# tests_to_skip: +# test_example: +# - 7zip.xml +# - winscp.xml + +variable_names_to_skip: + openssh_srv.xml: + - wpkgwininfo + +# This should be a suitable subset of the default env vars +# expected in the ucam_wpkg repo. +repo_var_names: + - WPKGSOFTWARE + - WPKGINSTITUTION + - WPKGSHAREBASE + - WPKGLOGDIR + +# default environment variables that Windows defines +win_var_names: + - programfiles(x86) + - programfiles + - programdata + - allusersprofile + - comspec + - computername + - windir + - systemdrive + - programfileswpkg + - temp + - systemroot + - public + - arch + diff --git a/tests/test_var_names.py b/tests/test_var_names.py new file mode 100644 index 0000000000000000000000000000000000000000..c1c085053d94fc4b65606267c6a904d0e2ee65f3 --- /dev/null +++ b/tests/test_var_names.py @@ -0,0 +1,38 @@ +import glob +import os +import re +import lxml, lxml.etree +from util import * + +config = Config().config +xmllist = XMLList(config) + +default_var_names = config['repo_var_names'] + config['win_var_names'] + +variable_re = re.compile('%(.*?)%') + +def test_var_names(): + for file_name in xmllist.getfiles('test_var_names'): + with open(file_name, 'r') as file: + data = file.read().replace('\n', '') + + lc_vars = [x.lower() for x in variable_re.findall(data)] + doc = lxml.etree.parse(file_name) + pkg_vars = doc.xpath('//variable') + allowed_pkg_vars = [x.get('name') for x in pkg_vars] + + skipped_pkg_vars = config.get('variable_names_to_skip').get(os.path.basename(file_name), []) + + for var in set(lc_vars): + yield var_name_is_valid, file_name, var + yield var_name_is_allowed, var, default_var_names + allowed_pkg_vars + skipped_pkg_vars, file_name + +def var_name_is_valid(filename, varname): + # NB there are very few restrictions on var names imposed by Windows. + # But for sanity, we restrict ourselves to what we consider to be a + # "sensible" subset + valid_name_re = re.compile('^[a-z0-9()_-]*$') + assert valid_name_re.match(varname) + +def var_name_is_allowed(varname, allowed_vars, file_name): + assert varname in [x.lower() for x in allowed_vars] diff --git a/tests/test_xml_validates.py b/tests/test_xml_validates.py new file mode 100644 index 0000000000000000000000000000000000000000..c92b86bf772a1e70313eac3b29788c21539434f4 --- /dev/null +++ b/tests/test_xml_validates.py @@ -0,0 +1,13 @@ +import glob +from util import * + +xmllist = XMLList(Config().config) + +validator = XSDValidator('../xsd/packages.xsd') + +def test_xsd(): + for file_name in xmllist.getfiles('test_xsd'): + yield check_file, file_name + +def check_file(file_name): + assert validator.validate(file_name) diff --git a/tests/util.py b/tests/util.py new file mode 100644 index 0000000000000000000000000000000000000000..a9a16a5a147b1c5fd5694ad19640ac04f52bedcd --- /dev/null +++ b/tests/util.py @@ -0,0 +1,49 @@ +from lxml import etree +from lxml.etree import DocumentInvalid +import lxml +import glob +import os +import yaml + +# import pprint +# pp = pprint.PrettyPrinter(indent=2) + +class XSDValidator: + + def __init__(self, xsd_path): + xmlschema_doc = etree.parse(xsd_path) + self.xmlschema = etree.XMLSchema(xmlschema_doc) + + def validate(self, xml_path): + xml_doc = etree.parse(xml_path) + try: + self.xmlschema.assertValid(xml_doc) + except lxml.etree.DocumentInvalid: + print("Validation error(s):") + for error in self.xmlschema.error_log: + print(" Line {}: {}".format(error.line, error.message)) + return self.xmlschema.validate(xml_doc) + + +class XMLList: + + def __init__(self, config): + self.config = config + self.files = set(glob.glob(self.config['package_glob'])) + + def getfiles(self, testname): + if 'tests_to_skip' in self.config.keys() and testname in self.config['tests_to_skip'].keys(): + files_to_skip = { os.path.join(self.config['package_dir'], x) for x in self.config['tests_to_skip'][testname] or []} + return self.files - files_to_skip + else: + return self.files + +class Config: + + def __init__(self): + with open('config.yml', 'r') as conffile: + self.defaults = {} + self.defaults['variable_names_to_skip'] = {} + + config = yaml.load(conffile) + self.config = {**self.defaults, **config} diff --git a/xsd/config.xsd b/xsd/config.xsd new file mode 100644 index 0000000000000000000000000000000000000000..9c96a3eb7c0bbf64c4abd6beaf8b5dbad7098065 --- /dev/null +++ b/xsd/config.xsd @@ -0,0 +1,90 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xsd:schema targetNamespace="http://www.wpkg.org/config" elementFormDefault="qualified" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.wpkg.org/config"> + + <xsd:complexType name="config"> + <xsd:sequence minOccurs="1" maxOccurs="1"> + <xsd:sequence minOccurs="0" maxOccurs="1"> + <xsd:element name="languages" type="languages"></xsd:element> + </xsd:sequence> + <xsd:choice minOccurs="0" maxOccurs="unbounded"> + <xsd:element name="param" type="xsd:string"></xsd:element> + </xsd:choice> + </xsd:sequence> + </xsd:complexType> + + <xsd:complexType name="param"> + <xsd:annotation> + <xsd:documentation>Configuration parameter entry. Defines a configuration parameter of WPKG.</xsd:documentation> + </xsd:annotation> + <xsd:sequence></xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required"> + <xsd:annotation> + <xsd:documentation>Name of the configuration parameter.</xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="value" type="xsd:string" use="required"> + <xsd:annotation> + <xsd:documentation>Value to be assigned to the configuration parameter.</xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:complexType> + + <xsd:complexType name="languages"> + <xsd:annotation> + <xsd:documentation>Holds language definitions such as language-specific strings.</xsd:documentation> + </xsd:annotation> + <xsd:choice minOccurs="0" maxOccurs="unbounded"> + <xsd:element name="language" type="language"></xsd:element> + </xsd:choice> + </xsd:complexType> + + <xsd:complexType name="language"> + <xsd:annotation> + <xsd:documentation>Language holds a concrete language specification defining message strings.</xsd:documentation> + </xsd:annotation> + <xsd:choice minOccurs="0" maxOccurs="unbounded"> + <xsd:element name="string" type="string"></xsd:element> + </xsd:choice> + <xsd:attribute name="lcid"> + <xsd:annotation> + <xsd:documentation> + Comma-separated list of LCID values for which this language specification is valid. For example + specify "409,809" to match English locale. For a complete list of LCIDs see + http://www.microsoft.com/globaldev/reference/lcid-all.mspx. + </xsd:documentation> + </xsd:annotation> + <xsd:simpleType> + <xsd:restriction base="xsd:string"> + <xsd:pattern value="[\w]+(,[\w]+)*"></xsd:pattern> + </xsd:restriction> + </xsd:simpleType> + </xsd:attribute> + </xsd:complexType> + + <xsd:complexType name="string" mixed="true"> + <xsd:annotation> + <xsd:documentation>Localized string definition.</xsd:documentation> + </xsd:annotation> + <xsd:attribute name="id"> + <xsd:annotation> + <xsd:documentation> + Identifier for language string. Identifies the string you are going to localize. + </xsd:documentation> + </xsd:annotation> + <xsd:simpleType> + <xsd:restriction base="xsd:string"> + <xsd:enumeration value="notifyUserStart"></xsd:enumeration> + <xsd:enumeration value="notifyUserStop"></xsd:enumeration> + <xsd:enumeration value="notifyUserFail"></xsd:enumeration> + <xsd:enumeration value="notifyUserReboot"></xsd:enumeration> + </xsd:restriction> + </xsd:simpleType> + </xsd:attribute> + </xsd:complexType> + + <xsd:element name="config" type="config"> + <xsd:annotation> + <xsd:documentation>Root element of WPKG configuration.</xsd:documentation> + </xsd:annotation></xsd:element> +</xsd:schema> \ No newline at end of file diff --git a/xsd/hosts.xsd b/xsd/hosts.xsd new file mode 100644 index 0000000000000000000000000000000000000000..0980de91eda712dce6854592f856808087829055 --- /dev/null +++ b/xsd/hosts.xsd @@ -0,0 +1,92 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xsd:schema targetNamespace="http://www.wpkg.org/hosts" + elementFormDefault="unqualified" xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns="http://www.wpkg.org/hosts" xmlns:wpkg="http://www.wpkg.org/wpkg"> + + <xsd:import namespace="http://www.wpkg.org/wpkg" schemaLocation="wpkg.xsd"> + <xsd:annotation> + <xsd:documentation>Include WPKG master definition. + </xsd:documentation> + </xsd:annotation> + </xsd:import> + + <xsd:element name="wpkg" type="wpkg"> + <xsd:annotation> + <xsd:documentation>Root element for host definitions. + </xsd:documentation> + </xsd:annotation> + </xsd:element> + + <xsd:complexType name="wpkg"> + <xsd:sequence minOccurs="1" maxOccurs="unbounded"> + <xsd:element name="host" type="host"></xsd:element> + </xsd:sequence> + </xsd:complexType> + + <xsd:complexType name="host"> + <xsd:sequence maxOccurs="1" minOccurs="0"> + <xsd:sequence maxOccurs="1" minOccurs="0"> + <xsd:element name="condition" type="wpkg:condition"> + <xsd:annotation> + <xsd:documentation>Define condition under which this host entry is applied.</xsd:documentation> + </xsd:annotation></xsd:element> + </xsd:sequence> + <xsd:choice maxOccurs="unbounded" minOccurs="0"> + <xsd:element name="variable" type="wpkg:variable"> + <xsd:annotation> + <xsd:documentation>Define an environment variable to be set when the host entry applies.</xsd:documentation> + </xsd:annotation></xsd:element> + <xsd:element name="profile" type="profileReference"> + <xsd:annotation> + <xsd:documentation>Define profile which should be applied to matching host.</xsd:documentation> + </xsd:annotation></xsd:element> + </xsd:choice> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="optional"> + <xsd:annotation> + <xsd:documentation>Hostname specification. It might contain regular expressions as well as well +as IP-address ranges. + +Direct match: This is tried first always. If the hostname matches exactly the +value of 'name' this host node is applied to the machine. + +IP-Ranges: format has to be specified as follows: +start[-end].start[-end].start[-end].start[-end] examples: 192.168.1.1 +192.168.1.1-254 192.168.1-5.20-50 + +Regular expressions: example: "test-.*" will match all machines where the +hostname is starting with "test-" string. + +If no name attribute exists then the host entry will always match. You can +omit the name attribute and use extended attribute matching like hostname +(which matches the host name only, but not IP), ipaddresses, domainname etc. +</xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="profile-id" type="xsd:string" + use="optional"> + <xsd:annotation> + <xsd:documentation>Main profile. You can specify the applying profile as separate "profile" nodes +as well but if there is only one single profile it is recommended to use the +profile-id attribute. +</xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attributeGroup ref="wpkg:HostMatch"></xsd:attributeGroup> + </xsd:complexType> + + <xsd:complexType name="profileReference"> + <xsd:sequence maxOccurs="1" minOccurs="0"> + <xsd:element name="condition" type="wpkg:condition"></xsd:element> + </xsd:sequence> + <xsd:attribute name="id" type="xsd:string" use="required"> + <xsd:annotation> + <xsd:documentation> + ID referencing to the profile defined in + profiles.xml + </xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attributeGroup ref="wpkg:HostMatch"></xsd:attributeGroup> + </xsd:complexType> +</xsd:schema> \ No newline at end of file diff --git a/xsd/packages.xsd b/xsd/packages.xsd new file mode 100644 index 0000000000000000000000000000000000000000..a292778d09f5ea4adc4e3e9dcaa301e47c7feb72 --- /dev/null +++ b/xsd/packages.xsd @@ -0,0 +1,794 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xsd:schema targetNamespace="http://www.wpkg.org/packages" + elementFormDefault="unqualified" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns="http://www.wpkg.org/packages" + xmlns:wpkg="http://www.wpkg.org/wpkg"> + + <xsd:import namespace="http://www.wpkg.org/wpkg" schemaLocation="wpkg.xsd"> + <xsd:annotation> + <xsd:documentation> + Include WPKG master definition. + </xsd:documentation> + </xsd:annotation> + </xsd:import> + + <xsd:element name="packages" type="packages"></xsd:element> + + <xsd:complexType name="packages"> + <xsd:annotation> + <xsd:documentation> + Specifies how the packages element is built up (list of + package elements). + </xsd:documentation> + </xsd:annotation> + <xsd:sequence minOccurs="0" maxOccurs="unbounded"> + <xsd:element name="package" type="package"></xsd:element> + </xsd:sequence> + </xsd:complexType> + + <xsd:complexType name="package"> + <xsd:annotation> + <xsd:documentation> + Specifies how the package element is build up (list of + checks, commands and downloads). + </xsd:documentation> + </xsd:annotation> + <xsd:choice maxOccurs="unbounded" minOccurs="0"> + <xsd:element name="variable" type="wpkg:variable"> + <xsd:annotation> + <xsd:documentation> + Define an environment variable which is valid + during package execution. Variables can be used + within other variables, commands and checks. + </xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="check" type="wpkg:check"> + <xsd:annotation> + <xsd:documentation> + Define checks which are used to verify whether a + package has been applied properly to the target + system. + </xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="commands" type="commands"> + <xsd:annotation> + <xsd:documentation> + Define a list of commands to be executed for + installation/upgrade/downgrade/remove. + </xsd:documentation> + </xsd:annotation> + </xsd:element> + + <xsd:element name="install" type="command"> + <xsd:annotation> + <xsd:documentation> + Define a command which is executed during + package installation. + + This is still supported but in the future + commands shall be grouped within the commands + sub-node. Please regard the install node as + deprecated. It might be removed in future WPKG + releases. + </xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="upgrade" type="command"> + <xsd:annotation> + <xsd:documentation> + Define a comamnd which is executed during + package upgrade. + + This is still supported but in the future + commands shall be grouped within the commands + sub-node. Please regard the upgrade node as + deprecated. It might be removed in future WPKG + releases. + </xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="downgrade" type="command"> + <xsd:annotation> + <xsd:documentation> + Define a comamnd which is executed during + package downgrade. + + This is still supported but in the future + commands shall be grouped within the commands + sub-node. Please regard the downgrade node as + deprecated. It might be removed in future WPKG + releases. + </xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="remove" type="command"> + <xsd:annotation> + <xsd:documentation> + Define a command which is executed during + package removal. + + This is still supported but in the future + commands shall be grouped within the commands + sub-node. Please regard the remove node as + deprecated. It might be removed in future WPKG + releases. + </xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="download" type="download"> + <xsd:annotation> + <xsd:documentation> + Specify a list of 'global' downloads. These + downloads will be processes before each package + command (like install, upgrade, downgrade, + remove). + + Please consider this as deprecated. It's + recommended to use the download sub-node of a + command in order to specify downloads. This also + allows one to specify downloads which are not + executed when not needed. + </xsd:documentation> + </xsd:annotation> + </xsd:element> + + <xsd:element name="depends" type="wpkg:packageReference"> + <xsd:annotation> + <xsd:documentation> + Specify a dependency between this and another + package. The package referenced is a + pre-requirement to install this package. + </xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="include" type="wpkg:packageReference"> + <xsd:annotation> + <xsd:documentation> + Specify that this package includes another + package into the package tree. Note that this is + different from a dependency in the sense that + the package included does not need to be + installed BEFORE this package is applied. + + A package which is included is just added to the + tree in the same way as it would when it's + applied to the profile. It will be executed in + order of priority. + + Please consider specifying a dependency rather + than an include whenever possible. + </xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="chain" type="wpkg:packageReference"> + <xsd:annotation> + <xsd:documentation> + Specify a package which is installed/verified + right after applying this package. + </xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:choice> + <xsd:attribute name="id" type="xsd:string" use="required"> + <xsd:annotation> + <xsd:documentation> + Package identification. Needs to be a unique ID + among all the packages. The package ID is + case-sensitive unless the /ignoreCase switch is + passed to wpkg.js. + + Example: + + 'pidgin' + </xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="name" type="xsd:string" use="required"> + <xsd:annotation> + <xsd:documentation> + Descriptive name of the package. e.g. 'Pidgin + multi-protocol instant messenger' + </xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="revision" type="xsd:string" + use="optional"> + <xsd:annotation> + <xsd:documentation> + Revision of the package. + + WPKG allows to specify a versions in quite flexible + format. It is important to know how versions are + compared in order to know whether WPKG needs to + perform an upgrade or a downgrade. + + Here are some notes about version comparison: + + Some version number contain appendices to the + version string indicating 'volatile' versions like + 'pre releases'. For example some packages use + versions like '1.0RC1' or '1.0alpha2'. Usually a + version like '1.0RC1' would be considered to be + newer than '1.0' by the algorithm but in case of + 'RC' versions this would be wrong. To handle such + cases a number of strings are defined in order to + define such volatile releases. + + The list of prefixes is defined in the global + volatileReleaseMarker array. + + Valid comparisons include: A B Result '1' '2' B is + newer '1' '15' B is newer '1.0' '1.2.b' B is newer + '1.35' '1.35-2' B is newer '1.35-2' '1.36' B is + newer '1.35R3' '1.36' B is newer '1' '1.0.00.0000' + Versions are equal '1' '1.0' Versions are equal + '1.35' '1.35-2' B is newer '1.35-2' '1.35' A is + newer '1.35R3' '1.36R4' B is newer '1.35-2' + '1.35-2.0' Versions are equal '1.35.1' '1.35.1.0' + Versions are equal '1.3RC2' '1.3' B is newer + (special case where A is an 'RC' version) '1.5' + '1.5I3656' A is newer (B is an 'I'/integration + version) '1.5' '1.5M3656' A is newer (B is an + 'M'/milestone version) '1.5' '1.5u3656' B is newer + (B is an update version) + + This attribute is optional. Defaults to 0. + </xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="priority" type="xsd:int" use="optional"> + <xsd:annotation> + <xsd:documentation> + Package priority. Packages with higher priorities + are installed first. Optional. Defaults to 0. + </xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="reboot" use="optional"> + <xsd:annotation> + <xsd:documentation> + Specify if a reboot should be initiated after + package installation. Valid values: + + true: reboot immediately after package actions have + been executed. + + false: do not reboot after executing commands. + + postponed: reboot after all packages have been + installed (not after this one but schedule reboot to + WPKG termination). + </xsd:documentation> + </xsd:annotation> + <xsd:simpleType> + <xsd:restriction base="xsd:string"> + <xsd:enumeration value="true"></xsd:enumeration> + <xsd:enumeration value="false"></xsd:enumeration> + <xsd:enumeration value="postponed"></xsd:enumeration> + </xsd:restriction> + </xsd:simpleType> + </xsd:attribute> + <xsd:attribute name="execute" use="optional"> + <xsd:annotation> + <xsd:documentation> + Specify how the package should be executed: + + always: Execute on each synchronization - regardless + of the current install state or the result of any + defined checks. + + changed: Execute on each synchronization but only if + there are other changes done to the system. + + once: Execute only once. No checks will be executed + on following synchronization requests unless the + package version on the server side is changed. + </xsd:documentation> + </xsd:annotation> + <xsd:simpleType> + <xsd:restriction base="xsd:string"> + <xsd:enumeration value="default"></xsd:enumeration> + <xsd:enumeration value="once"></xsd:enumeration> + <xsd:enumeration value="always"></xsd:enumeration> + <xsd:enumeration value="changed"></xsd:enumeration> + </xsd:restriction> + </xsd:simpleType> + </xsd:attribute> + <xsd:attribute name="notify" type="xsd:boolean" + use="optional"> + <xsd:annotation> + <xsd:documentation> + Specify if the user should be notified about the + installation of packages due to this package. + </xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="precheck-install"> + <xsd:annotation> + <xsd:documentation> + Defines how package checks are used during package + installation. + + Currently supported values: + + always (default): When a package is new to the host + then first the checks are run in order to verify + whether the package is already installed. If the + checks succeed then it is assumed that no further + installation is needed. The package is silently + added to the host without executing any commands. + + never: When a package is new to the host then the + install commands are run in any case (without doing + checks first). Note: Checks will still be done after + package installation to verify whether installation + was successful. + </xsd:documentation> + </xsd:annotation> + <xsd:simpleType> + <xsd:restriction base="xsd:string"> + <xsd:enumeration value="always"></xsd:enumeration> + <xsd:enumeration value="never"></xsd:enumeration> + </xsd:restriction> + </xsd:simpleType> + </xsd:attribute> + <xsd:attribute name="precheck-remove"> + <xsd:annotation> + <xsd:documentation> + Defines how package checks are used during package + removal. + + Currently supported values: + + always: When a package is removed from a host then + the checks will be executed before removal is + processes. If the checks fail this potentially means + that the package has been removed already. In such + case the package remove commands will be skipped. + + never (default): When a package is about to be + removed from the host then WPKG will execute the + remove commands in any case without executing the + checks first. Note: Checks will still be done after + package removal to verify whether the removal was + successful. + </xsd:documentation> + </xsd:annotation> + <xsd:simpleType> + <xsd:restriction base="xsd:string"> + <xsd:enumeration value="always"></xsd:enumeration> + <xsd:enumeration value="never"></xsd:enumeration> + </xsd:restriction> + </xsd:simpleType> + </xsd:attribute> + <xsd:attribute name="precheck-upgrade"> + <xsd:annotation> + <xsd:documentation> + Defines how package checks are used during package + upgrade. + + Currently supported values: + + always: When a package is upgraded the checks + specified will be be executed before the upgrade + takes place. If checks succeed, then the upgrade + will not be performed (WPKG just assumes that the + new version is already applied correctly. Please + note that your checks shall verify a specific + software version and not just a generic check which + is true for all versions. If your checks are true + for the old version too then WPKG would never + perform the upgrade in this mode. + + never (default): When a package is about to be + upgraded then WPKG will execute the upgrade commands + in any case without executing the checks first. This + is the recommended behavior. Note: Checks will still + be done after package upgrade to verify whether the + upgrade was successful. + </xsd:documentation> + </xsd:annotation> + <xsd:simpleType> + <xsd:restriction base="xsd:string"> + <xsd:enumeration value="always"></xsd:enumeration> + <xsd:enumeration value="never"></xsd:enumeration> + </xsd:restriction> + </xsd:simpleType> + </xsd:attribute> + <xsd:attribute name="precheck-downgrade"> + <xsd:annotation> + <xsd:documentation> + Defines how package checks are used during package + downgrade. + + Currently supported values: + + always: When a package is downgraded the checks + specified will be be executed before the downgrade + takes place. If checks succeed, then the downgrade + will not be performed (WPKG just assumes that the + old version is already applied correctly. Please + note that your checks shall verify a specific + software version and not just a generic check which + is true for all versions. If your checks are true + for the new/current version too then WPKG would + never perform the downgrade in this mode. + + never (default): When a package is about to be + downgraded then WPKG will execute the downgrade + commands in any case without executing the checks + first. This is the recommended behavior. Note: + Checks will still be done after package downgrade to + verify whether the downgrade was successful. + </xsd:documentation> + </xsd:annotation> + <xsd:simpleType> + <xsd:restriction base="xsd:string"> + <xsd:enumeration value="always"></xsd:enumeration> + <xsd:enumeration value="never"></xsd:enumeration> + </xsd:restriction> + </xsd:simpleType> + </xsd:attribute> + </xsd:complexType> + + <xsd:complexType name="commands"> + <xsd:sequence minOccurs="1" maxOccurs="unbounded"> + <xsd:element name="command" type="command"> + <xsd:annotation> + <xsd:documentation> + Specify any numer of commands for any type of + command. + </xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:complexType> + + + <xsd:complexType name="commandInstall"> + <xsd:annotation> + <xsd:documentation> + Defines an installation command. + </xsd:documentation> + </xsd:annotation> + <xsd:complexContent> + <xsd:restriction base="command"> + <xsd:attribute name="type" type="xsd:string" + fixed="install" use="required"> + </xsd:attribute> + <xsd:attribute name="cmd" type="xsd:string" + use="required"> + </xsd:attribute> + </xsd:restriction> + </xsd:complexContent> + </xsd:complexType> + + <xsd:complexType name="commandRemove"> + <xsd:annotation> + <xsd:documentation> + Defines a remove command. + </xsd:documentation> + </xsd:annotation> + <xsd:complexContent> + <xsd:restriction base="command"> + <xsd:attribute name="type" type="xsd:string" + fixed="remove"> + </xsd:attribute> + <xsd:attribute name="cmd" type="xsd:string" + use="required"> + </xsd:attribute> + </xsd:restriction> + </xsd:complexContent> + </xsd:complexType> + <xsd:complexType name="commandUpgrade"> + <xsd:annotation> + <xsd:documentation> + Defines an upgrade command. + </xsd:documentation> + </xsd:annotation> + <xsd:complexContent> + <xsd:restriction base="command"> + <xsd:attribute name="type" type="xsd:string" + fixed="upgrade"> + </xsd:attribute> + <xsd:attribute name="cmd" type="xsd:string" + use="required"> + </xsd:attribute> + </xsd:restriction> + </xsd:complexContent> + </xsd:complexType> + <xsd:complexType name="commandDowngrade"> + <xsd:annotation> + <xsd:documentation> + Defines a downgrade command. + </xsd:documentation> + </xsd:annotation> + <xsd:complexContent> + <xsd:restriction base="command"> + <xsd:attribute name="type" type="xsd:string" + fixed="downgrade"> + </xsd:attribute> + <xsd:attribute name="cmd" type="xsd:string" + use="required"> + </xsd:attribute> + </xsd:restriction> + </xsd:complexContent> + </xsd:complexType> + + <xsd:complexType name="command"> + <xsd:annotation> + <xsd:documentation> + Type definition used for all commands (install, upgrade, + downgrade, remove) + </xsd:documentation> + </xsd:annotation> + <xsd:sequence minOccurs="0" maxOccurs="1"> + <xsd:sequence minOccurs="0" maxOccurs="1"> + <xsd:element name="condition" type="wpkg:condition"></xsd:element> + </xsd:sequence> + <xsd:choice minOccurs="0" maxOccurs="unbounded"> + <xsd:element name="exit" type="exit"> + <xsd:annotation> + <xsd:documentation> + Specify exit code handling for this command. + + This allows you to define some exit codes as + successful even if they are non-zero. + </xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="download" type="download"> + <xsd:annotation> + <xsd:documentation> + Specify downloads which are executed only + for this command to be run. + </xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:choice> + </xsd:sequence> + <xsd:attribute name="type" type="xsd:string"> + <xsd:annotation> + <xsd:documentation> + This attribute allows command grouping. All commands + with the same type are executed at the specified + package stage. The following types are supported by + WPKG currently: + + install: Commands of type install are executed + during package installation. + + upgrade: Commands of type upgrade are executed if a + package revision is incremented and therefore the + package is updated to a new version. + + downgrade: Commands of type downgrade are executed + if a package revision is decremented and therefore + the package is downgraded to an older version. + + remove: Commands of type remove are executed when a + package is uninstalled from the system. + + You can also specify any other type identifier here. + WPKG however will not execute these commands + automatically during any package phase. But you can + use these package types in include references. For + example this allows you to define packages of type + 'prepare' and then refer to it by includes by + specifying include='prepare' within another command + node. + + Example: + + <command type='prepare' cmd='do-something' /> + + <command type='prepare' cmd='do-something-else' + /> + + <command type='install' include='prepare' /> + + <command type='install' cmd='install-command' + /> + + <command type='remove' include='prepare' /> + + <command type='remove' cmd='install-command' + /> + + This will include the 'prepare' commands during + installation and during remove. + </xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="include"> + <xsd:annotation> + <xsd:documentation> + Specify to inherit all commands from a specific type + of commands. For example specify 'install' to + include all install commands. The package will be + processed the same way as if the specified type of + commands would be duplicated and inserted exactly + where you specified the include command. + + It is allowed to specify multiple include commands. + + Be careful no to create inclusion loops. For example + including all install commands within the upgrade + node and including the upgrade node within the + install node. + </xsd:documentation> + </xsd:annotation> + <xsd:simpleType> + <xsd:restriction base="xsd:string"> + <xsd:pattern value="install"></xsd:pattern> + <xsd:pattern value="upgrade"></xsd:pattern> + <xsd:pattern value="downgrade"></xsd:pattern> + <xsd:pattern value="remove"></xsd:pattern> + <xsd:pattern value="\w+"></xsd:pattern> + </xsd:restriction> + </xsd:simpleType> + </xsd:attribute> + <xsd:attribute name="cmd" type="xsd:string" use="optional"> + <xsd:annotation> + <xsd:documentation> + Specify the command to be executed in order to + install the application in silent mode. + + Example: + + '%SOFTWARE%\pidgin\pidgin.exe /L=1033 /DS=1 /NOUI'. + + Note that a command is required in order to perform + any action. Although this attribute is optional it + is required for normal commands. Either the include + or the cmd attribute shall be filled. + </xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="timeout" type="xsd:int" use="optional"> + <xsd:annotation> + <xsd:documentation> + Specify timeout for command (in seconds). + + Timeout has no effect on inheritance. + </xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="workdir" type="xsd:string" + use="optional"> + <xsd:annotation> + <xsd:documentation> + Specify working directory in which the command is + executed. + </xsd:documentation> + </xsd:annotation> + </xsd:attribute> + + <xsd:attributeGroup ref="wpkg:HostMatch"></xsd:attributeGroup> + + </xsd:complexType> + + <xsd:complexType name="exit"> + <xsd:annotation> + <xsd:documentation> + Definition for exit code specification. + </xsd:documentation> + </xsd:annotation> + <xsd:attribute name="code" use="required"> + <xsd:annotation> + <xsd:documentation> + Specify integer value which matches the exit code of + the installer. Or specify the string 'any' or '*' to + match any exit code. + </xsd:documentation> + </xsd:annotation> + <xsd:simpleType> + <xsd:restriction base="xsd:string"> + <xsd:pattern value="any"></xsd:pattern> + <xsd:pattern value="-?\d+"></xsd:pattern> + <xsd:pattern value="\*"></xsd:pattern> + </xsd:restriction> + </xsd:simpleType> + </xsd:attribute> + <xsd:attribute name="reboot" use="optional"> + <xsd:annotation> + <xsd:documentation> + Specify this attribute if the exit code should + initiate/shedule any type of reboot. Valid values: + + false: Do not require any reboot. + + true: Reuire immediate reboot after this command. + + delayed: Schedule reboot after execution of all + commands of this package has been finished. + + postponed: Schedule reboot after execution of all + packages (when WPKG terminates). + </xsd:documentation> + </xsd:annotation> + <xsd:simpleType> + <xsd:restriction base="xsd:string"> + <xsd:enumeration value="true"></xsd:enumeration> + <xsd:enumeration value="false"></xsd:enumeration> + <xsd:enumeration value="delayed"></xsd:enumeration> + <xsd:enumeration value="postponed"></xsd:enumeration> + </xsd:restriction> + </xsd:simpleType> + </xsd:attribute> + </xsd:complexType> + + <xsd:complexType name="download"> + <xsd:annotation> + <xsd:documentation> + Specifies how a download node looks like, including all + attributes. + </xsd:documentation> + </xsd:annotation> + <xsd:sequence minOccurs="0"> + <xsd:element name="condition" type="wpkg:condition"></xsd:element> + </xsd:sequence> + + <xsd:attribute name="url" type="xsd:string" use="required"> + <xsd:annotation> + <xsd:documentation> + URL where the file is downloaded: + 'http://server.example.org/path/to/file.exe' + </xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="expandURL" type="xsd:boolean"> + <xsd:annotation> + <xsd:documentation> + Defines whether the url attribute is expanded (ie. + environment variables are replaced). + + Note: As URLs are used to contain some percentage + characters (like '%20' for spaces) these might be + expanded too if the URL matches an environment + variable which is defined. For example downloading + from an URL like + url='http://host/softwareX%20release%20.exe' would + try to expand the environment'20release' as well. + It's very unlikely that this collides with an + environment variable you have actually defined but + keep it in mind when defining download URLs. If you + really need to disable expansion because the URL + collides with existing environment variables then + use the expandURL='false' attribute: + + <download expandURL='false' + url='http://host/softwareX%20release%20.exe' + target='release.exe' /> + </xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="target" type="xsd:string" use="required"> + <xsd:annotation> + <xsd:documentation> + Target path to store the file to. The path has to be + specified relative to the downloadDir property + within config.xml. By default relative to %TEMP%. + For example specify 'pidgin\pidgin.exe' to download + the file at the specified URL to + '%TEMP%\pidgin\pigin.exe'. The file is removed after + the commands are executed. + </xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="timeout" type="xsd:string" + use="optional"> + <xsd:annotation> + <xsd:documentation> + Optional download timeout (specified in seconds). + </xsd:documentation> + </xsd:annotation> + </xsd:attribute> + + <xsd:attributeGroup ref="wpkg:HostMatch"></xsd:attributeGroup> + </xsd:complexType> + +</xsd:schema> diff --git a/xsd/profiles.xsd b/xsd/profiles.xsd new file mode 100644 index 0000000000000000000000000000000000000000..4c381480775acb2f2ab2be0abb86a0b0926b75a4 --- /dev/null +++ b/xsd/profiles.xsd @@ -0,0 +1,84 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xsd:schema targetNamespace="http://www.wpkg.org/profiles" + elementFormDefault="unqualified" xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns="http://www.wpkg.org/profiles" xmlns:wpkg="http://www.wpkg.org/wpkg"> + + <xsd:import namespace="http://www.wpkg.org/wpkg" schemaLocation="wpkg.xsd"> + <xsd:annotation> + <xsd:documentation>Include WPKG master definition.</xsd:documentation> + </xsd:annotation> + </xsd:import> + + <xsd:element name="profiles" type="profiles"> + <xsd:annotation> + <xsd:documentation>Root element for profile definitions. + </xsd:documentation> + </xsd:annotation> + </xsd:element> + + <xsd:complexType name="profiles"> + <xsd:sequence maxOccurs="unbounded" minOccurs="1"> + <xsd:element name="profile" type="profile"></xsd:element> + </xsd:sequence> + </xsd:complexType> + + <xsd:complexType name="profile"> + <xsd:annotation> + <xsd:documentation></xsd:documentation> + </xsd:annotation> + <xsd:choice minOccurs="0" maxOccurs="unbounded"> + <xsd:element name="depends" type="depends"></xsd:element> + <xsd:element name="variable" type="wpkg:variable"></xsd:element> + <xsd:element name="package" type="packageReference"></xsd:element> + </xsd:choice> + <xsd:attribute name="id" type="xsd:string" use="required"> + <xsd:annotation> + <xsd:documentation> +Name of the profile (as referenced within hosts.xml). + </xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:complexType> + + <xsd:complexType name="packageReference"> + <xsd:complexContent> + <xsd:extension base="wpkg:packageReference"> + <xsd:attribute name="installdate" type="xsd:dateTime" + use="optional"> + <xsd:annotation> + <xsd:documentation> +Date from which the package should be installed (this date or later). Date has to +be specified in ISO 8601 format (see http://www.w3.org/TR/NOTE-datetime). + </xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="uninstalldate" type="xsd:dateTime" + use="optional"> + <xsd:annotation> + <xsd:documentation> +Date from which the package should be removed (this date or later). Date has to be +specified in ISO 8601 format (seehttp://www.w3.org/TR/NOTE-datetime). + </xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + + <xsd:complexType name="depends"> + <xsd:sequence minOccurs="0" maxOccurs="1"> + <xsd:element name="condition" type="wpkg:condition"></xsd:element> + </xsd:sequence> + <xsd:attribute name="profile-id" type="xsd:string" + use="required"> + <xsd:annotation> + <xsd:documentation> +ID of the profile which this profile depends on (in +fact it works similar to an include - all packages +from the referenced profile are installed too). + </xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attributeGroup ref="wpkg:HostMatch"></xsd:attributeGroup> + </xsd:complexType> +</xsd:schema> \ No newline at end of file diff --git a/xsd/settings.xsd b/xsd/settings.xsd new file mode 100644 index 0000000000000000000000000000000000000000..9f4c9fb38df10e526d276b7e5c191725b74ddbc9 --- /dev/null +++ b/xsd/settings.xsd @@ -0,0 +1,152 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xsd:schema targetNamespace="http://www.wpkg.org/settings" + elementFormDefault="unqualified" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns="http://www.wpkg.org/settings" + xmlns:packages="http://www.wpkg.org/packages" xmlns:wpkg="http://www.wpkg.org/wpkg"> + + <xsd:import namespace="http://www.wpkg.org/packages" schemaLocation="packages.xsd"> + <xsd:annotation> + <xsd:documentation> + Include WPKG package definition. + </xsd:documentation> + </xsd:annotation> + </xsd:import> + + <xsd:import namespace="http://www.wpkg.org/wpkg" schemaLocation="wpkg.xsd"> + <xsd:annotation> + <xsd:documentation> + Include WPKG generic elements. + </xsd:documentation> + </xsd:annotation> + </xsd:import> + + + <xsd:element name="wpkg" type="wpkg"> + <xsd:annotation> + <xsd:documentation>Root element for local settings database.</xsd:documentation> + </xsd:annotation></xsd:element> + + <xsd:complexType name="wpkg"> + <xsd:annotation> + <xsd:documentation> + Type of loca settings database. Contains all packages + installed on local node. + </xsd:documentation> + </xsd:annotation> + <xsd:choice minOccurs="1" maxOccurs="unbounded"> + <xsd:sequence minOccurs="0" maxOccurs="1"><xsd:element name="checkResults" type="checkResults"> + <xsd:annotation> + <xsd:documentation>List of executed checks and their results.</xsd:documentation> + </xsd:annotation></xsd:element></xsd:sequence> + <xsd:choice minOccurs="0" maxOccurs="unbounded"> + <xsd:annotation> + <xsd:documentation> + References to packages which are installed on + the host. + </xsd:documentation> + </xsd:annotation> + <xsd:element name="package" type="packages:package"> + <xsd:annotation> + <xsd:documentation>Package installed on node.</xsd:documentation> + </xsd:annotation></xsd:element> + </xsd:choice> + </xsd:choice> + <xsd:attribute name="hostname" type="xsd:string"> + <xsd:annotation> + <xsd:documentation> + Name of host where the settings have been generated. + </xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="architecture" type="xsd:string"> + <xsd:annotation> + <xsd:documentation> + Architecture of host where the settings have been + generated. + </xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="os" type="xsd:string"> + <xsd:annotation> + <xsd:documentation> + Operating system on host where the settings have + been generated. + </xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="ipaddresses" type="xsd:string"> + <xsd:annotation> + <xsd:documentation> + List of IP addresses on host where the settings have + been generated. + </xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="domainname" type="xsd:string"> + <xsd:annotation> + <xsd:documentation> + Name of domain on host where the settings have been + generated. + </xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="groups" type="xsd:string"> + <xsd:annotation> + <xsd:documentation> + Name of primary group on host where the settings + have been generated. + </xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="lcid" type="xsd:string"> + <xsd:annotation> + <xsd:documentation> + Locale setting (LCID) of user under which WPKG has + been executed when the settings have been generated. + </xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="lcidOS" type="xsd:string"> + <xsd:annotation> + <xsd:documentation> + Locale setting (LCID) of operating system on which + WPKG has been executed when the settings have been + generated. + </xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:complexType> + + <xsd:complexType name="checkResults"> + <xsd:annotation> + <xsd:documentation>Stores results of checks executed on node. +This can be used on remote host in order to know the evaluated result of a specific check on a remote client. +It might also be useful for debugging to verify the results of specific checks.</xsd:documentation> + </xsd:annotation> + <xsd:choice minOccurs="0" maxOccurs="unbounded"> + <xsd:element name="check" type="check"> + <xsd:annotation> + <xsd:documentation>Refers to a check and stores the check result.</xsd:documentation> + </xsd:annotation></xsd:element> + </xsd:choice> + </xsd:complexType> + + <xsd:complexType name="check"> + <xsd:complexContent> + <xsd:extension base="wpkg:check"> + <xsd:attribute name="result" type="xsd:boolean" + use="required"> + <xsd:annotation> + <xsd:documentation> + The check result is only used to store the + result in local settings database in order + to remember the check result on a remote + system. + </xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> +</xsd:schema> \ No newline at end of file diff --git a/xsd/wpkg.xsd b/xsd/wpkg.xsd new file mode 100644 index 0000000000000000000000000000000000000000..f1facdbf7294434997ad4b6c9bc1c4582b8dab9a --- /dev/null +++ b/xsd/wpkg.xsd @@ -0,0 +1,715 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xsd:schema targetNamespace="http://www.wpkg.org/wpkg" + elementFormDefault="unqualified" xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns="http://www.wpkg.org/wpkg"> + <xsd:annotation> + <xsd:documentation>XML Schema Definition for WPKG packages. The root element (packages) contains all packages. +There might be multiple XML files of this type put to the packages/ sub-directory where WPKG is installed. + </xsd:documentation> + </xsd:annotation> + <xsd:complexType name="check"> + <xsd:annotation> + <xsd:documentation>Generic check definition - used for compatibility. Does not verify correct +combination of attributes for all kind of checks. If you would like to verify +the attributes in more detail please specify the xsi:type='checkFile' +attribute where 'checkFile' can be replaced with any more-specific check type +of check*. + +Valid types include: + +- checkFile +- checkRegistry +- checkExecute +- checkUninstall +- checkLogical</xsd:documentation> + </xsd:annotation> + <xsd:sequence minOccurs="0" maxOccurs="1"> + <xsd:sequence maxOccurs="unbounded" minOccurs="0"> + <xsd:element name="check" type="check"> + <xsd:annotation> + <xsd:documentation>Checks can be nested. Use logical checks to group checks with logical conditions.</xsd:documentation> + </xsd:annotation></xsd:element> + </xsd:sequence> + <xsd:sequence maxOccurs="1" minOccurs="0"> + <xsd:element name="condition" type="condition"> + <xsd:annotation> + <xsd:documentation>Specify a condition under which this check applies. If the condition does not +apply then the check is ignored (exactly as if it would not have been +specifyed at all). + +For example you might add a condition to check for specific OS version. So the +check will only be applied if the OS version matches the condition.</xsd:documentation> + </xsd:annotation></xsd:element> + </xsd:sequence> + </xsd:sequence> + <xsd:attribute name="type" type="xsd:string" use="required"> + <xsd:annotation> + <xsd:documentation>Type of check, valid values are: - file - registry - +uninstall - execute - logical + </xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="condition" use="required" + type="xsd:string"> + <xsd:annotation> + <xsd:documentation>Check condition. Valid values are: +- equals +- exists +- sizeequals +- versionsmallerthan +- versionlessorequal +- versionequalto +- versiongreaterorequal +- versiongreaterthan +- datemodifyequalto +- datemodifynewerthan +- datemodfyolderthan +- datecreateequalto +- datecreatenewerthan +- datecreateolderthan +- dateaccessequalto +- dateaccessnewerthan +- dateaccessolderthan +- exitcodesmallerthan +- exitcodelessorequal +- exitcodeequalto +- exitcodegreaterorequal +- exitcodegreaterthan +- not +- and +- or +- atleast +- atmost + </xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="path" type="xsd:string" use="optional" + default="%SystemRoot%\explorer.exe"> + <xsd:annotation> + <xsd:documentation>Path to be used for checks (registry path, file path). + </xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="value" type="xsd:string" use="optional" + default="1.0"> + <xsd:annotation> + <xsd:documentation>A value is required for some check conditions like +VERSION, SIZE or EQUALS checks. + +Note for registry equals checks: The value should +contain a string representing the data within the +registry value. In case the value is a DWORD just +enter a numeric string. The values will be compared +in their string representation (DWORD converted to +String). In case you compare to a REG_MULTI_SZ value +all data fields will be concatenated to a single +string separated by newline characters. + +Example: +REG_MULTI_SZ='a +b +c' +value='a +b +c' will match. + +REG_BINARY values will be converted to multiline +string as well. Each octett of the binary value is +converted to its decimal representation. +REG_BINARY= '11 22 33 44' +value = '17 34 51 68' will match. +</xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attributeGroup ref="HostMatch"></xsd:attributeGroup> + </xsd:complexType> + <xsd:complexType name="checkFile"> + <xsd:annotation> + <xsd:documentation>Check type for file specific tests. + </xsd:documentation> + </xsd:annotation> + <xsd:complexContent> + <xsd:restriction base="check"> + <xsd:attribute name="type" use="required" fixed="file" type="xsd:string"> + <xsd:annotation> + <xsd:documentation>File checks need to specify 'file' as the TYPE of check. + </xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="condition" use="required"> + <xsd:annotation> + <xsd:documentation>Specify what should be tested on the file specified within the 'path' property. + +- exists: Check for file existence. + +- sizeequals: Check for file size (exact size in Bytes specified within the +'value' attribute. + +- version*: Compare file version to version specified within the 'value' +attribute. + +- date*: Compare file date to date specified within the 'value' attribute. +</xsd:documentation> + </xsd:annotation> + <xsd:simpleType> + <xsd:restriction base="xsd:string"> + <xsd:enumeration value="exists"></xsd:enumeration> + <xsd:enumeration value="sizeequals"></xsd:enumeration> + + <xsd:enumeration + value="versionsmallerthan"> + </xsd:enumeration> + <xsd:enumeration + value="versionlessorequal"> + </xsd:enumeration> + <xsd:enumeration value="versionequalto"></xsd:enumeration> + <xsd:enumeration + value="versiongreaterorequal"> + </xsd:enumeration> + <xsd:enumeration + value="versiongreaterthan"> + </xsd:enumeration> + <xsd:enumeration + value="datemodifyequalto"> + </xsd:enumeration> + <xsd:enumeration + value="datemodifynewerthan"> + </xsd:enumeration> + <xsd:enumeration + value="datemodifyolderthan"> + </xsd:enumeration> + <xsd:enumeration + value="datecreateequalto"> + </xsd:enumeration> + <xsd:enumeration + value="datecreatenewerthan"> + </xsd:enumeration> + <xsd:enumeration + value="datecreateolderthan"> + </xsd:enumeration> + <xsd:enumeration + value="dateaccessequalto"> + </xsd:enumeration> + <xsd:enumeration + value="dateaccessnewerthan"> + </xsd:enumeration> + <xsd:enumeration + value="dateaccessolderthan"> + </xsd:enumeration> + </xsd:restriction> + </xsd:simpleType> + </xsd:attribute> + <xsd:attribute name="path" type="xsd:string" use="required"> + <xsd:annotation> + <xsd:documentation>Path to the file to be checked. You might use +environment variables as well: +'C:\Windows\explorer.exe' +'%TEMP%\somefile.txt' + </xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="value" type="xsd:string" use="optional"> + <xsd:annotation> + <xsd:documentation> +This value is optional only for existence check. For all other checks it it is +required. + +The value should have the following format: + +- for 'exists' condition: +For the 'exists' condition the value attribute is not evaluated. Exists just +checks for existence of the file referred within the 'path' attribute. + +- for 'sizeequals' condition: +The 'value' attribute has to tontain the file size (in bytes). + +- for 'version*' condition: +The value has to contain a version string which can be compared against the file +version. Some examples for valid version comparisons: + +A B Result +'1' '2' B is newer +'1' '15' B is newer +'1.0' '1.2.b' B is newer +'1.35' '1.35-2' B is newer +'1.35-2' '1.36' B is newer +'1.35R3' '1.36' B is newer +'1' '1.0.00.0000' Versions are equal +'1' '1.0' Versions are equal +'1.35' '1.35-2' B is newer +'1.35-2' '1.35' A is newer +'1.35R3' '1.36R4' B is newer +'1.35-2' '1.35-2.0' Versions are equal +'1.35.1' '1.35.1.0' Versions are equal +'1.3RC2' '1.3' B is newer (special case where A is an 'RC' version) +'1.5' '1.5I3656' A is newer (B is an 'I'/integration version) +'1.5' '1.5M3656' A is newer (B is an 'M'/milestone version) +'1.5' '1.5u3656' B is newer (B is an update version) + +- for 'date*' condition: +This value allwos to do comparison to file creation, modification and access +timestamps. +The 'value' attribute has to contain a string in the following format: + +Relative timestamp (in minutes): +-100 Means the file timestamp is compared to the timestamp 100 minutes ago. ++50 Means the file timestamp is compared to the timestamp 50 minutes in + the future. + +Absolute timestamp in ISO 8601 format: +'2007-11-23 22:00' (22:00 local time) +'2007-11-23T22:00' (Both, 'T' and space delimiter are allowed) +'2007-11-23 22:00:00' (specifies seconds which default to 0 above) +'2007-11-23 22:00:00.000' (specifies milliseconds which default to 0) + +It is allowed to specify the timezone as well: +'2007-11-23 22:00+01:00' (22:00 CET) +'2007-11-23 21:00Z' (21:00 UTC/GMT = 22:00 CET) +'2007-11-23 22:00+00:00' (21:00 UTC/GMT = 22:00 CET) + +File-Comparison: +Prefix your value with the '@' character in order to point to a file to which +the timestamp of the file referred in path is compared. +Examples: +@%SystemRoot%\explorer.exe +@c:\myfile.txt + +Special terms: +last-week Check afainst timestamp of exactly one week ago (7 days). +last-month Check afainst timestamp of exactly one month ago (30 days). +last-year Check afainst timestamp of exactly one year ago (365 days). +yesterday Check afainst timestamp of yesterday (24 hours ago). + </xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:restriction> + </xsd:complexContent> + </xsd:complexType> + + <xsd:complexType name="checkRegistry"> + <xsd:annotation> + <xsd:documentation>Use this type to specify a check for registry values. + </xsd:documentation> + </xsd:annotation> + <xsd:complexContent> + <xsd:restriction base="check"> + <xsd:attribute name="type" use="required" fixed="registry" type="xsd:string"> + <xsd:annotation> + <xsd:documentation>Registry checks need to specify 'registry' as the the TYPE of check. + </xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="condition" use="required"> + <xsd:annotation> + <xsd:documentation>exist: Check for existence of the key/value supplied within the 'path' +attribute. + +equals: Check if the specified value contains the data entered within the +'value' attribute. +</xsd:documentation> + </xsd:annotation> + <xsd:simpleType> + <xsd:restriction base="xsd:string"> + <xsd:enumeration value="exists"></xsd:enumeration> + <xsd:enumeration value="equals"></xsd:enumeration> + </xsd:restriction> + </xsd:simpleType> + </xsd:attribute> + <xsd:attribute name="path" type="xsd:string" use="required"> + <xsd:annotation> + <xsd:documentation>Enter registry path to a key which you like to check. Valid examples: +'HKLM\Software' +</xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="value" type="xsd:string" use="optional"> + <xsd:annotation> + <xsd:documentation>Data to check te specified registry value against. NOTE: This attribute is +optional only for registry existence checks. It is REQUIRED if you use equal +checks.</xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:restriction> + </xsd:complexContent> + </xsd:complexType> + <xsd:complexType name="checkUninstall"> + <xsd:annotation> + <xsd:documentation>Use this type to specify a check for uninstall entries +(Control Panel, Add/Remove programs). + </xsd:documentation> + </xsd:annotation> + <xsd:complexContent> + <xsd:restriction base="check"> + <xsd:attribute name="type" fixed="uninstall" use="required" type="xsd:string"> + <xsd:annotation> + <xsd:documentation>Uninstall checks need to specify 'uninstall' as the the TYPE of check. + </xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="condition" use="required"> + <xsd:annotation> + <xsd:documentation>- exist: Check if an uninstall entry equal to the value within the 'value' +attribute exists (see Control Pane, Add/Remove software) + +version*: +Compares the uninstall entry version to the value within the 'value' attribute. + +NOTE: This only works if the application specifies a 'DisplayVersion' value +within the Windows registry. + +Valid values: +- versionsmallerthan +- versionlessorequal +- versionequalto +- versiongreaterorequal +- versiongreaterthan +</xsd:documentation> + </xsd:annotation> + <xsd:simpleType> + <xsd:restriction base="xsd:string"> + <xsd:enumeration value="exists"></xsd:enumeration> + <xsd:enumeration value="versionsmallerthan"> + </xsd:enumeration> + <xsd:enumeration value="versionlessorequal"> + </xsd:enumeration> + <xsd:enumeration value="versionequalto"></xsd:enumeration> + <xsd:enumeration value="versiongreaterorequal"> + </xsd:enumeration> + <xsd:enumeration value="versiongreaterthan"> + </xsd:enumeration> + </xsd:restriction> + </xsd:simpleType> + </xsd:attribute> + <xsd:attribute name="path" type="xsd:string" use="required"> + <xsd:annotation> + <xsd:documentation>Name of the uninstall entry as it appears +within Control Panel, Add/Remove software. + </xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="value" type="xsd:string" use="optional"> + <xsd:annotation> + <xsd:documentation>Specifies a version if any of the version* checks are used.</xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:restriction> + </xsd:complexContent> + </xsd:complexType> + + <xsd:complexType name="checkExecute"> + <xsd:annotation> + <xsd:documentation>Use this type of check to execute a script. Its exit code can be evaluated by rules then.</xsd:documentation> + </xsd:annotation> + <xsd:complexContent> + <xsd:restriction base="check"> + <xsd:attribute name="type" use="required" fixed="execute" type="xsd:string"> + <xsd:annotation> + <xsd:documentation> Execute checks need to specify 'execute' here. + </xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="condition" use="required"> + <xsd:annotation> + <xsd:documentation>Verify the exit code of the script executed. Please specify the exit code to +compare to within the 'value' attribute. Valid values: + +exitcodesmallerthan: true in case the script exit code is numerically less +than the value specified + +exitcodelessorequal: true in case the script exit code is numerically less +or equal than the value specified + +exitcodeequalto: true in case the script exit code is numerically equal to +the value specified + +exitcodegreaterorequal: true in case the script exit code is numerically +greater or equal to the value specified + +exitcodegreaterthan: true in case the script exit code is numerically larger +than the value specified</xsd:documentation> + </xsd:annotation> + <xsd:simpleType> + <xsd:restriction base="xsd:string"> + <xsd:enumeration value="exitcodesmallerthan"> + </xsd:enumeration> + <xsd:enumeration value="exitcodelessorequal"> + </xsd:enumeration> + <xsd:enumeration value="exitcodeequalto"></xsd:enumeration> + <xsd:enumeration value="exitcodegreaterorequal"> + </xsd:enumeration> + <xsd:enumeration value="exitcodegreaterthan"> + </xsd:enumeration> + </xsd:restriction> + </xsd:simpleType> + </xsd:attribute> + <xsd:attribute name="path" type="xsd:string" use="required"> + <xsd:annotation> + <xsd:documentation> + Path to the script to be executed. + </xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="value" type="xsd:string" use="required"> + <xsd:annotation> + <xsd:documentation> + Value used in exit code comparison. + </xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:restriction> + </xsd:complexContent> + </xsd:complexType> + + <xsd:complexType name="checkLogical"> + <xsd:annotation> + <xsd:documentation>Use this check for logical chaining of other checks.</xsd:documentation> + </xsd:annotation> + <xsd:complexContent> + <xsd:restriction base="check"> + + <xsd:attribute name="type" use="required" + fixed="logical" type="xsd:string"> + <xsd:annotation> + <xsd:documentation>Type of check has to be set to 'logical' for logical checks.</xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="condition" use="required"> + <xsd:annotation> + <xsd:documentation>Check condition: + +not: Requires exactly one single sub-element of type 'check' whose exit code +boolean value is inverted. + +and: Returns false immediately if one of the contained checks returns +false. Only evaluates true in case ALL checks contained evaluate true. + +or: Returns true immediately as soon as one of the checks return true. Only +evaluates false if ALL checks contained evaluate false. + +atleast: Returns true only if at least the specified amount of checks +contained return true. For example if you specify 5 checks and the value for +'atleast' is set to 3 then it returns true as soon as 3 checks out of 5 +evaluated true. + +atmost: Returns true if maximum the specified amount of checks return true. +For example if you specify 5 checks and the value for 'atmost' is set to 3 it +will return true only if no more than 3 checks evaluate true.</xsd:documentation> + </xsd:annotation> + <xsd:simpleType> + <xsd:restriction base="xsd:string"> + <xsd:enumeration value="not"></xsd:enumeration> + <xsd:enumeration value="and"></xsd:enumeration> + <xsd:enumeration value="or"></xsd:enumeration> + <xsd:enumeration value="atleast"></xsd:enumeration> + <xsd:enumeration value="atmost"></xsd:enumeration> + </xsd:restriction> + </xsd:simpleType> + </xsd:attribute> + <xsd:attribute name="value" type="xsd:string" + use="optional"> + <xsd:annotation> + <xsd:documentation>Number of checks required for 'atleast' and 'atmost' checks. Unused for all other conditions.</xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:restriction> + </xsd:complexContent> + </xsd:complexType> + + <xsd:complexType name="variable"> + <xsd:sequence maxOccurs="1" minOccurs="0"> + <xsd:element name="condition" type="condition"></xsd:element> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required"> + <xsd:annotation> + <xsd:documentation>Variable name.</xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="value" type="xsd:string" use="required"> + <xsd:annotation> + <xsd:documentation>Variable value.</xsd:documentation> + </xsd:annotation> + </xsd:attribute> + + <xsd:attributeGroup ref="HostMatch"></xsd:attributeGroup> + </xsd:complexType> + + <xsd:complexType name="condition"> + <xsd:sequence minOccurs="1" maxOccurs="unbounded"> + + <xsd:element name="check" type="check"></xsd:element> + </xsd:sequence> + </xsd:complexType> + + <xsd:complexType name="packageReference"> + <xsd:annotation> + <xsd:documentation>Reference to a package.</xsd:documentation> + </xsd:annotation> + + <xsd:sequence maxOccurs="1" minOccurs="0"> + <xsd:element name="condition" type="condition"> + <xsd:annotation> + <xsd:documentation>Specifies a condition under which the package reference is taken into account. +If the condition is not met, then the package reference is ignored.</xsd:documentation> + </xsd:annotation></xsd:element> + </xsd:sequence> + <xsd:attribute name="package-id" type="xsd:string" + use="required"> + <xsd:annotation> + <xsd:documentation>Equal to the ID attribute of any existing package.</xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attributeGroup ref="HostMatch"></xsd:attributeGroup> + </xsd:complexType> + + <xsd:attributeGroup name="HostMatch"> + + <xsd:attribute name="hostname" type="xsd:string"> + <xsd:annotation> + <xsd:documentation>Regular expression which matches host name. +If hostname attribute is specified then this node is only applied if +the host name is matched by the specified attribute regular +expression.</xsd:documentation></xsd:annotation></xsd:attribute> + <xsd:attribute name="os" type="xsd:string"> + <xsd:annotation> + <xsd:documentation>Regular expression which matches host operating +system. e.g. 'microsoft windows 7 professional' Host +OS description string will have the following +format: + +'[OS-caption], [OS-description],[CSD-version], [OS-version]' + </xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="ipaddresses" type="xsd:string"> + <xsd:annotation> + <xsd:documentation>Regular expression matching machine IP address. Any +IP address of the host (if it has multiple) will +have to match this expression. e.g. +^192\.168\.1\..* + </xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="domainname" type="xsd:string"> + <xsd:annotation> + <xsd:documentation>Regular expression matching domain name of the host. +e.g. +^domain$ + </xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="groups" type="xsd:string"> + <xsd:annotation> + <xsd:documentation>Regular expression matching group membership of +host. At least one group has to match the regular +expression. e.g. +^group.*$ + </xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="architecture"> + <xsd:annotation> + <xsd:documentation>Regular expression matching the host architecture. +Currently the following architecture are supported: + +x86: 32-bit Windows operating system running on x86 instruction set + +x64: 64-bit Windows operating system running on x86-64 instruction set + +ia64: 64-bit Windows operating system running on IA64 instruction set + + +Note: Note: You will have to match x86 also if you +run Windows 32-bit on AMD64/EMT64/x64 hardware. + </xsd:documentation> + </xsd:annotation> + <xsd:simpleType> + <xsd:restriction base="xsd:string"> + <xsd:enumeration value="x86"></xsd:enumeration> + <xsd:enumeration value="x64"></xsd:enumeration> + <xsd:enumeration value="ia64"></xsd:enumeration> + </xsd:restriction> + </xsd:simpleType> + </xsd:attribute> + <xsd:attribute name="environment" type="xsd:string"> + <xsd:annotation> + <xsd:documentation>Define environment variables which have to match in +order to match the host. Environment variables need +to be specified in the following format: +environment='variable1=^regexp$|variable2=regexp...' + +Please note that regular expressions are matched +case-insensitive and multiple variables have to be +separated by the pipe ('|') character. Please also +note that in case you use WPKG-client the +system-user environment might differ from the +environment you see when opening a command prompt +and typing 'set'. Some variables might be missing +and others might have different content. So use with +caution.</xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="lcid" type="xsd:string"> + <xsd:annotation> + <xsd:documentation>Comma-separated list of LCID values to be matched +against executing host (LCID seetting of executing +user locale). A full list of LCIDs might be found at: +http://www.microsoft.com/globaldev/reference/lcid-all.mspx + </xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="lcidOS" type="xsd:string"> + <xsd:annotation> + <xsd:documentation>Comma-separated list of LCID values to be matched +against executing host (LCID setting of Windows +install language). A full list of LCIDs might be +found at: +http://www.microsoft.com/globaldev/reference/lcid-all.mspx + </xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:attributeGroup> + + <xsd:complexType name="checkHost"> + <xsd:annotation> + <xsd:documentation> + Use this type to specify a check for host attributes. + </xsd:documentation> + </xsd:annotation> + <xsd:complexContent> + <xsd:restriction base="check"> + <xsd:attribute name="type" type="xsd:string" fixed="host" use="required"> + <xsd:annotation> + <xsd:documentation> + Type of check. Set this tho "host" for host + type checks. + </xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="condition" use="required"> + <xsd:annotation> + <xsd:documentation> + Set condition for host check. + </xsd:documentation> + </xsd:annotation> + <xsd:simpleType> + <xsd:restriction base="xsd:string"> + <xsd:enumeration value="hostname"></xsd:enumeration> + <xsd:enumeration value="architecture"></xsd:enumeration> + <xsd:enumeration value="os"></xsd:enumeration> + <xsd:enumeration value="ipaddresses"></xsd:enumeration> + <xsd:enumeration value="domainname"></xsd:enumeration> + <xsd:enumeration value="groups"></xsd:enumeration> + <xsd:enumeration value="lcid"></xsd:enumeration> + <xsd:enumeration value="lcidOS"></xsd:enumeration> + <xsd:enumeration value="environment"></xsd:enumeration> + </xsd:restriction> + </xsd:simpleType> + </xsd:attribute> + <xsd:attribute name="value" type="xsd:string" use="required"> + <xsd:annotation> + <xsd:documentation>Regular expression to match the condition.</xsd:documentation> + </xsd:annotation></xsd:attribute> + </xsd:restriction> + </xsd:complexContent> + </xsd:complexType> +</xsd:schema> \ No newline at end of file