aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMagnus Granberg <zorry@gentoo.org>2023-06-26 23:49:07 +0200
committerMagnus Granberg <zorry@gentoo.org>2023-06-26 23:49:07 +0200
commit73e8b3e7c00b1b2686ae0df6d406181b6c3808a7 (patch)
tree138f58b2e64574af3bcef9203a30dd77ce446fe9
parentAdd deleteLogChunks patch for bb (diff)
downloadtinderbox-cluster-73e8b3e7c00b1b2686ae0df6d406181b6c3808a7.tar.gz
tinderbox-cluster-73e8b3e7c00b1b2686ae0df6d406181b6c3808a7.tar.bz2
tinderbox-cluster-73e8b3e7c00b1b2686ae0df6d406181b6c3808a7.zip
Add support to remove ebuilds in db
Signed-off-by: Magnus Granberg <zorry@gentoo.org>
-rw-r--r--buildbot_gentoo_ci/db/versions.py40
1 files changed, 40 insertions, 0 deletions
diff --git a/buildbot_gentoo_ci/db/versions.py b/buildbot_gentoo_ci/db/versions.py
index 6b534f3..0aaac1b 100644
--- a/buildbot_gentoo_ci/db/versions.py
+++ b/buildbot_gentoo_ci/db/versions.py
@@ -131,6 +131,46 @@ class VersionsConnectorComponent(base.DBConnectorComponent):
res = yield self.db.pool.do(thd)
return res
+ @defer.inlineCallbacks
+ def getEbuildsByPackage(self, p_uuid, deleted=False):
+ def thd(conn):
+ tbl = self.db.model.versions
+ q = tbl.select()
+ q = q.where(tbl.c.deleted == deleted)
+ q = q.where(tbl.c.package_uuid == p_uuid)
+ return [self._row2dict(conn, row)
+ for row in conn.execute(q).fetchall()]
+ res = yield self.db.pool.do(thd)
+ return res
+
+ @defer.inlineCallbacks
+ def removeVersion(self, uuid):
+ def thd(conn, no_recurse=False):
+ tbl = self.db.model.versions
+ q = tbl.delete()
+ q = q.where(tbl.c.uuid == uuid)
+ conn.execute(q)
+ yield self.db.pool.do(thd)
+
+ @defer.inlineCallbacks
+ def removeVersionMetadata(self, version_uuid):
+ def thd(conn, no_recurse=False):
+ tbl = self.db.model.versions_metadata
+ q = tbl.delete()
+ q = q.where(tbl.c.version_uuid == version_uuid)
+ conn.execute(q)
+ yield self.db.pool.do(thd)
+
+ @defer.inlineCallbacks
+ def removeVersionKeyword(self, version_uuid):
+ def thd(conn, no_recurse=False):
+ tbl = self.db.model.versions_keywords
+ q = tbl.delete()
+ q = q.where(tbl.c.version_uuid == version_uuid)
+ conn.execute(q)
+ yield self.db.pool.do(thd)
+
+
def _row2dict(self, conn, row):
return dict(
uuid=row.uuid,