[Oval-commits] r68 - trunk/tools/oval/definition
Pavel Vinogradov
blaze-guest at alioth.debian.org
Tue Jul 10 18:57:18 UTC 2007
Author: blaze-guest
Date: 2007-07-10 18:57:18 +0000 (Tue, 10 Jul 2007)
New Revision: 68
Modified:
trunk/tools/oval/definition/generator.py
Log:
Fix errors in generated, which observed by cheching result with xsd schema.
Modified: trunk/tools/oval/definition/generator.py
===================================================================
--- trunk/tools/oval/definition/generator.py 2007-07-10 18:17:02 UTC (rev 67)
+++ trunk/tools/oval/definition/generator.py 2007-07-10 18:57:18 UTC (rev 68)
@@ -189,10 +189,10 @@
# Handle architecture independed section
if data.has_key ("all"):
- archIndepCriteria = __createXMLElement ("criteria", attrs={"comment" : "Architecture independet section", "operation" : "AND"})
+ archIndepCriteria = __createXMLElement ("criteria", attrs={"comment" : "Architecture independet section", "operator" : "AND"})
archIndepCriteria.appendChild ( __createXMLElement ("criterion", attrs = {"test_ref" : __createTest("arch", "all"), "comment" : "all architecture"}))
- packageCriteria = __createXMLElement ("criteria", attrs={"comment" : "Packages section", "operation" : "OR"})
+ packageCriteria = __createXMLElement ("criteria", attrs={"comment" : "Packages section", "operator" : "OR"})
for pkg in data["all"].keys():
packageCriteria.appendChild ( __createXMLElement ("criterion", attrs = {"test_ref" : __createDPKGTest(pkg, data["all"][pkg][0]), "comment" : "%s DPKG is earlier than %s" % (pkg, data["all"][pkg][0])}))
@@ -220,14 +220,14 @@
# Generate XML for optimized packages
if (len(eq)):
if len(diff.getArchs()) != releaseArchHash[release]:
- archDependCriteria = __createXMLElement ("criteria", attrs={"comment" : "Architecture depended section", "operation" : "AND"})
+ archDependCriteria = __createXMLElement ("criteria", attrs={"comment" : "Architecture depended section", "operator" : "AND"})
- supportedArchCriteria = __createXMLElement ("criteria", attrs={"comment" : "Supported architectures section", "operation" : "OR"})
+ supportedArchCriteria = __createXMLElement ("criteria", attrs={"comment" : "Supported architectures section", "operator" : "OR"})
for arch in diff.getArchs():
supportedArchCriteria.appendChild ( __createXMLElement ("criterion", attrs = {"test_ref" : __createTest("arch", arch), "comment" : "%s architecture" % arch}))
archDependCriteria.appendChild (supportedArchCriteria)
- packageCriteria = __createXMLElement ("criteria", attrs={"comment" : "Packages section", "operation" : "OR"})
+ packageCriteria = __createXMLElement ("criteria", attrs={"comment" : "Packages section", "operator" : "OR"})
for bpkg in eq.keys():
packageCriteria.appendChild ( __createXMLElement ("criterion", attrs = {"test_ref" : __createDPKGTest(bpkg, eq[bpkg]), "comment" : "%s DPKG is earlier than %s" % (bpkg, eq[bpkg])}))
@@ -239,13 +239,13 @@
# Generate XML for all other packages
if len(di):
- archDependCriteria = __createXMLElement ("criteria", attrs={"comment" : "Architecture depended section", "operation" : "AND"})
+ archDependCriteria = __createXMLElement ("criteria", attrs={"comment" : "Architecture depended section", "operator" : "AND"})
for (key, value) in di.iteritems():
- supportedPlatformCriteria = __createXMLElement ("criteria", attrs={"comment" : "Supported platform section", "operation" : "AND"})
+ supportedPlatformCriteria = __createXMLElement ("criteria", attrs={"comment" : "Supported platform section", "operator" : "AND"})
supportedPlatformCriteria.appendChild ( __createXMLElement ("criterion", attrs = {"test_ref" : __createTest("arch", key), "comment" : "%s architecture" % key}))
- packageCriteria = __createXMLElement ("criteria", attrs={"comment" : "Packages section", "operation" : "OR"})
+ packageCriteria = __createXMLElement ("criteria", attrs={"comment" : "Packages section", "operator" : "OR"})
for bpkg in di[key].keys():
packageCriteria.appendChild ( __createXMLElement ("criterion", attrs = {"test_ref" : __createDPKGTest(bpkg, di[key][bpkg]), "comment" : "%s DPKG is earlier than %s" % (bpkg, di[key][bpkg])}))
@@ -281,14 +281,14 @@
# if diffCount == 0:
# # All supported architectures have queuals bpackages
#
-# archDependCriteria = __createXMLElement ("criteria", attrs={"comment" : "Architecture depended section", "operation" : "AND"})
-# supportedArchCriteria = __createXMLElement ("criteria", attrs={"comment" : "Supported architectures section", "operation" : "OR"})
+# archDependCriteria = __createXMLElement ("criteria", attrs={"comment" : "Architecture depended section", "operator" : "AND"})
+# supportedArchCriteria = __createXMLElement ("criteria", attrs={"comment" : "Supported architectures section", "operator" : "OR"})
# for arch in data.keys():
# if arch != "all":
# supportedArchCriteria.appendChild ( __createXMLElement ("criterion", attrs = {"test_ref" : __createTest("arch", arch), "comment" : "%s architecture" % arch}))
# archDependCriteria.appendChild (supportedArchCriteria)
#
-# packageCriteria = __createXMLElement ("criteria", attrs={"comment" : "Packages section", "operation" : "OR"})
+# packageCriteria = __createXMLElement ("criteria", attrs={"comment" : "Packages section", "operator" : "OR"})
#
# for bpkg in data[stdArch].keys():
# packageCriteria.appendChild ( __createXMLElement ("criterion", attrs = {"test_ref" : __createDPKGTest(bpkg, data[stdArch][bpkg]), "comment" : "%s DPKG is earlier than %s" % (bpkg, data[stdArch][bpkg])}))
@@ -331,14 +331,15 @@
doc = xml.dom.minidom.Document ()
### Definition block: Metadata, Notes, Criteria
- definition = __createXMLElement ("definition", attrs = {"id" : "OVAL-DSA-%s" % dsa, "version" : "1", "class" : "vulnerability"})
+ ### TODO: Replace DSA id with unique id
+ definition = __createXMLElement ("definition", attrs = {"id" : "oval:org.debian:def:%s" % dsa, "version" : "1", "class" : "vulnerability"})
### Definition : Metadata : title, affected, reference, description ###
metadata = __createXMLElement ("metadata")
metadata.appendChild (__createXMLElement ("title", dsaref["description"]))
### Definition : Metadata : Affected : platform, product ###
- affected = __createXMLElement ("affected", attrs = {"family" : "debian"})
+ affected = __createXMLElement ("affected", attrs = {"family" : "unix"})
try:
for platform in dsaref["packages"]:
affected.appendChild ( __createXMLElement ("platform", "Debian GNU/Linux %s" % platform))
More information about the Oval-commits
mailing list