#!/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")