[Collab-qa-commits] r2331 - udd/udd
Andreas Tille
tille at alioth.debian.org
Wed May 16 12:08:12 UTC 2012
Author: tille
Date: 2012-05-16 12:08:12 +0000 (Wed, 16 May 2012)
New Revision: 2331
Modified:
udd/udd/blends_prospective_gatherer.py
Log:
Simply inject citation also from packages which are not yet residing inside Debian pool
Modified: udd/udd/blends_prospective_gatherer.py
===================================================================
--- udd/udd/blends_prospective_gatherer.py 2012-05-16 08:15:05 UTC (rev 2330)
+++ udd/udd/blends_prospective_gatherer.py 2012-05-16 12:08:12 UTC (rev 2331)
@@ -95,6 +95,7 @@
u_dirs = listdir(my_config['path'])
pkgs = []
+ bibrefs = []
for u in u_dirs:
upath=my_config['path']+'/'+u
@@ -118,6 +119,9 @@
# There are no valid references found in this upstream file or it is no valid YAML
continue
self.log.warning("%s has upstream file but no references in UDD" % (source, ))
+ upstream.parse()
+ for ref in upstream.get_bibrefs():
+ bibrefs.append(ref)
continue
# Read output of dpkg-parsechangelog
@@ -323,6 +327,17 @@
pkg = ictrl.next()
except:
break
+ # Try to read debian/control
+ upstream = None
+ ufile = upath+'/'+source+'.upstream'
+ if exists(ufile):
+ cur.execute("EXECUTE check_reference (%s)", (source,))
+ if cur.fetchone()[0] == 0:
+ upstream = upstream_reader(ufile, source, self.log)
+ if upstream.references:
+ upstream.parse()
+ for ref in upstream.get_bibrefs():
+ bibrefs.append(ref)
cur.execute("""PREPARE package_insert AS INSERT INTO %s
(blend, package, source,
@@ -362,6 +377,20 @@
raise
cur.execute("DEALLOCATE package_insert")
+
+ # Inserting references should be save because above we are testing for existant table entries
+ query = """PREPARE bibref_insert (text, text, text, text, int) AS INSERT INTO bibref
+ (source, key, value, package, rank)
+ VALUES ($1, $2, $3, $4, $5)"""
+ cur.execute(query)
+ bibquery = "EXECUTE bibref_insert (%(source)s, %(key)s, %(value)s, %(package)s, %(rank)s)"
+ try:
+ cur.executemany(bibquery, bibrefs)
+ except ProgrammingError:
+ print "Error while inserting references"
+ raise
+ cur.execute("DEALLOCATE bibref_insert")
+
cur.execute("ANALYZE %s" % my_config['table'])
if __name__ == '__main__':
More information about the Collab-qa-commits
mailing list