[Oval-commits] r47 - in trunk/tools: . oval/definition oval/parser
Pavel Vinogradov
blaze-guest at alioth.debian.org
Tue Jun 12 19:25:32 UTC 2007
Author: blaze-guest
Date: 2007-06-12 19:25:32 +0000 (Tue, 12 Jun 2007)
New Revision: 47
Modified:
trunk/tools/TODO
trunk/tools/oval/definition/generator.py
trunk/tools/oval/parser/dsa.py
trunk/tools/oval/parser/wml.py
trunk/tools/parse-dsa-oval.py
Log:
Code cleanup and DSA sort. Support locale.
Modified: trunk/tools/TODO
===================================================================
--- trunk/tools/TODO 2007-06-12 17:59:58 UTC (rev 46)
+++ trunk/tools/TODO 2007-06-12 19:25:32 UTC (rev 47)
@@ -1,9 +1,6 @@
General:
Full refactoring of project source code
Rewrite structure for represent DSA information. (dict to class)
-
-oval/dsa/parser.py:
- Proper extraction of date from "repord_date>" DSA token
oval/definition/generator.py:
Rewrite tests generation conform to linux-definition-schema
Modified: trunk/tools/oval/definition/generator.py
===================================================================
--- trunk/tools/oval/definition/generator.py 2007-06-12 17:59:58 UTC (rev 46)
+++ trunk/tools/oval/definition/generator.py 2007-06-12 19:25:32 UTC (rev 47)
@@ -290,8 +290,11 @@
root.appendChild ( __createGeneratorHeader () )
definitions = doc.createElement ("definitions")
- for (dsa, data) in dsaref.iteritems():
- definitions.appendChild (createDefinition(dsa, data))
+
+ keyids = dsaref.keys()
+ keyids.sort()
+ for dsa in keyids:
+ definitions.appendChild (createDefinition(dsa, dsaref[dsa]))
root.appendChild (definitions)
Modified: trunk/tools/oval/parser/dsa.py
===================================================================
--- trunk/tools/oval/parser/dsa.py 2007-06-12 17:59:58 UTC (rev 46)
+++ trunk/tools/oval/parser/dsa.py 2007-06-12 19:25:32 UTC (rev 47)
@@ -1,5 +1,6 @@
import re
import os
+import locale
import logging
# Format of data files is:
@@ -30,7 +31,7 @@
dsaFile = open(path)
for line in dsaFile:
- line = line.decode('koi8-r')
+ line = line.decode(locale.getpreferredencoding())
datepatern = re.compile (r'report_date>([\d-]+)</define-tag>')
result = datepatern.search (line)
if result:
Modified: trunk/tools/oval/parser/wml.py
===================================================================
--- trunk/tools/oval/parser/wml.py 2007-06-12 17:59:58 UTC (rev 46)
+++ trunk/tools/oval/parser/wml.py 2007-06-12 19:25:32 UTC (rev 47)
@@ -1,6 +1,7 @@
import re
import os
import sys
+import locale
import logging
# Format of wml files is:
@@ -28,7 +29,7 @@
wmlFile = open(path)
for line in wmlFile:
- line = line.decode('koi8-r')
+ line = line.decode(locale.getpreferredencoding())
descrpatern = re.compile (r'description>(.*?)</define-tag>')
result = descrpatern.search (line)
Modified: trunk/tools/parse-dsa-oval.py
===================================================================
--- trunk/tools/parse-dsa-oval.py 2007-06-12 17:59:58 UTC (rev 46)
+++ trunk/tools/parse-dsa-oval.py 2007-06-12 19:25:32 UTC (rev 47)
@@ -27,7 +27,7 @@
\t-v\tverbose mode
\t-h\tthis help
""" % prog
-
+
def printdsas (dsaref):
""" Generate and print OVAL Definitions for collected DSA information """
@@ -70,7 +70,8 @@
for (k, v) in result[1].iteritems():
dsaref[result[0]][k] = v
else:
- dsaref[result[0]] = result[1]
+ dsaref[result[0]] = result[1]
+
return 0
if __name__ == "__main__":
More information about the Oval-commits
mailing list