[gentoo-commits] proj/tinderbox-cluster:master commit in: buildbot_gentoo_ci/steps/, buildbot_gentoo_ci/config/, buildbot_gentoo_ci/db/

2022-04-22 Thread Magnus Granberg
commit: 2fac94e594b5f50b00780361788df91800a59ea7
Author: Magnus Granberg  gentoo  org>
AuthorDate: Fri Apr 22 12:37:35 2022 +
Commit: Magnus Granberg  gentoo  org>
CommitDate: Fri Apr 22 12:37:35 2022 +
URL:
https://gitweb.gentoo.org/proj/tinderbox-cluster.git/commit/?id=2fac94e5

Add support stage4 build

Signed-off-by: Magnus Granberg  gentoo.org>

 buildbot_gentoo_ci/config/buildfactorys.py |   9 +
 buildbot_gentoo_ci/config/schedulers.py|  28 ++-
 buildbot_gentoo_ci/db/model.py |   1 +
 buildbot_gentoo_ci/steps/nodes.py  | 322 +
 4 files changed, 344 insertions(+), 16 deletions(-)

diff --git a/buildbot_gentoo_ci/config/buildfactorys.py 
b/buildbot_gentoo_ci/config/buildfactorys.py
index 86fa162..a714e47 100644
--- a/buildbot_gentoo_ci/config/buildfactorys.py
+++ b/buildbot_gentoo_ci/config/buildfactorys.py
@@ -13,6 +13,7 @@ from buildbot_gentoo_ci.steps import builders
 from buildbot_gentoo_ci.steps import portage
 from buildbot_gentoo_ci.steps import logs
 from buildbot_gentoo_ci.steps import repos
+from buildbot_gentoo_ci.steps import nodes
 
 def update_db_check():
 f = util.BuildFactory()
@@ -216,3 +217,11 @@ def parse_build_log():
 # setup things for the irc bot
 #f.addStep(logs.SetIrcInfo())
 return f
+
+def run_build_stage4_request():
+f = util.BuildFactory()
+# set needed Propertys
+f.addStep(nodes.SetupPropertys())
+# set the needed steps for making the stage4
+f.addStep(nodes.SetupStage4Steps())
+return f

diff --git a/buildbot_gentoo_ci/config/schedulers.py 
b/buildbot_gentoo_ci/config/schedulers.py
index e520076..8c08006 100644
--- a/buildbot_gentoo_ci/config/schedulers.py
+++ b/buildbot_gentoo_ci/config/schedulers.py
@@ -46,24 +46,18 @@ def gentoo_schedulers():
 builderNames = builderUpdateDbNames,
 change_filter=util.ChangeFilter(branch='master'),
 )
-test_updatedb = schedulers.ForceScheduler(
-name="force",
-buttonName="pushMe!",
-label="My nice Force form",
-builderNames=['update_db_check'],
+create_stage4 = schedulers.ForceScheduler(
+name="create_stage4",
+buttonName="Create stage4",
+label="Create stage4 form",
+builderNames=['run_build_stage4_request'],
 # A completely customized property list.  The name of the
 # property is the name of the parameter
 properties=[
-util.NestedParameter(name="options", label="Build Options",
-layout="vertical", fields=[
-util.StringParameter(name="cpv_changes",
-label="Package to check",
-default="dev-lang/python-3.8", size=80),
-util.StringParameter(name="repository",
-label="repo",
-default="gentoo", size=80),
-])
-])
+util.StringParameter(name="project_uuid",
+label="Project uuid",
+default="e89c2c1a-46e0-4ded-81dd-c51afeb7fcfd", size=36),
+])
 update_cpv_data = schedulers.Triggerable(name="update_cpv_data",
builderNames=["update_cpv_data"])
 update_repo_check = schedulers.Triggerable(name="update_repo_check",
@@ -76,8 +70,10 @@ def gentoo_schedulers():
builderNames=["run_build_request"])
 parse_build_log = schedulers.Triggerable(name="parse_build_log",
builderNames=["parse_build_log"])
+run_build_stage4_request = 
schedulers.Triggerable(name="run_build_stage4_request",
+   builderNames=["run_build_stage4_request"])
 s = []
-s.append(test_updatedb)
+s.append(create_stage4)
 s.append(scheduler_update_db)
 s.append(update_repo_check)
 s.append(update_cpv_data)

diff --git a/buildbot_gentoo_ci/db/model.py b/buildbot_gentoo_ci/db/model.py
index 18fb7ff..908ebb5 100644
--- a/buildbot_gentoo_ci/db/model.py
+++ b/buildbot_gentoo_ci/db/model.py
@@ -110,6 +110,7 @@ class Model(base.DBConnectorComponent):
 sa.Column('keyword_id', sa.Integer,
   sa.ForeignKey('keywords.id', ondelete='CASCADE'),
   nullable=False),
+sa.Column('image', sa.String(255), nullable=False),
 sa.Column('status', sa.Enum('stable','unstable','all'), 
nullable=False),
 sa.Column('auto', sa.Boolean, default=False),
 sa.Column('enabled', sa.Boolean, default=False),

diff --git a/buildbot_gentoo_ci/steps/nodes.py 
b/buildbot_gentoo_ci/steps/nodes.py
new file mode 100644
index 000..37cf917
--- /dev/null
+++ b/buildbot_gentoo_ci/steps/nodes.py
@@ -0,0 +1,322 @@
+# Copyright 2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+import os
+import re
+import json
+import requests
+from requests.adapters import HTTPAdapter
+from requests.packages.urllib3.util.retry import Retry
+
+

[gentoo-commits] proj/tinderbox-cluster:master commit in: buildbot_gentoo_ci/steps/, buildbot_gentoo_ci/config/, buildbot_gentoo_ci/db/

2021-02-22 Thread Magnus Granberg
commit: 4324b82edd9d69a27b1db9f4272564ddc51a75dd
Author: Magnus Granberg  gentoo  org>
AuthorDate: Mon Feb 22 20:27:14 2021 +
Commit: Magnus Granberg  gentoo  org>
CommitDate: Mon Feb 22 20:27:14 2021 +
URL:
https://gitweb.gentoo.org/proj/tinderbox-cluster.git/commit/?id=4324b82e

Add RunPkgCheck and CheckPkgCheckLogs

Signed-off-by: Magnus Granberg  gentoo.org>

 buildbot_gentoo_ci/config/buildfactorys.py |  11 ++-
 buildbot_gentoo_ci/db/model.py |   2 +-
 buildbot_gentoo_ci/db/projects.py  |   6 +-
 buildbot_gentoo_ci/steps/builders.py   | 120 +++--
 4 files changed, 129 insertions(+), 10 deletions(-)

diff --git a/buildbot_gentoo_ci/config/buildfactorys.py 
b/buildbot_gentoo_ci/config/buildfactorys.py
index 3c77762..cfe4131 100644
--- a/buildbot_gentoo_ci/config/buildfactorys.py
+++ b/buildbot_gentoo_ci/config/buildfactorys.py
@@ -92,13 +92,15 @@ def run_build_request():
 # set needed Propertys
 f.addStep(builders.SetupPropertys())
 # Clean and add new /etc/portage
+#FIXME: Is don't like symlinks
 f.addStep(buildbot_steps.RemoveDirectory(dir="portage",
 workdir='/etc/'))
 f.addStep(buildbot_steps.MakeDirectory(dir="portage",
 workdir='/etc/'))
 # setup the profile
-f.addStep(buildbot_steps.MakeDirectory(dir="make.profile",
-workdir='/etc/portage/'))
+#NOTE: pkgcheck do not support it as a dir
+#f.addStep(buildbot_steps.MakeDirectory(dir="make.profile",
+#workdir='/etc/portage/'))
 f.addStep(builders.SetMakeProfile())
 # setup repos.conf dir
 f.addStep(buildbot_steps.MakeDirectory(dir="repos.conf",
@@ -132,4 +134,9 @@ def run_build_request():
 #   check log
 # setup make.conf if build id has changes make.conf as dict from 
SetMakeConf
 # setup package.* env if build id has changes
+# setup pkgcheck.conf if needed
+#f.addStep(builders.SetPkgCheckConf())
+# run pkgcheck if wanted
+#   check log
+f.addStep(builders.RunPkgCheck())
 return f

diff --git a/buildbot_gentoo_ci/db/model.py b/buildbot_gentoo_ci/db/model.py
index 0a2c145..4d691ea 100644
--- a/buildbot_gentoo_ci/db/model.py
+++ b/buildbot_gentoo_ci/db/model.py
@@ -128,7 +128,7 @@ class Model(base.DBConnectorComponent):
   sa.ForeignKey('repositorys.uuid', ondelete='CASCADE'),
   nullable=False),
 sa.Column('auto', sa.Boolean, default=False),
-sa.Column('pkgcheck', sa.Boolean, default=False),
+sa.Column('pkgcheck', sa.Enum('package','full','none'), 
default='none'),
 )
 
 # projects etc/portage settings

diff --git a/buildbot_gentoo_ci/db/projects.py 
b/buildbot_gentoo_ci/db/projects.py
index eb8f727..9aeca50 100644
--- a/buildbot_gentoo_ci/db/projects.py
+++ b/buildbot_gentoo_ci/db/projects.py
@@ -160,12 +160,16 @@ class 
ProjectsConnectorComponent(base.DBConnectorComponent):
 )
 
 def _row2dict_projects_repositorys(self, conn, row):
+if row.pkgcheck == 'none':
+pkgcheck = False
+else:
+pkgcheck=row.pkgcheck
 return dict(
 id=row.id,
 project_uuid=row.project_uuid,
 repository_uuid=row.repository_uuid,
 auto=row.auto,
-pkgcheck=row.pkgcheck
+pkgcheck=pkgcheck
 )
 
 def _row2dict_projects_portage(self, conn, row):

diff --git a/buildbot_gentoo_ci/steps/builders.py 
b/buildbot_gentoo_ci/steps/builders.py
index c0567c1..6d46ae6 100644
--- a/buildbot_gentoo_ci/steps/builders.py
+++ b/buildbot_gentoo_ci/steps/builders.py
@@ -4,6 +4,8 @@
 import os
 import re
 
+from portage.versions import catpkgsplit
+
 from twisted.internet import defer
 from twisted.python import log
 
@@ -75,6 +77,26 @@ def PersOutputOfEmerge(rc, stdout, stderr):
 'emerge_output' : emerge_output
 }
 
+def PersOutputOfPkgCheck(rc, stdout, stderr):
+pkgcheck_output = {}
+pkgcheck_output['rc'] = rc
+#FIXME: Handling of stdout output
+pkgcheck_xml_list = []
+# split the lines
+for line in stdout.split('\n'):
+#  pkgcheck output list
+if line.startswith('

[gentoo-commits] proj/tinderbox-cluster:master commit in: buildbot_gentoo_ci/steps/, buildbot_gentoo_ci/config/, buildbot_gentoo_ci/db/

2021-01-17 Thread Magnus Granberg
commit: 81da08ad4476408915e0e082a33f5a1c2ebe159e
Author: Magnus Granberg  gentoo  org>
AuthorDate: Sun Jan 17 09:25:07 2021 +
Commit: Magnus Granberg  gentoo  org>
CommitDate: Sun Jan 17 09:25:07 2021 +
URL:
https://gitweb.gentoo.org/proj/tinderbox-cluster.git/commit/?id=81da08ad

Add BuildFactory update_db_v

Signed-off-by: Magnus Granberg  gentoo.org>

 buildbot_gentoo_ci/config/builders.py  |  16 ++
 buildbot_gentoo_ci/config/buildfactorys.py |  36 +++-
 buildbot_gentoo_ci/config/schedulers.py|   6 +
 buildbot_gentoo_ci/db/connector.py |   4 +
 buildbot_gentoo_ci/db/keywords.py  |  76 +
 buildbot_gentoo_ci/db/model.py |  28 +--
 buildbot_gentoo_ci/db/versions.py  | 112 
 buildbot_gentoo_ci/steps/package.py|  34 +++-
 buildbot_gentoo_ci/steps/update_db.py  |   6 +-
 buildbot_gentoo_ci/steps/version.py| 264 +
 10 files changed, 562 insertions(+), 20 deletions(-)

diff --git a/buildbot_gentoo_ci/config/builders.py 
b/buildbot_gentoo_ci/config/builders.py
index c069841..9fef46a 100644
--- a/buildbot_gentoo_ci/config/builders.py
+++ b/buildbot_gentoo_ci/config/builders.py
@@ -22,4 +22,20 @@ def gentoo_builders(b=[]):
 factory=buildfactorys.update_db_cp()
 )
 )
+# FIXME: get workers from db
+# Use multiplay workers
+b.append(util.BuilderConfig(
+name='update_v_data',
+workername='updatedb_1',
+factory=buildfactorys.update_db_v()
+)
+)
+# FIXME: get workers from db
+# Use multiplay workers
+b.append(util.BuilderConfig(
+name='build_request_data',
+workername='updatedb_1',
+factory=buildfactorys.build_request_check()
+)
+)
 return b

diff --git a/buildbot_gentoo_ci/config/buildfactorys.py 
b/buildbot_gentoo_ci/config/buildfactorys.py
index 4038bb1..ba96e5a 100644
--- a/buildbot_gentoo_ci/config/buildfactorys.py
+++ b/buildbot_gentoo_ci/config/buildfactorys.py
@@ -7,6 +7,7 @@ from buildbot.plugins import util
 from buildbot_gentoo_ci.steps import update_db
 from buildbot_gentoo_ci.steps import category
 from buildbot_gentoo_ci.steps import package
+from buildbot_gentoo_ci.steps import version
 
 def update_db_check():
 f = util.BuildFactory()
@@ -45,7 +46,36 @@ def update_db_cp():
 #   add package to db step
 #   return package_data
 f.addStep(package.CheckPGentooCiProject())
-# Make a for loop and trigger new builders with v from cpv
-#   return package_data, cpv, repository, project_data, config_root
-#f.addStep(package.TriggerVGentooCiProject())
+# Trigger new builders with v from cpv
+#   return package_data, cpv, repository_data, project_data, config_root
+f.addStep(package.TriggerCheckVGentooCiProject())
+return f
+
+def update_db_v():
+f = util.BuildFactory()
+# FIXME: 3
+# if version in db
+#   return version_data
+f.addStep(version.GetVData())
+#   check path and hash
+f.addStep(version.CheckPathHash())
+#   if not path
+#   if not hash
+#   add deleted stage att end
+#   add version to db stage
+#   add version metadata to db
+#   add version to build check
+#   else
+#   add deleted stage att end
+#   add version to build check stage att end
+# else
+#   add version to db
+#   add version metadata to db
+#   add version to build check
+f.addStep(version.CheckV())
+return f
+
+def build_request_check():
+f = util.BuildFactory()
+# FIXME: 4
 return f

diff --git a/buildbot_gentoo_ci/config/schedulers.py 
b/buildbot_gentoo_ci/config/schedulers.py
index 88d0e49..687b52f 100644
--- a/buildbot_gentoo_ci/config/schedulers.py
+++ b/buildbot_gentoo_ci/config/schedulers.py
@@ -52,8 +52,14 @@ def gentoo_schedulers():
 ])
 update_cpv_data = schedulers.Triggerable(name="update_cpv_data",
builderNames=["update_cpv_data"])
+update_v_data = schedulers.Triggerable(name="update_v_data",
+   builderNames=["update_v_data"])
+build_request_data = schedulers.Triggerable(name="build_request_data",
+   builderNames=["build_request_data"])
 s = []
 s.append(test_updatedb)
 #s.append(scheduler_update_db)
 s.append(update_cpv_data)
+s.append(update_v_data)
+s.append(build_request_data)
 return s

diff --git a/buildbot_gentoo_ci/db/connector.py 
b/buildbot_gentoo_ci/db/connector.py
index 0121d11..35febe6 100644
--- a/buildbot_gentoo_ci/db/connector.py
+++ b/buildbot_gentoo_ci/db/connector.py
@@ -34,6 +34,8 @@ from buildbot_gentoo_ci.db import projects
 from buildbot_gentoo_ci.db import repositorys
 from buildbot_gentoo_ci.db import categorys
 from buildbot_gentoo_ci.db import packages
+from buildbot_gentoo_ci.db import versions
+from buildbot_gentoo_ci.db impo

[gentoo-commits] proj/tinderbox-cluster:master commit in: buildbot_gentoo_ci/steps/, buildbot_gentoo_ci/config/, buildbot_gentoo_ci/db/

2021-01-11 Thread Magnus Granberg
commit: a4a5adaa76b48ae04c142f0c1bf602c210892731
Author: Magnus Granberg  gentoo  org>
AuthorDate: Mon Jan 11 17:45:46 2021 +
Commit: Magnus Granberg  gentoo  org>
CommitDate: Mon Jan 11 17:45:46 2021 +
URL:
https://gitweb.gentoo.org/proj/tinderbox-cluster.git/commit/?id=a4a5adaa

Add CheckPGentooCiProject on BuildFactory update_db_cp

Signed-off-by: Magnus Granberg  gentoo.org>

 buildbot_gentoo_ci/config/buildfactorys.py |  5 +-
 buildbot_gentoo_ci/db/connector.py |  2 +
 buildbot_gentoo_ci/db/packages.py  | 80 ++
 buildbot_gentoo_ci/steps/category.py   | 10 ++--
 buildbot_gentoo_ci/steps/package.py| 65 
 buildbot_gentoo_ci/steps/update_db.py  | 30 +--
 6 files changed, 170 insertions(+), 22 deletions(-)

diff --git a/buildbot_gentoo_ci/config/buildfactorys.py 
b/buildbot_gentoo_ci/config/buildfactorys.py
index 4a0ffcd..4038bb1 100644
--- a/buildbot_gentoo_ci/config/buildfactorys.py
+++ b/buildbot_gentoo_ci/config/buildfactorys.py
@@ -6,7 +6,7 @@ from buildbot.plugins import util
 
 from buildbot_gentoo_ci.steps import update_db
 from buildbot_gentoo_ci.steps import category
-#from buildbot_gentoo_ci.steps import package
+from buildbot_gentoo_ci.steps import package
 
 def update_db_check():
 f = util.BuildFactory()
@@ -44,7 +44,8 @@ def update_db_cp():
 # else
 #   add package to db step
 #   return package_data
-#f.addStep(package.CheckPGentooCiProject())
+f.addStep(package.CheckPGentooCiProject())
 # Make a for loop and trigger new builders with v from cpv
 #   return package_data, cpv, repository, project_data, config_root
+#f.addStep(package.TriggerVGentooCiProject())
 return f

diff --git a/buildbot_gentoo_ci/db/connector.py 
b/buildbot_gentoo_ci/db/connector.py
index c10fc49..0121d11 100644
--- a/buildbot_gentoo_ci/db/connector.py
+++ b/buildbot_gentoo_ci/db/connector.py
@@ -33,6 +33,7 @@ from buildbot_gentoo_ci.db import model
 from buildbot_gentoo_ci.db import projects
 from buildbot_gentoo_ci.db import repositorys
 from buildbot_gentoo_ci.db import categorys
+from buildbot_gentoo_ci.db import packages
 
 upgrade_message = textwrap.dedent("""\
 
@@ -75,6 +76,7 @@ class DBConnector(service.ReconfigurableServiceMixin,
 self.projects = projects.ProjectsConnectorComponent(self)
 self.repositorys = repositorys.RepositorysConnectorComponent(self)
 self.categorys = categorys.CategorysConnectorComponent(self)
+self.packages = packages.PackagesConnectorComponent(self)
 
 @defer.inlineCallbacks
 def setup(self, config, check_version=True, verbose=True):

diff --git a/buildbot_gentoo_ci/db/packages.py 
b/buildbot_gentoo_ci/db/packages.py
new file mode 100644
index 000..13cc267
--- /dev/null
+++ b/buildbot_gentoo_ci/db/packages.py
@@ -0,0 +1,80 @@
+# This file has parts from Buildbot and is modifyed by Gentoo Authors. 
+# Buildbot is free software: you can redistribute it and/or modify it 
+# under the terms of the GNU General Public License as published by the 
+# Free Software Foundation, version 2.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+# details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this program; if not, write to the Free Software Foundation, Inc., 51
+# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Copyright Buildbot Team Members
+# Origins: buildbot.db.*
+# Modifyed by Gentoo Authors.
+# Copyright 2021 Gentoo Authors
+
+import uuid
+import sqlalchemy as sa
+
+from twisted.internet import defer
+
+from buildbot.db import base
+
+class PackagesConnectorComponent(base.DBConnectorComponent):
+
+@defer.inlineCallbacks
+def getPackageByName(self, name):
+def thd(conn):
+tbl = self.db.model.packages
+q = tbl.select()
+q = q.where(tbl.c.name == name)
+res = conn.execute(q)
+row = res.fetchone()
+if not row:
+return None
+return self._row2dict(conn, row)
+res = yield self.db.pool.do(thd)
+return res
+
+@defer.inlineCallbacks
+def getPackageByUuid(self, uuid):
+def thd(conn):
+tbl = self.db.model.packages
+q = tbl.select()
+q = q.where(tbl.c.uuid == uuid)
+res = conn.execute(q)
+row = res.fetchone()
+if not row:
+return None
+return self._row2dict(conn, row)
+res = yield self.db.pool.do(thd)
+return res
+
+@defer.inlineCallbacks
+def addPackage(self, name, repository_uuid, category_uuid):
+def thd(conn, no_recurse=False):
+try:
+tbl = self.db.model.

[gentoo-commits] proj/tinderbox-cluster:master commit in: buildbot_gentoo_ci/steps/, buildbot_gentoo_ci/config/, buildbot_gentoo_ci/db/

2021-01-10 Thread Magnus Granberg
commit: 12c4aa125889ef4518a7ecc8232a10d55b129301
Author: Magnus Granberg  gentoo  org>
AuthorDate: Sun Jan 10 21:40:48 2021 +
Commit: Magnus Granberg  gentoo  org>
CommitDate: Sun Jan 10 21:40:48 2021 +
URL:
https://gitweb.gentoo.org/proj/tinderbox-cluster.git/commit/?id=12c4aa12

Add CheckCGentooCiProject on BuildFactory update_db_cp

Signed-off-by: Magnus Granberg  gentoo.org>

 buildbot_gentoo_ci/config/buildfactorys.py |  4 +-
 buildbot_gentoo_ci/db/categorys.py | 76 ++
 buildbot_gentoo_ci/db/connector.py |  2 +
 buildbot_gentoo_ci/db/model.py | 10 ++--
 buildbot_gentoo_ci/steps/category.py   | 58 +++
 5 files changed, 143 insertions(+), 7 deletions(-)

diff --git a/buildbot_gentoo_ci/config/buildfactorys.py 
b/buildbot_gentoo_ci/config/buildfactorys.py
index 3fae376..4a0ffcd 100644
--- a/buildbot_gentoo_ci/config/buildfactorys.py
+++ b/buildbot_gentoo_ci/config/buildfactorys.py
@@ -5,7 +5,7 @@ from buildbot.plugins import steps as buildbot_steps
 from buildbot.plugins import util
 
 from buildbot_gentoo_ci.steps import update_db
-#from buildbot_gentoo_ci.steps import category
+from buildbot_gentoo_ci.steps import category
 #from buildbot_gentoo_ci.steps import package
 
 def update_db_check():
@@ -37,7 +37,7 @@ def update_db_cp():
 # else
 #   add category to db step
 #   return category_data
-#f.addStep(category.CheckCGentooCiProject())
+f.addStep(category.CheckCGentooCiProject())
 # if package in db
 #   return package_data
 #   add check package path step at end

diff --git a/buildbot_gentoo_ci/db/categorys.py 
b/buildbot_gentoo_ci/db/categorys.py
new file mode 100644
index 000..f2bfde4
--- /dev/null
+++ b/buildbot_gentoo_ci/db/categorys.py
@@ -0,0 +1,76 @@
+# This file has parts from Buildbot and is modifyed by Gentoo Authors. 
+# Buildbot is free software: you can redistribute it and/or modify it 
+# under the terms of the GNU General Public License as published by the 
+# Free Software Foundation, version 2.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+# details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this program; if not, write to the Free Software Foundation, Inc., 51
+# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Copyright Buildbot Team Members
+# Origins: buildbot.db.*
+# Modifyed by Gentoo Authors.
+# Copyright 2021 Gentoo Authors
+
+import uuid
+import sqlalchemy as sa
+
+from twisted.internet import defer
+
+from buildbot.db import base
+
+class CategorysConnectorComponent(base.DBConnectorComponent):
+
+@defer.inlineCallbacks
+def getCategoryByName(self, name):
+def thd(conn):
+tbl = self.db.model.categorys
+q = tbl.select()
+q = q.where(tbl.c.name == name)
+res = conn.execute(q)
+row = res.fetchone()
+if not row:
+return None
+return self._row2dict(conn, row)
+res = yield self.db.pool.do(thd)
+return res
+
+@defer.inlineCallbacks
+def getCategoryByUuid(self, uuid):
+def thd(conn):
+tbl = self.db.model.categorys
+q = tbl.select()
+q = q.where(tbl.c.uuid == uuid)
+res = conn.execute(q)
+row = res.fetchone()
+if not row:
+return None
+return self._row2dict(conn, row)
+res = yield self.db.pool.do(thd)
+return res
+
+@defer.inlineCallbacks
+def addCategory(self, name):
+def thd(conn, no_recurse=False):
+try:
+tbl = self.db.model.categorys
+q = tbl.insert()
+r = conn.execute(q, dict(name=name))
+except (sa.exc.IntegrityError, sa.exc.ProgrammingError):
+uuid = None
+else:
+uuid = r.inserted_primary_key[0]
+return uuid
+res = yield self.db.pool.do(thd)
+return res
+
+def _row2dict(self, conn, row):
+return dict(
+uuid=row.uuid,
+name=row.name
+)

diff --git a/buildbot_gentoo_ci/db/connector.py 
b/buildbot_gentoo_ci/db/connector.py
index f95a121..c10fc49 100644
--- a/buildbot_gentoo_ci/db/connector.py
+++ b/buildbot_gentoo_ci/db/connector.py
@@ -32,6 +32,7 @@ from buildbot.util import service
 from buildbot_gentoo_ci.db import model
 from buildbot_gentoo_ci.db import projects
 from buildbot_gentoo_ci.db import repositorys
+from buildbot_gentoo_ci.db import categorys
 
 upgrade_message = textwrap.dedent("""\
 
@@ -73,6 +74,7 @@ class DBConnector(service.ReconfigurableServiceMixin,
 self.model = model.Model(self)
 self.proje