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

Contents of /bin/update-db

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5470 - (hide annotations) (download)
Sun Feb 18 16:50:24 2007 UTC (6 years, 3 months ago) by fw
File size: 1677 byte(s)
Treat packages marked as <removed> as source packages.
This allows us to track firefox issues again.

* lib/python/bugs.py (FileBase):
  Keep track of removed packages.

* lib/python/security_db.py
  (DB.readBugs): Populate removed_packages table using <removed> entries.
  (DB.readRemovedPackages): Remove method.

* bin/update-db:
  Do not call readRemovedPackages anymore.
1 fw 1994 #!/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 bugs
22     import debian_support
23     import security_db
24    
25 fw 3056 db_file = sys.argv[1]
26 fw 1994 try:
27 fw 3053 db = security_db.DB(db_file)
28 fw 2000 new_file = False
29 fw 1994 except security_db.SchemaMismatch:
30     os.unlink(db_file)
31     db = security_db.DB(db_file, verbose=True)
32 fw 2000 new_file = True
33 fw 1994
34 fw 3056 db.cursor().execute("PRAGMA synchronous = OFF")
35 fw 1994 cursor = db.writeTxn()
36    
37     # Bug lists (CAN/CVE/DSA/DTSA)
38    
39     try:
40     warnings = db.readBugs(cursor, 'data')
41 fw 2155 except SyntaxError, e:
42     if e.filename is None or e.lineno is None:
43     print "error:", e
44     else:
45     print "%s:%d: %s" % (e.filename, e.lineno, e.msg)
46     sys.exit(1)
47 fw 1994 except debian_support.ParseError, e:
48     e.printOut(sys.stderr)
49     sys.exit(1)
50     except security_db.InsertError, e:
51     for err in e.errors:
52     print err
53     sys.exit(1)
54     if warnings:
55     for x in warnings:
56     print x
57     sys.exit(1)
58    
59     # Packages
60    
61     db.readPackages(cursor, 'data/packages')
62    
63 fw 2000 if new_file:
64     db.commit(cursor)
65     cursor = db.writeTxn()
66    
67 fw 1994 # Calculate vulnerability information.
68    
69     warnings = db.calculateVulnerabilities(cursor)
70     if warnings:
71     for x in warnings:
72     print x
73     sys.exit(1)
74    
75 fw 3051 # debsecan data
76    
77 fw 3129 db.calculateDebsecan()
78 fw 3051
79 fw 1994 # Everything worked well.
80 fw 3051
81 fw 1994 db.commit(cursor)

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.5