summaryrefslogtreecommitdiffstats
path: root/check-external/unknown-packages-pts.py
blob: 9f88147f21e2e9787f0b79fd1e9968babf3d5f42 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/python
import urllib2
import SOAPpy
import os
import string
import sys

cache_file=os.path.join(os.path.dirname(os.path.abspath(__file__)),'known-unknown-packages.cache')
db_file=os.path.join(os.path.dirname(os.path.abspath(__file__)),'../data/security.db')

def setup_paths():
    check_file = 'lib/python/debian_support.py'
    path = os.getcwd()
    while 1:
        if os.path.exists("%s/%s" % (path, check_file)):
            sys.path = [path + '/lib/python'] + sys.path
            return path
        idx = string.rfind(path, '/')
        if idx == -1:
            raise ImportError, "could not setup paths"
        path = path[0:idx]
os.chdir(setup_paths())

import security_db

try:
    db = security_db.DB(db_file)
    new_file = False
except security_db.SchemaMismatch:
    os.unlink(db_file)
    db = security_db.DB(db_file, verbose=True)
    new_file = True
    
ws = SOAPpy.SOAPProxy('https://packages.qa.debian.org/cgi-bin/soap-alpha.cgi')

for pkg,bugs in db.getUnknownPackages(db.cursor()):
  if not pkg in open(cache_file).read():
    try:
       ws.versions(source=pkg)
    except SOAPpy.faultType:
       print pkg,
    else:
       with open(cache_file, 'a') as file:
         file.write(pkg+"\n")

© 2014-2024 Faster IT GmbH | imprint | privacy policy