From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id F227E158009 for ; Mon, 26 Jun 2023 21:52:31 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 27ACBE0821; Mon, 26 Jun 2023 21:52:31 +0000 (UTC) Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 1056FE0821 for ; Mon, 26 Jun 2023 21:52:31 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 40528340E78 for ; Mon, 26 Jun 2023 21:52:30 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id A2064A76 for ; Mon, 26 Jun 2023 21:52:28 +0000 (UTC) From: "Magnus Granberg" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Magnus Granberg" Message-ID: <1687816147.73e8b3e7c00b1b2686ae0df6d406181b6c3808a7.zorry@gentoo> Subject: [gentoo-commits] proj/tinderbox-cluster:master commit in: buildbot_gentoo_ci/db/ X-VCS-Repository: proj/tinderbox-cluster X-VCS-Files: buildbot_gentoo_ci/db/versions.py X-VCS-Directories: buildbot_gentoo_ci/db/ X-VCS-Committer: zorry X-VCS-Committer-Name: Magnus Granberg X-VCS-Revision: 73e8b3e7c00b1b2686ae0df6d406181b6c3808a7 X-VCS-Branch: master Date: Mon, 26 Jun 2023 21:52:28 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 684033ab-82b8-4e5b-a99e-5abfe2fe2f3e X-Archives-Hash: 91310c710b2832707b87a9e4aba3a1bf commit: 73e8b3e7c00b1b2686ae0df6d406181b6c3808a7 Author: Magnus Granberg gentoo org> AuthorDate: Mon Jun 26 21:49:07 2023 +0000 Commit: Magnus Granberg gentoo org> CommitDate: Mon Jun 26 21:49:07 2023 +0000 URL: https://gitweb.gentoo.org/proj/tinderbox-cluster.git/commit/?id=73e8b3e7 Add support to remove ebuilds in db Signed-off-by: Magnus Granberg gentoo.org> buildbot_gentoo_ci/db/versions.py | 40 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) 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,