/[secure-testing]/bin/update-nvd
ViewVC logotype

Contents of /bin/update-nvd

Parent Directory Parent Directory | Revision Log Revision Log


Revision 14058 - (show annotations) (download)
Sun Feb 7 22:10:53 2010 UTC (3 years, 3 months ago) by gilbert-guest
File MIME type: text/script
File size: 1061 byte(s)
use nvd urgencies and add finer control for per-release pages
1 #!/usr/bin/python
2
3 import os
4 import os.path
5 import string
6 import sys
7
8 def setup_paths():
9 check_file = 'lib/python/debian_support.py'
10 path = os.getcwd()
11 while 1:
12 if os.path.exists("%s/%s" % (path, check_file)):
13 sys.path = [path + '/lib/python'] + sys.path
14 return path
15 idx = string.rfind(path, '/')
16 if idx == -1:
17 raise ImportError, "could not setup paths"
18 path = path[0:idx]
19 os.chdir(setup_paths())
20
21 import nvd
22 import security_db
23
24 db_file = 'data/security.db'
25 db = security_db.DB(db_file)
26
27 incremental = False
28 data = []
29 for name in sys.argv[1:]:
30 if name == '-i':
31 incremental = True
32 continue
33 f = file(name)
34 data += nvd.parse(f)
35 f.close()
36
37 # For some reason, NVD adds duplicates, so we need to get rid of them.
38 # Sort afterwords to increase locality in the insert process.
39 deduplicate = {}
40 for x in data:
41 deduplicate[x[0]] = x
42 data = deduplicate.values()
43 data.sort()
44
45 cursor = db.writeTxn()
46 db.updateNVD(cursor, data, incremental)
47 db.commit(cursor)

Properties

Name Value
svn:mime-type text/script

  ViewVC Help
Powered by ViewVC 1.1.5