Skip to content
This repository has been archived by the owner on Oct 2, 2024. It is now read-only.

Commit

Permalink
Additional Core fixes from feedback
Browse files Browse the repository at this point in the history
Change to NotesType fix that removes backwards incompatibility for
5.10.1 or 5.11.0 content using substitution groups. Introduced needed
debian_evr_string simple datatype to distinguish between rpm and dpkg
comparisons.
  • Loading branch information
David Rothenberg committed Mar 30, 2015
1 parent 20ff62c commit 75a2514
Show file tree
Hide file tree
Showing 3 changed files with 115 additions and 16 deletions.
12 changes: 11 additions & 1 deletion schemas/oval-common-schema.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@
<xsd:documentation>The element_mapping element is used in documenting which tests, objects, states, and system characteristic items are associated with each other. It provides a way to explicitly and programatically associate the test, object, state, and item definitions.</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="notes" type="oval:NotesType">
<xsd:annotation>
<xsd:documentation>Element for containing notes; can be replaced using a substitution group.</xsd:documentation>
</xsd:annotation>
</xsd:element>
<!-- =============================================================================== -->
<!-- =============================== GLOBAL TYPES ================================ -->
<!-- =============================================================================== -->
Expand Down Expand Up @@ -177,7 +182,7 @@
<xsd:documentation>The NotesType complex type is a container for one or more note child elements. Each note contains some information about the definition or tests that it references. A note may record an unresolved question about the definition or test or present the reason as to why a particular approach was taken.</xsd:documentation>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="note" type="xsd:string" minOccurs="1" maxOccurs="unbounded"/>
<xsd:element name="note" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<!-- =============================================================================== -->
Expand Down Expand Up @@ -337,6 +342,11 @@
<xsd:documentation>The evr_string datatype represents the epoch, version, and release fields as a single version string. It has the form "EPOCH:VERSION-RELEASE". Comparisons involving this datatype should follow the algorithm of librpm's rpmvercmp() function. Expected operations within OVAL for evr_string values are 'equals', 'not equal', 'greater than', 'greater than or equal', 'less than', and 'less than or equal'.</xsd:documentation>
</xsd:annotation>
</xsd:enumeration>
<xsd:enumeration value="debian_evr_string">
<xsd:annotation>
<xsd:documentation>The debian_evr_string datatype represents the epoch, upstream_version, and debian_revision fields, for a Debian package, as a single version string. It has the form "EPOCH:UPSTREAM_VERSION-DEBIAN_REVISION". Comparisons involving this datatype should follow the algorithm outlined in Chapter 5 of the "Debian Policy Manual" (https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Version). An implementation of this is the cmpversions() function in dpkg's enquiry.c. Expected operations within OVAL for debian_evr_string values are 'equals', 'not equal', 'greater than', 'greater than or equal', 'less than', and 'less than or equal'.</xsd:documentation>
</xsd:annotation>
</xsd:enumeration>
<xsd:enumeration value="fileset_revision">
<xsd:annotation>
<xsd:documentation>The fileset_revision datatype represents the version string related to filesets in HP-UX. An example would be 'A.03.61.00'. For more information, see the HP-UX "Software Distributor Administration Guide" (http://h20000.www2.hp.com/bc/docs/support/SupportManual/c01919399/c01919399.pdf). Expected operations within OVAL for fileset_version values are 'equals', 'not equal', 'greater than', 'greater than or equal', 'less than', and 'less than or equal'.</xsd:documentation>
Expand Down
83 changes: 69 additions & 14 deletions schemas/oval-definitions-schema.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,32 @@
<xsd:field xpath="."/>
</xsd:keyref>
</xsd:element>
<xsd:element name="notes" substitutionGroup="oval:notes">
<xsd:annotation>
<xsd:documentation>The notes element is a container for one or more note child elements. It exists for backwards-compatibility purposes, for the pre-5.11.0 oval-def:NotesType, which has been replaced by the oval:notes element in 5.11.1.</xsd:documentation>
<xsd:appinfo>
<oval:deprecated_info>
<oval:version>5.11.1</oval:version>
<oval:reason>Replaced by the oval:notes element.</oval:reason>
<oval:comment>This object has been deprecated and may be removed in a future version of the language.</oval:comment>
</oval:deprecated_info>
<sch:pattern id="oval_def_notes_dep">
<sch:rule context="oval-def:notes">
<sch:report test="true()">DEPRECATED ELEMENT: <sch:value-of select="name()"/> parent ID: <sch:value-of select="../@id"/></sch:report>
</sch:rule>
</sch:pattern>
</xsd:appinfo>
</xsd:annotation>
<xsd:complexType>
<xsd:complexContent>
<xsd:extension base="oval:NotesType">
<xsd:sequence>
<xsd:element name="note" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>
<!-- =============================================================================== -->
<!-- ================================= GENERATOR ================================= -->
<!-- =============================================================================== -->
Expand Down Expand Up @@ -199,7 +225,7 @@
<xsd:field xpath="@family"/>
</xsd:unique>
</xsd:element>
<xsd:element name="notes" type="oval-def:NotesType" minOccurs="0" maxOccurs="1"/>
<xsd:element ref="oval:notes" minOccurs="0" maxOccurs="1"/>
<xsd:element name="criteria" type="oval-def:CriteriaType" minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
<xsd:attribute name="id" type="oval:DefinitionIDPattern" use="required"/>
Expand Down Expand Up @@ -263,14 +289,6 @@
<xsd:attribute name="ref_id" type="xsd:string" use="required"/>
<xsd:attribute name="ref_url" type="xsd:anyURI" use="optional"/>
</xsd:complexType>
<xsd:complexType name="NotesType">
<xsd:annotation>
<xsd:documentation>The NotesType complex type is a container for one or more note child elements. Each note contains some information about the definition or tests that it references. A note may record an unresolved question about the definition or test or present the reason as to why a particular approach was taken.</xsd:documentation>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="note" type="xsd:string" minOccurs="1" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="CriteriaType">
<xsd:annotation>
<xsd:documentation>The CriteriaType complex type describes a container for a set of sub criteria, criteria, criterion, or extend_definition elements allowing complex logical trees to be constructed. Each referenced test is represented by a criterion element. Please refer to the description of the CriterionType for more information about and individual criterion element. The optional extend_definition element allows existing definitions to be included in the criteria. Refer to the description of the ExtendDefinitionType for more information.</xsd:documentation>
Expand Down Expand Up @@ -343,7 +361,7 @@
</xsd:annotation>
<xsd:sequence>
<xsd:element ref="ds:Signature" minOccurs="0" maxOccurs="1"/>
<xsd:element name="notes" type="oval-def:NotesType" minOccurs="0" maxOccurs="1"/>
<xsd:element ref="oval:notes" minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
<xsd:attribute name="id" type="oval:TestIDPattern" use="required"/>
<xsd:attribute name="version" type="xsd:nonNegativeInteger" use="required"/>
Expand Down Expand Up @@ -390,7 +408,7 @@
</xsd:annotation>
<xsd:sequence>
<xsd:element ref="ds:Signature" minOccurs="0" maxOccurs="1"/>
<xsd:element name="notes" type="oval-def:NotesType" minOccurs="0" maxOccurs="1"/>
<xsd:element ref="oval:notes" minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
<xsd:attribute name="id" type="oval:ObjectIDPattern" use="required"/>
<xsd:attribute name="version" type="xsd:nonNegativeInteger" use="required"/>
Expand Down Expand Up @@ -467,7 +485,7 @@
</xsd:annotation>
<xsd:sequence>
<xsd:element ref="ds:Signature" minOccurs="0" maxOccurs="1"/>
<xsd:element name="notes" type="oval-def:NotesType" minOccurs="0" maxOccurs="1"/>
<xsd:element ref="oval:notes" minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
<xsd:attribute name="id" type="oval:StateIDPattern" use="required"/>
<xsd:attribute name="version" type="xsd:nonNegativeInteger" use="required"/>
Expand Down Expand Up @@ -512,7 +530,7 @@
</xsd:annotation>
<xsd:sequence>
<xsd:element ref="ds:Signature" minOccurs="0" maxOccurs="1"/>
<xsd:element name="notes" type="oval-def:NotesType" minOccurs="0" maxOccurs="1"/>
<xsd:element ref="oval:notes" minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
<xsd:attribute name="id" type="oval:VariableIDPattern" use="required"/>
<xsd:attribute name="version" type="xsd:nonNegativeInteger" use="required"/>
Expand Down Expand Up @@ -1163,6 +1181,9 @@
<sch:assert test="not(@operation) or @operation='equals' or @operation='not equal' or @operation='greater than' or @operation='greater than or equal' or @operation='less than' or @operation='less than or equal'"><sch:value-of select="../@id"/> - The use of '<sch:value-of select="@operation"/>' for the operation attribute of the <sch:value-of select="name()"/> entity is not valid given a datatype of evr_string.</sch:assert>
<!--<sch:assert test="matches(., '^[^:\-]*:[^:\-]*-[^:\-]*$')"><sch:value-of select="../@id"/> - A value of '<sch:value-of select="."/>' for the <sch:value-of select="name()"/> entity is not valid given a datatype of evr_string.</sch:assert>-->
</sch:rule>
<sch:rule context="oval-def:objects/*/*[@datatype='debian_evr_string']|oval-def:objects/*/*/*[@datatype='debian_evr_string']|oval-def:states/*/*[@datatype='debian_evr_string']|oval-def:states/*/*/*[@datatype='debian_evr_string']">
<sch:assert test="not(@operation) or @operation='equals' or @operation='not equal' or @operation='greater than' or @operation='greater than or equal' or @operation='less than' or @operation='less than or equal'"><sch:value-of select="../@id"/> - The use of '<sch:value-of select="@operation"/>' for the operation attribute of the <sch:value-of select="name()"/> entity is not valid given a datatype of debian_evr_string.</sch:assert>
</sch:rule>
<sch:rule context="oval-def:objects/*/*[@datatype='fileset_revision']|oval-def:objects/*/*/*[@datatype='fileset_revision']|oval-def:states/*/*[@datatype='fileset_revision']|oval-def:states/*/*/*[@datatype='fileset_revision']">
<sch:assert test="not(@operation) or @operation='equals' or @operation='not equal' or @operation='greater than' or @operation='greater than or equal' or @operation='less than' or @operation='less than or equal'"><sch:value-of select="../@id"/> - The use of '<sch:value-of select="@operation"/>' for the operation attribute of the <sch:value-of select="name()"/> entity is not valid given a datatype of fileset_revision.</sch:assert>
</sch:rule>
Expand Down Expand Up @@ -1570,7 +1591,7 @@
</xsd:complexType>
<xsd:complexType name="EntityStateEVRStringType">
<xsd:annotation>
<xsd:documentation>The EntityStateEVRStringType type is extended by the entities of an individual OVAL State. This type provides uniformity to each state entity by including the attributes found in the EntityStateSimpleBaseType. This type represents the epoch, version, and release fields as a single version string. It has the form "EPOCH:VERSION-RELEASE". Note that a null epoch (or '(none)' as returned by rpm) is equivalent to '0' and would hence have the form 0:VERSION-RELEASE. Comparisons involving this datatype should follow the algorithm of librpm's rpmvercmp() function.</xsd:documentation>
<xsd:documentation>The EntityStateEVRStringType type is extended by the entities of an individual OVAL State. This type provides uniformity to each state entity by including the attributes found in the EntityStateSimpleBaseType. This type represents the epoch, version, and release fields, for an RPM package, as a single version string. It has the form "EPOCH:VERSION-RELEASE". Note that a null epoch (or '(none)' as returned by rpm) is equivalent to '0' and would hence have the form 0:VERSION-RELEASE. Comparisons involving this datatype should follow the algorithm of librpm's rpmvercmp() function.</xsd:documentation>
</xsd:annotation>
<xsd:simpleContent>
<xsd:restriction base="oval-def:EntityStateSimpleBaseType">
Expand All @@ -1582,6 +1603,40 @@
</xsd:restriction>
</xsd:simpleContent>
</xsd:complexType>
<xsd:complexType name="EntityStateDebianEVRStringType">
<xsd:annotation>
<xsd:documentation>The EntityStateDebianEVRStringType type is extended by the entities of an individual OVAL State. This type provides uniformity to each state entity by including the attributes found in the EntityStateSimpleBaseType. This type represents the epoch, upstream_version, and debian_revision fields, for a Debian package, as a single version string. It has the form "EPOCH:UPSTREAM_VERSION-DEBIAN_REVISION". Note that a null epoch (or '(none)' as returned by dpkg) is equivalent to '0' and would hence have the form 0:UPSTREAM_VERSION-DEBIAN_REVISION. Comparisons involving this datatype should follow the algorithm outlined in Chapter 5 of the "Debian Policy Manual" (https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Version). An implementation of this is the cmpversions() function in dpkg's enquiry.c.</xsd:documentation>
</xsd:annotation>
<xsd:simpleContent>
<xsd:restriction base="oval-def:EntityStateSimpleBaseType">
<xsd:simpleType>
<xsd:restriction base="xsd:string"/>
<!-- TODO: Should there be a pattern restriction here to enforce the pattern mentioned above? -->
</xsd:simpleType>
<xsd:attribute name="datatype" type="oval:SimpleDatatypeEnumeration" use="required" fixed="debian_evr_string"/>
</xsd:restriction>
</xsd:simpleContent>
</xsd:complexType>
<xsd:complexType name="EntityStateDebianRPMEVRStringType">
<xsd:annotation>
<xsd:documentation>The EntityStateDebianRPMEVRStringType type is extended by the entities of an individual OVAL State. This type provides uniformity to each object entity by including the attributes found in the EntityStateSimpleBaseType. This specific type describes the EVR string value for any Debian or RPM package.</xsd:documentation>
</xsd:annotation>
<xsd:simpleContent>
<xsd:restriction base="oval-def:EntityStateSimpleBaseType">
<xsd:simpleType>
<xsd:restriction base="xsd:string"/>
</xsd:simpleType>
<xsd:attribute name="datatype" use="required">
<xsd:simpleType>
<xsd:restriction base="oval:SimpleDatatypeEnumeration">
<xsd:enumeration value="evr_string"/>
<xsd:enumeration value="debian_evr_string"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
</xsd:restriction>
</xsd:simpleContent>
</xsd:complexType>
<xsd:complexType name="EntityStateVersionType">
<xsd:annotation>
<xsd:documentation>The EntityStateVersionType type is extended by the entities of an individual OVAL State. This type provides uniformity to each state entity by including the attributes found in the EntityStateSimpleBaseType. This specific type describes simple version data.</xsd:documentation>
Expand Down
Loading

0 comments on commit 75a2514

Please sign in to comment.