From 6e7a39995e27032441239a13a0ba3bee85fe0b45 Mon Sep 17 00:00:00 2001 From: Luciano Bello Date: Fri, 16 Jan 2015 19:30:37 +0000 Subject: unknown-packages uses local database git-svn-id: svn+ssh://svn.debian.org/svn/secure-testing@31396 e39458fd-73e7-0310-bf30-c45bca0a0e42 --- check-external/unknown-packages-pts.py | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) (limited to 'check-external') diff --git a/check-external/unknown-packages-pts.py b/check-external/unknown-packages-pts.py index 9a98cbab5a..9f88147f21 100755 --- a/check-external/unknown-packages-pts.py +++ b/check-external/unknown-packages-pts.py @@ -1,20 +1,41 @@ #!/usr/bin/python -from BeautifulSoup import BeautifulSoup import urllib2 -import json import SOAPpy import os +import string +import sys -soup = BeautifulSoup(urllib2.urlopen('https://security-tracker.debian.org/tracker/data/unknown-packages').read()) 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') -pkgs=[ r('td')[0].string for r in soup('table')[0].findAll('tr')[1:] ] +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 in pkgs: +for pkg,bugs in db.getUnknownPackages(db.cursor()): if not pkg in open(cache_file).read(): - try: + try: ws.versions(source=pkg) except SOAPpy.faultType: print pkg, -- cgit v1.2.3