[Secure-testing-commits] r31396 - check-external
Luciano Bello
luciano at moszumanska.debian.org
Fri Jan 16 19:30:38 UTC 2015
Author: luciano
Date: 2015-01-16 19:30:37 +0000 (Fri, 16 Jan 2015)
New Revision: 31396
Modified:
check-external/unknown-packages-pts.py
Log:
unknown-packages uses local database
Modified: check-external/unknown-packages-pts.py
===================================================================
--- check-external/unknown-packages-pts.py 2015-01-16 19:09:36 UTC (rev 31395)
+++ check-external/unknown-packages-pts.py 2015-01-16 19:30:37 UTC (rev 31396)
@@ -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,
More information about the Secure-testing-commits
mailing list