commit:     b41ba1f170af399a151f92988d3f3e603a8079d5
Author:     Matthew Thode <prometheanfire <AT> gentoo <DOT> org>
AuthorDate: Tue May  2 00:18:55 2023 +0000
Commit:     Matthew Thode <prometheanfire <AT> gentoo <DOT> org>
CommitDate: Tue May  2 00:19:51 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b41ba1f1

dev-util/gertty: enable support for sqlalchemy-2

manual patch til upstream merges the 'fix'

Signed-off-by: Matthew Thode <prometheanfire <AT> gentoo.org>

 dev-util/gertty/files/sqlalchemy-2.patch | 116 +++++++++++++++++++++++++++++++
 dev-util/gertty/gertty-9999.ebuild       |   3 +
 2 files changed, 119 insertions(+)

diff --git a/dev-util/gertty/files/sqlalchemy-2.patch 
b/dev-util/gertty/files/sqlalchemy-2.patch
new file mode 100644
index 000000000000..b1f8891223e9
--- /dev/null
+++ b/dev-util/gertty/files/sqlalchemy-2.patch
@@ -0,0 +1,116 @@
+From 50b3b11ef9c30d4923c82949c66dc6fe3ed0047a Mon Sep 17 00:00:00 2001
+From: Matthew Thode <[email protected]>
+Date: Tue, 11 Apr 2023 23:46:27 -0500
+Subject: [PATCH] make gertty work with sqlalchemy-2
+
+Change-Id: I80c007af86cd7102c3c75963ad5b0a051dd9b541
+Signed-off-by: Matthew Thode <[email protected]>
+---
+ gertty/db.py | 41 +++++++++++++++++++++--------------------
+ 1 file changed, 21 insertions(+), 20 deletions(-)
+
+diff --git a/gertty/db.py b/gertty/db.py
+index 92cc278..82cffaa 100644
+--- a/gertty/db.py
++++ b/gertty/db.py
+@@ -25,11 +25,12 @@ import six
+ import sqlalchemy
+ from sqlalchemy import create_engine, MetaData, Table, Column, Integer, 
String, Boolean, DateTime, Text, UniqueConstraint
+ from sqlalchemy.schema import ForeignKey
+-from sqlalchemy.orm import mapper, sessionmaker, relationship, 
scoped_session, joinedload
++from sqlalchemy.orm import registry, sessionmaker, relationship, 
scoped_session, joinedload
+ from sqlalchemy.orm.session import Session
+ from sqlalchemy.sql import exists
+ from sqlalchemy.sql.expression import and_
+ 
++mapper = registry()
+ metadata = MetaData()
+ project_table = Table(
+     'project', metadata,
+@@ -713,8 +714,8 @@ class Check(object):
+         self.created = created
+         self.updated = updated
+ 
+-mapper(Account, account_table)
+-mapper(Project, project_table, properties=dict(
++mapper.map_imperatively(Account, account_table)
++mapper.map_imperatively(Project, project_table, properties=dict(
+     branches=relationship(Branch, backref='project',
+                           order_by=branch_table.c.name,
+                           cascade='all, delete-orphan'),
+@@ -740,16 +741,16 @@ mapper(Project, project_table, properties=dict(
+                               order_by=change_table.c.number,
+                           ),
+ ))
+-mapper(Branch, branch_table)
+-mapper(Topic, topic_table, properties=dict(
++mapper.map_imperatively(Branch, branch_table)
++mapper.map_imperatively(Topic, topic_table, properties=dict(
+     projects=relationship(Project,
+                           secondary=project_topic_table,
+                           order_by=project_table.c.name,
+                           viewonly=True),
+     project_topics=relationship(ProjectTopic),
+ ))
+-mapper(ProjectTopic, project_topic_table)
+-mapper(Change, change_table, properties=dict(
++mapper.map_imperatively(ProjectTopic, project_topic_table)
++mapper.map_imperatively(Change, change_table, properties=dict(
+         owner=relationship(Account),
+         conflicts1=relationship(Change,
+                                 secondary=change_conflict_table,
+@@ -787,7 +788,7 @@ mapper(Change, change_table, properties=dict(
+                                      order_by=(approval_table.c.category,
+                                                approval_table.c.value))
+         ))
+-mapper(Revision, revision_table, properties=dict(
++mapper.map_imperatively(Revision, revision_table, properties=dict(
+         messages=relationship(Message, backref='revision',
+                               cascade='all, delete-orphan'),
+         files=relationship(File, backref='revision',
+@@ -798,9 +799,9 @@ mapper(Revision, revision_table, properties=dict(
+                             cascade='all, delete-orphan'),
+ 
+         ))
+-mapper(Message, message_table, properties=dict(
++mapper.map_imperatively(Message, message_table, properties=dict(
+         author=relationship(Account)))
+-mapper(File, file_table, properties=dict(
++mapper.map_imperatively(File, file_table, properties=dict(
+        comments=relationship(Comment, backref='file',
+                              order_by=(comment_table.c.line,
+                                        comment_table.c.created),
+@@ -812,20 +813,20 @@ mapper(File, file_table, properties=dict(
+                                              comment_table.c.created)),
+        ))
+ 
+-mapper(Comment, comment_table, properties=dict(
++mapper.map_imperatively(Comment, comment_table, properties=dict(
+         author=relationship(Account)))
+-mapper(Label, label_table)
+-mapper(PermittedLabel, permitted_label_table)
+-mapper(Approval, approval_table, properties=dict(
++mapper.map_imperatively(Label, label_table)
++mapper.map_imperatively(PermittedLabel, permitted_label_table)
++mapper.map_imperatively(Approval, approval_table, properties=dict(
+         reviewer=relationship(Account)))
+-mapper(PendingCherryPick, pending_cherry_pick_table)
+-mapper(SyncQuery, sync_query_table)
+-mapper(Hashtag, hashtag_table)
+-mapper(Server, server_table, properties=dict(
++mapper.map_imperatively(PendingCherryPick, pending_cherry_pick_table)
++mapper.map_imperatively(SyncQuery, sync_query_table)
++mapper.map_imperatively(Hashtag, hashtag_table)
++mapper.map_imperatively(Server, server_table, properties=dict(
+     own_account=relationship(Account)
+     ))
+-mapper(Checker, checker_table)
+-mapper(Check, check_table, properties=dict(
++mapper.map_imperatively(Checker, checker_table)
++mapper.map_imperatively(Check, check_table, properties=dict(
+     checker=relationship(Checker)))
+ 
+ 
+-- 
+2.39.2
+

diff --git a/dev-util/gertty/gertty-9999.ebuild 
b/dev-util/gertty/gertty-9999.ebuild
index 99f28ea8c61b..1c4077d597a8 100644
--- a/dev-util/gertty/gertty-9999.ebuild
+++ b/dev-util/gertty/gertty-9999.ebuild
@@ -21,6 +21,9 @@ LICENSE="Apache-2.0"
 SLOT="0"
 IUSE=""
 
+# needed til upstream merges 
https://review.opendev.org/c/ttygroup/gertty/+/880123
+PATCHES="${FILESDIR}/sqlalchemy-2.patch"
+
 DEPEND=">=dev-python/pbr-0.11[${PYTHON_USEDEP}]"
 RDEPEND="
        >=dev-python/pbr-0.11[${PYTHON_USEDEP}]

Reply via email to