summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xgen-patch-info.py3
-rw-r--r--patchtracker/DB.py7
2 files changed, 5 insertions, 5 deletions
diff --git a/gen-patch-info.py b/gen-patch-info.py
index 3c8ae0d..07d753a 100755
--- a/gen-patch-info.py
+++ b/gen-patch-info.py
@@ -40,6 +40,7 @@ if __name__ == '__main__':
for p in a.sourcepackages(s, c, filter=packages):
print "\t\tpackage:",p
db.saveSourcePackage(p)
- db.relateSourcePackage(p,suite=s,component=c)
+ db.relateSourcePackage(name=p.name, version=p.version, suite=s,
+ component=c)
db.finalize()
diff --git a/patchtracker/DB.py b/patchtracker/DB.py
index b72b11e..e706d97 100644
--- a/patchtracker/DB.py
+++ b/patchtracker/DB.py
@@ -129,15 +129,14 @@ class PatchTrackerDB:
cursor.execute(q, (srcpkg.name, suite))
return cursor.fetchone()
- def relateSourcePackage(self, srcpkg, suite, component):
- s = self.findSourcePackage(srcpkg)
+ def relateSourcePackage(self, name, version, suite, component):
q = "INSERT OR REPLACE INTO package_rel_map \
(package_id,suite_id,component_id) \
- VALUES (?, \
+ VALUES (SELECT id FROM packages WHERE name=? AND version=?), \
(SELECT id FROM suites WHERE name=?), \
(SELECT id FROM components WHERE name=?))"
cursor = self.db.cursor()
- cursor.execute(q, (s[0], suite, component))
+ cursor.execute(q, (name, version, suite, component))
def finalize(self):
self.db.commit()