From: Luca Falavigna Date: Tue, 22 Jun 2010 19:35:51 +0000 (+0000) Subject: Add import_changelogs.py script X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=61aabd592201892840ebac244f64c0d05c728d89;p=dak Add import_changelogs.py script Signed-off-by: Luca Falavigna --- diff --git a/tools/import_changelogs.py b/tools/import_changelogs.py new file mode 100755 index 00000000..5a161b5f --- /dev/null +++ b/tools/import_changelogs.py @@ -0,0 +1,37 @@ +#!/usr/bin/python +# (c) 2010 Luca Falavigna +# Free software licensed under the GPL version 2 or later + +import os +import sys +import fnmatch +from glob import glob +from daklib.dbconn import * +from daklib import utils +from daklib.queue import Upload + +i = 0 +t = 0 +pattern = '*.changes' +changes_dir = '/srv/ftp.debian.org/queue/done' + +def find_changes(pattern, root): + for path, dirs, files in os.walk(os.path.abspath(root)): + for filename in fnmatch.filter(files, pattern): + yield os.path.join(path, filename) + +for changes_file in find_changes(pattern, changes_dir): + t = t + 1 +for changes_file in find_changes(pattern, changes_dir): + u = Upload() + u.pkg.changes_file = changes_file + (u.pkg.changes["fingerprint"], rejects) = utils.check_signature(changes_file) + if u.load_changes(changes_file): + try: + u.store_changelog() + except: + print 'Unable to handle %s' % changes_file + else: + print u.rejects + i = i + 1 + sys.stdout.write('%d out of %d processed\r' % (i, t))