forked from pool/matrix-synapse
- Update to 1.112.0
The actual security fix will be in the python3x-Twisted package: OBS-URL: https://build.opensuse.org/package/show/network:messaging:matrix/matrix-synapse?expand=0&rev=329
This commit is contained in:
commit
b11cc65954
23
.gitattributes
vendored
Normal file
23
.gitattributes
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
## Default LFS
|
||||
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||
*.bsp filter=lfs diff=lfs merge=lfs -text
|
||||
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.gem filter=lfs diff=lfs merge=lfs -text
|
||||
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||
*.jar filter=lfs diff=lfs merge=lfs -text
|
||||
*.lz filter=lfs diff=lfs merge=lfs -text
|
||||
*.lzma filter=lfs diff=lfs merge=lfs -text
|
||||
*.obscpio filter=lfs diff=lfs merge=lfs -text
|
||||
*.oxt filter=lfs diff=lfs merge=lfs -text
|
||||
*.pdf filter=lfs diff=lfs merge=lfs -text
|
||||
*.png filter=lfs diff=lfs merge=lfs -text
|
||||
*.rpm filter=lfs diff=lfs merge=lfs -text
|
||||
*.tbz filter=lfs diff=lfs merge=lfs -text
|
||||
*.tbz2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||
*.ttf filter=lfs diff=lfs merge=lfs -text
|
||||
*.txz filter=lfs diff=lfs merge=lfs -text
|
||||
*.whl filter=lfs diff=lfs merge=lfs -text
|
||||
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||
*.zst filter=lfs diff=lfs merge=lfs -text
|
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
.osc
|
71
10719-Fix-instert-of-duplicate-key-into-event_json.patch
Normal file
71
10719-Fix-instert-of-duplicate-key-into-event_json.patch
Normal file
@ -0,0 +1,71 @@
|
||||
From d8917666d6198873bca140c3c511ae230ee698ec Mon Sep 17 00:00:00 2001
|
||||
From: Jan Zerebecki <jan.suse@zerebecki.de>
|
||||
Date: Mon, 30 Aug 2021 17:31:31 +0200
|
||||
Subject: [PATCH] Fix instert of duplicate key into event_json
|
||||
|
||||
When an incoming event id is present in event_json but not in events
|
||||
synapse fails trying to insert it with "psycopg2.errors.UniqueViolation:
|
||||
duplicate key value violates unique constraints", because it is only
|
||||
filtered based on those that are in events.
|
||||
|
||||
I don't know why those become out of sync, but this happening was
|
||||
reported by others before.
|
||||
|
||||
Fix this by using an upsert (which inserts or updates existing records)
|
||||
instead of a normal insert.
|
||||
|
||||
Please verify that this is the safe and correct thing to do before
|
||||
merging this. Verify e.g. that it doesn't allow breaking history
|
||||
integrity or something like it. As I don't know enough to understand
|
||||
what this change entails.
|
||||
|
||||
Fixes: https://github.com/matrix-org/synapse/issues/10718
|
||||
Signed-off-by: Jan Zerebecki <jan.suse@zerebecki.de>
|
||||
---
|
||||
changelog.d/10719.bugfix | 1 +
|
||||
synapse/storage/databases/main/events.py | 22 +++++++++++-----------
|
||||
2 files changed, 12 insertions(+), 11 deletions(-)
|
||||
create mode 100644 changelog.d/10719.bugfix
|
||||
|
||||
diff --git a/changelog.d/10719.bugfix b/changelog.d/10719.bugfix
|
||||
new file mode 100644
|
||||
index 00000000000..d928f74f6bf
|
||||
--- /dev/null
|
||||
+++ b/changelog.d/10719.bugfix
|
||||
@@ -0,0 +1 @@
|
||||
+Fix instert failure because of duplicate key when an incoming event id is present in the table event_json but not in events.
|
||||
diff --git a/synapse/storage/databases/main/events.py b/synapse/storage/databases/main/events.py
|
||||
index 40b53274fb3..830af72d5e6 100644
|
||||
--- a/synapse/storage/databases/main/events.py
|
||||
+++ b/synapse/storage/databases/main/events.py
|
||||
@@ -1334,19 +1334,19 @@ def get_internal_metadata(event):
|
||||
|
||||
return im
|
||||
|
||||
- self.db_pool.simple_insert_many_txn(
|
||||
+ self.db_pool.simple_upsert_many_txn(
|
||||
txn,
|
||||
table="event_json",
|
||||
- values=[
|
||||
- {
|
||||
- "event_id": event.event_id,
|
||||
- "room_id": event.room_id,
|
||||
- "internal_metadata": json_encoder.encode(
|
||||
- get_internal_metadata(event)
|
||||
- ),
|
||||
- "json": json_encoder.encode(event_dict(event)),
|
||||
- "format_version": event.format_version,
|
||||
- }
|
||||
+ key_names=["event_id"],
|
||||
+ key_values=[[event.event_id] for event, _ in events_and_contexts],
|
||||
+ value_names=["room_id", "internal_metadata", "json", "format_version"],
|
||||
+ value_values=[
|
||||
+ [
|
||||
+ event.room_id,
|
||||
+ json_encoder.encode(get_internal_metadata(event)),
|
||||
+ json_encoder.encode(event_dict(event)),
|
||||
+ event.format_version,
|
||||
+ ]
|
||||
for event, _ in events_and_contexts
|
||||
],
|
||||
)
|
8
README.SUSE
Normal file
8
README.SUSE
Normal file
@ -0,0 +1,8 @@
|
||||
README.SUSE
|
||||
-------------
|
||||
|
||||
Bootstrapping a server
|
||||
========================
|
||||
|
||||
/usr/sbin/matrix-synapse-generate-config servername
|
||||
|
3
_multibuild
Normal file
3
_multibuild
Normal file
@ -0,0 +1,3 @@
|
||||
<multibuild>
|
||||
<package>matrix-synapse-test</package>
|
||||
</multibuild>
|
31
_service
Normal file
31
_service
Normal file
@ -0,0 +1,31 @@
|
||||
<services>
|
||||
<service name="obs_scm" mode="manual">
|
||||
<param name="filename">matrix-synapse</param>
|
||||
<param name="versionformat">@PARENT_TAG@</param>
|
||||
<param name="url">https://github.com/element-hq/synapse.git</param>
|
||||
<param name="scm">git</param>
|
||||
<param name="revision">v1.112.0</param>
|
||||
<param name="versionrewrite-pattern">v(.*)</param>
|
||||
<param name="versionrewrite-replacement">\1</param>
|
||||
<!--
|
||||
<param name="revision">v1.113.0rc1</param>
|
||||
<param name="versionrewrite-pattern">v([\.\d]+)(rc.*)</param>
|
||||
<param name="versionrewrite-replacement">\1~\2</param>
|
||||
-->
|
||||
</service>
|
||||
<service name="cargo_vendor" mode="manual">
|
||||
<param name="srcdir">synapse</param>
|
||||
<!--
|
||||
<param name="update">true</param>
|
||||
-->
|
||||
</service>
|
||||
<service name="cargo_audit" mode="manual">
|
||||
<param name="srcdir">synapse</param>
|
||||
</service>
|
||||
<service name="set_version" mode="manual"/>
|
||||
<service name="tar" mode="buildtime"/>
|
||||
<service name="recompress" mode="buildtime">
|
||||
<param name="compression">xz</param>
|
||||
<param name="file">*.tar</param>
|
||||
</service>
|
||||
</services>
|
13
bump-dependencies.patch
Normal file
13
bump-dependencies.patch
Normal file
@ -0,0 +1,13 @@
|
||||
Index: synapse/pyproject.toml
|
||||
===================================================================
|
||||
--- synapse.orig/pyproject.toml
|
||||
+++ synapse/pyproject.toml
|
||||
@@ -190,7 +190,7 @@ pymacaroons = ">=0.13.0"
|
||||
msgpack = ">=0.5.2"
|
||||
phonenumbers = ">=8.2.0"
|
||||
# we use GaugeHistogramMetric, which was added in prom-client 0.4.0.
|
||||
-prometheus-client = ">=0.4.0"
|
||||
+prometheus-client = ">=0.13.1"
|
||||
# we use `order`, which arrived in attrs 19.2.0.
|
||||
# Note: 21.1.0 broke `/sync`, see https://github.com/matrix-org/synapse/issues/9936
|
||||
attrs = ">=19.2.0,!=21.1.0"
|
3
matrix-synapse-1.111.0.obscpio
Normal file
3
matrix-synapse-1.111.0.obscpio
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:f9752a3658adfb2eeec225a3f5f4a61b055c345bc28416cb86a1299a461838fe
|
||||
size 37170701
|
3
matrix-synapse-1.112.0.obscpio
Normal file
3
matrix-synapse-1.112.0.obscpio
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:1d0ac72c80abe374740683f0af068b45baa067a102ae9deaf0f324d20b375f31
|
||||
size 37371405
|
61
matrix-synapse-1.4.1-paths.patch
Normal file
61
matrix-synapse-1.4.1-paths.patch
Normal file
@ -0,0 +1,61 @@
|
||||
Index: synapse/contrib/example_log_config.yaml
|
||||
===================================================================
|
||||
--- synapse.orig/contrib/example_log_config.yaml
|
||||
+++ synapse/contrib/example_log_config.yaml
|
||||
@@ -26,7 +26,7 @@ handlers:
|
||||
file:
|
||||
class: logging.handlers.RotatingFileHandler
|
||||
formatter: fmt
|
||||
- filename: /var/log/synapse/homeserver.log
|
||||
+ filename: /var/log/matrix-synapse/homeserver.log
|
||||
maxBytes: 100000000
|
||||
backupCount: 3
|
||||
filters: [context]
|
||||
Index: synapse/synapse/config/key.py
|
||||
===================================================================
|
||||
--- synapse.orig/synapse/config/key.py
|
||||
+++ synapse/synapse/config/key.py
|
||||
@@ -110,7 +110,7 @@ class KeyConfig(Config):
|
||||
signing_key_path = config.get("signing_key_path")
|
||||
if signing_key_path is None:
|
||||
signing_key_path = os.path.join(
|
||||
- config_dir_path, config["server_name"] + ".signing.key"
|
||||
+ '/etc/matrix-synapse/keys.d', config["server_name"] + ".signing.key"
|
||||
)
|
||||
|
||||
self.signing_key = self.read_signing_keys(signing_key_path, "signing_key")
|
||||
@@ -183,7 +183,7 @@ class KeyConfig(Config):
|
||||
generate_secrets: bool = False,
|
||||
**kwargs: Any,
|
||||
) -> str:
|
||||
- base_key_name = os.path.join(config_dir_path, server_name)
|
||||
+ base_key_name = os.path.join('/etc/matrix-synapse/keys.d', server_name)
|
||||
macaroon_secret_key = ""
|
||||
form_secret = ""
|
||||
|
||||
Index: synapse/synapse/config/logger.py
|
||||
===================================================================
|
||||
--- synapse.orig/synapse/config/logger.py
|
||||
+++ synapse/synapse/config/logger.py
|
||||
@@ -149,7 +149,7 @@ class LoggingConfig(Config):
|
||||
def generate_config_section(
|
||||
self, config_dir_path: str, server_name: str, **kwargs: Any
|
||||
) -> str:
|
||||
- log_config = os.path.join(config_dir_path, server_name + ".log.config")
|
||||
+ log_config = os.path.join('/etc/matrix-synapse/', server_name + ".log.config")
|
||||
return (
|
||||
"""\
|
||||
log_config: "%(log_config)s"
|
||||
Index: synapse/synapse/config/server.py
|
||||
===================================================================
|
||||
--- synapse.orig/synapse/config/server.py
|
||||
+++ synapse/synapse/config/server.py
|
||||
@@ -793,7 +793,7 @@ class ServerConfig(Config):
|
||||
bind_port = 8448
|
||||
unsecure_port = 8008
|
||||
|
||||
- pid_file = os.path.join(data_dir_path, "homeserver.pid")
|
||||
+ pid_file = os.path.join("/run/matrix-synapse", "homeserver.pid")
|
||||
|
||||
secure_listeners = []
|
||||
unsecure_listeners = []
|
14
matrix-synapse-generate-config.sh
Normal file
14
matrix-synapse-generate-config.sh
Normal file
@ -0,0 +1,14 @@
|
||||
#!/bin/bash
|
||||
CONFDIR="/etc/matrix-synapse"
|
||||
DATADIR="/var/lib/matrix-synapse"
|
||||
/usr/bin/python3 \
|
||||
-m synapse.app.homeserver \
|
||||
--config-path ${CONFDIR}/homeserver.yaml \
|
||||
--config-directory="${CONFDIR}/conf.d/" \
|
||||
--data-directory="${DATADIR}" \
|
||||
--generate-config \
|
||||
--generate-keys \
|
||||
--report-stats=no \
|
||||
--server-name $@
|
||||
chown -R root:synapse "${CONFDIR}"
|
||||
chmod -R u=rwX,g=rX,o= "${CONFDIR}"
|
68
matrix-synapse-test.spec
Normal file
68
matrix-synapse-test.spec
Normal file
@ -0,0 +1,68 @@
|
||||
#
|
||||
# spec file for package matrix-synapse-test
|
||||
#
|
||||
# Copyright (c) 2024 SUSE LLC
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
# upon. The license for this file, and modifications and additions to the
|
||||
# file, is the same license as for the pristine package itself (unless the
|
||||
# license for the pristine package is not an Open Source License, in which
|
||||
# case the license is the MIT License). An "Open Source License" is a
|
||||
# license that conforms to the Open Source Definition (Version 1.9)
|
||||
# published by the Open Source Initiative.
|
||||
|
||||
# Please submit bugfixes or comments via https://bugs.opensuse.org/
|
||||
#
|
||||
|
||||
|
||||
# synapse only supports python >= 3.5, which is not available on pre-15 Leap.
|
||||
# However, future versions of matrix-synapse will no longer support python2 and
|
||||
# continued use of python2 is not recommended, so we only use the primary
|
||||
# python3 flavor. As a result, at no point do we have two versions of the
|
||||
# matrix-synapse package.
|
||||
|
||||
# Disable debug packages since we're not installing anything.
|
||||
%define debug_package %{nil}
|
||||
|
||||
%define pkgname matrix-synapse
|
||||
Name: %{pkgname}-test
|
||||
Version: 1.112.0
|
||||
Release: 0
|
||||
Summary: Test package for %{pkgname}
|
||||
License: AGPL-3.0-or-later
|
||||
BuildRequires: %{pkgname} == %{version}
|
||||
|
||||
%description
|
||||
.
|
||||
|
||||
%prep
|
||||
touch %{_sourcedir}/%{pkgname}
|
||||
|
||||
%build
|
||||
|
||||
%install
|
||||
|
||||
%check
|
||||
|
||||
# Following tests disabled which would need to be run as 'synapse' user which
|
||||
# we can not do easily (or at all) within RPM
|
||||
# Generate a sample config.
|
||||
#python3 -m synapse.app.homeserver \
|
||||
# --generate-config \
|
||||
# --server localhost \
|
||||
# --config-path dummy-homeserver.yaml \
|
||||
# --report-stats no
|
||||
|
||||
# Start synapse and try to register a user (basic smoke-test).
|
||||
# register_new_matrix_user doesn't seem to work inside check so we have to
|
||||
# manually run the module.
|
||||
#synctl start dummy-homeserver.yaml
|
||||
#sleep 2s
|
||||
#python3 -m synapse._scripts.register_new_matrix_user \
|
||||
# http://localhost:8008 \
|
||||
# --config dummy-homeserver.yaml \
|
||||
# --admin --user opensuse --password opensuse
|
||||
#synctl stop dummy-homeserver.yaml
|
||||
|
||||
%changelog
|
2
matrix-synapse-user.conf
Normal file
2
matrix-synapse-user.conf
Normal file
@ -0,0 +1,2 @@
|
||||
# Type Name ID GECOS [HOME]
|
||||
u synapse - "Matrix Synapse" /var/lib/matrix-synapse
|
12284
matrix-synapse.changes
Normal file
12284
matrix-synapse.changes
Normal file
File diff suppressed because it is too large
Load Diff
4
matrix-synapse.obsinfo
Normal file
4
matrix-synapse.obsinfo
Normal file
@ -0,0 +1,4 @@
|
||||
name: matrix-synapse
|
||||
version: 1.112.0
|
||||
mtime: 1722356649
|
||||
commit: 37f9876ccfdd9963cda4ff802882b9eec037877a
|
21
matrix-synapse.service
Normal file
21
matrix-synapse.service
Normal file
@ -0,0 +1,21 @@
|
||||
[Unit]
|
||||
Description=Synapse Matrix homeserver
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
SyslogIdentifier=matrix-synapse
|
||||
Restart=on-failure
|
||||
RestartSec=3
|
||||
|
||||
User=synapse
|
||||
Group=synapse
|
||||
WorkingDirectory=/var/lib/matrix-synapse
|
||||
|
||||
ExecStart=@PYTHON_FLAVOR@ -m synapse.app.homeserver --config-path=/etc/matrix-synapse/homeserver.yaml --config-path=/etc/matrix-synapse/conf.d/
|
||||
|
||||
# Adjust the cache factor if necessary.
|
||||
#Environment=SYNAPSE_CACHE_FACTOR=2.0
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
403
matrix-synapse.spec
Normal file
403
matrix-synapse.spec
Normal file
@ -0,0 +1,403 @@
|
||||
#
|
||||
# spec file for package matrix-synapse
|
||||
#
|
||||
# Copyright (c) 2024 SUSE LLC
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
# upon. The license for this file, and modifications and additions to the
|
||||
# file, is the same license as for the pristine package itself (unless the
|
||||
# license for the pristine package is not an Open Source License, in which
|
||||
# case the license is the MIT License). An "Open Source License" is a
|
||||
# license that conforms to the Open Source Definition (Version 1.9)
|
||||
# published by the Open Source Initiative.
|
||||
|
||||
# Please submit bugfixes or comments via https://bugs.opensuse.org/
|
||||
#
|
||||
|
||||
|
||||
%bcond_without use_poetry_for_dependencies
|
||||
|
||||
# NOTE: Keep this is in the same order as pyproject.toml.
|
||||
%if %{with use_poetry_for_dependencies}
|
||||
%global Jinja2_version 3.1.4
|
||||
%global Pillow_version 10.4.0
|
||||
%global PyYAML_version 6.0.1
|
||||
%global attrs_version 23.2.0
|
||||
%global bcrypt_version 4.1.3
|
||||
%global bleach_version 6.1.0
|
||||
%global canonicaljson_version 2.0.0
|
||||
%global cryptography_version 42.0.8
|
||||
%global immutabledict_version 4.2.0
|
||||
%global idna_version 3.7
|
||||
%global ijson_version 3.3.0
|
||||
%global jsonschema_version 4.20.0
|
||||
%global matrix_common_version 1.3.0
|
||||
%global matrix_common_max_version 2
|
||||
# TODO 1.0.8
|
||||
%global msgpack_version 1.0.7
|
||||
# TODO 1.3.0
|
||||
%global netaddr_version 1.2.1
|
||||
%global phonenumbers_version 8.13.39
|
||||
%global prometheus_client_version 0.20.0
|
||||
%global psutil_version 2.0.0
|
||||
# todo: 24.2.1
|
||||
%global pyOpenSSL_version 24.1.0
|
||||
%global pyasn1_version 0.6.0
|
||||
%global pyasn1_modules_version 0.3.0
|
||||
%global pymacaroons_version 0.13.0
|
||||
%global service_identity_version 24.1.0
|
||||
%global signedjson_version 1.1.4
|
||||
%global signedjson_max_version 2
|
||||
%global sortedcontainers_version 2.4.0
|
||||
%global systemd_version 235
|
||||
%global typing_extensions_version 4.1.1
|
||||
%global treq_version 23.11.0
|
||||
%global unpaddedbase64_version 2.1.0
|
||||
%global matrix_synapse_ldap3_version 0.3.0
|
||||
%global packaging_version 24.0
|
||||
%global psycopg2_version 2.9.9
|
||||
%global pysaml2_version 7.3.1
|
||||
%global Authlib_version 1.3.1
|
||||
%global lxml_version 5.2.2
|
||||
%global sentry_sdk_version 2.10.0
|
||||
%global PyJWT_version 2.6.0
|
||||
%global jaeger_client_version 4.8.0
|
||||
%global opentracing_version 2.4.0
|
||||
# todo: 3.0.0
|
||||
%global hiredis_version 2.3.2
|
||||
%global txredisapi_version 1.4.10
|
||||
%global Pympler_version 1.0.1
|
||||
%global pydantic_version 2.7.1
|
||||
%global pyicu_version 2.13.1
|
||||
%global python_multipart_version 0.0.9
|
||||
%else
|
||||
# some version locks based on poetry.lock
|
||||
%global Jinja2_version 3.0
|
||||
%global Pillow_version 10.0.1
|
||||
%global PyYAML_version 3.13
|
||||
%global Twisted_version 18.9.0
|
||||
%global attrs_version 21.1.1
|
||||
%global bcrypt_version 3.1.7
|
||||
%global bleach_version 1.4.3
|
||||
%global canonicaljson_version 2.0.0
|
||||
%global cryptography_version 3.4.7
|
||||
%global immutabledict_version 2.0
|
||||
%global idna_version 2.5
|
||||
%global ijson_version 3.2.0
|
||||
%global jsonschema_version 3.0.0
|
||||
%global matrix_common_version 1.3.0
|
||||
%global matrix_common_max_version 2
|
||||
%global msgpack_version 0.5.2
|
||||
%global netaddr_version 0.7.18
|
||||
%global phonenumbers_version 8.13.37
|
||||
%global prometheus_client_version 0.4.0
|
||||
%global psutil_version 2.0.0
|
||||
%global pyOpenSSL_version 16.0.0
|
||||
%global pyasn1_version 0.1.9
|
||||
%global pyasn1_modules_version 0.0.7
|
||||
%global pymacaroons_version 0.13.0
|
||||
%global service_identity_version 18.1.0
|
||||
%global signedjson_version 1.1.0
|
||||
%global signedjson_max_version 2
|
||||
%global sortedcontainers_version 1.5.2
|
||||
%global systemd_version 231
|
||||
%global typing_extensions_version 3.10.0
|
||||
%global treq_version 15.1
|
||||
%global unpaddedbase64_version 2.1.0
|
||||
%global matrix_synapse_ldap3_version 0.2.1
|
||||
%global packaging_version 20.0
|
||||
%global psycopg2_version 2.8
|
||||
%global pysaml2_version 4.5.0
|
||||
%global Authlib_version 0.15.1
|
||||
%global lxml_version 4.8.0
|
||||
%global sentry_sdk_version 1.5.11
|
||||
%global PyJWT_version 1.6.4
|
||||
%global jaeger_client_version 4.0.0
|
||||
%global opentracing_version 2.2.0
|
||||
%global hiredis_version 2.0.0
|
||||
%global txredisapi_version 1.4.7
|
||||
%global Pympler_version 1.0.1
|
||||
%global pydantic_version 1.7.4
|
||||
%global pyicu_version 2.10.2
|
||||
%global python_multipart_version 0.0.9
|
||||
%endif
|
||||
|
||||
%define requires_peq() %(echo '%*' | LC_ALL=C xargs -r rpm -q --whatprovides --qf 'Requires: %%{name} = %%{epoch}:%%{version}\\n' | sed -e 's/ (none):/ /' -e 's/ 0:/ /' | grep -v "is not")
|
||||
|
||||
%define use_python python3
|
||||
|
||||
%define pythons %{use_python}
|
||||
|
||||
# These come from matrix-synapse's CONDITIONAL_REQUIREMENTS.
|
||||
# missing deps
|
||||
%if 0%{?suse_version} >= 1550
|
||||
%bcond_without synapse_oidc
|
||||
%else
|
||||
%bcond_with synapse_oidc
|
||||
%endif
|
||||
%bcond_with synapse_redis
|
||||
%bcond_with synapse_opentracing
|
||||
%bcond_with synapse_sentry
|
||||
# matrix-synapse-ldap isn't packaged on openSUSE.
|
||||
%bcond_with synapse_ldap
|
||||
|
||||
## Package updates
|
||||
#
|
||||
# * Update version in _service to the most recent released one
|
||||
# * Call `osc service dr`
|
||||
# * Update changelog manually from
|
||||
# https://github.com/matrix-org/synapse/releases or synapse/CHANGES.md
|
||||
# * Commit+submit
|
||||
|
||||
%define modname synapse
|
||||
%define pkgname matrix-synapse
|
||||
%define eggname matrix_synapse
|
||||
Name: %{pkgname}
|
||||
Version: 1.112.0
|
||||
Release: 0
|
||||
Summary: Matrix protocol reference homeserver
|
||||
License: AGPL-3.0-or-later
|
||||
Group: Productivity/Networking/Instant Messenger
|
||||
URL: https://github.com/element-hq/synapse
|
||||
Source0: %{pkgname}-%{version}.tar.xz
|
||||
Source1: vendor.tar.zst
|
||||
Source47: matrix-synapse-user.conf
|
||||
Source48: README.SUSE
|
||||
Source49: matrix-synapse.tmpfiles.d
|
||||
Source50: %{pkgname}.service
|
||||
Source51: matrix-synapse-generate-config.sh
|
||||
# track series file so we can easily use quilt
|
||||
# cd synapse ; ln -s .. patches ; quilt push -a
|
||||
# to clean up your working copy afterwards: git reset --hard ; rm -rv .pc patches
|
||||
Source99: series
|
||||
Patch0: matrix-synapse-1.4.1-paths.patch
|
||||
Patch1: bump-dependencies.patch
|
||||
# https://github.com/matrix-org/synapse/pull/10719
|
||||
# disable by marking as source until we get a decision upstream
|
||||
Source100: 10719-Fix-instert-of-duplicate-key-into-event_json.patch
|
||||
BuildRequires: %{use_python}-base >= 3.8
|
||||
BuildRequires: %{use_python}-pip
|
||||
BuildRequires: %{use_python}-poetry-core >= 1.1.0
|
||||
BuildRequires: %{use_python}-setuptools
|
||||
BuildRequires: %{use_python}-wheel
|
||||
BuildRequires: cargo
|
||||
BuildRequires: fdupes
|
||||
BuildRequires: python-rpm-macros
|
||||
BuildRequires: systemd-rpm-macros
|
||||
BuildRequires: sysuser-shadow
|
||||
BuildRequires: sysuser-tools
|
||||
BuildRequires: unzip
|
||||
%{?systemd_ordering}
|
||||
%{sysusers_requires}
|
||||
%requires_peq %{use_python}-base
|
||||
BuildRequires: (%{use_python}-setuptools-rust >= 1.3 with %{use_python}-setuptools-rust =< 1.9.0)
|
||||
# NOTE: Keep this is in the same order as pyproject.toml.
|
||||
# some version locks based on poetry.lock
|
||||
BuildRequires: %{use_python}-Jinja2 >= %{Jinja2_version}
|
||||
%requires_peq %{use_python}-Jinja2
|
||||
BuildRequires: %{use_python}-Pillow >= %{Pillow_version}
|
||||
%requires_peq %{use_python}-Pillow
|
||||
BuildRequires: %{use_python}-PyYAML >= %{PyYAML_version}
|
||||
%requires_peq %{use_python}-PyYAML
|
||||
BuildRequires: %{use_python}-Twisted >= %{Twisted_version}
|
||||
%requires_peq %{use_python}-Twisted
|
||||
BuildRequires: %{use_python}-attrs >= %{attrs_version}
|
||||
%requires_peq %{use_python}-attrs
|
||||
BuildRequires: %{use_python}-bcrypt >= %{bcrypt_version}
|
||||
%requires_peq %{use_python}-bcrypt
|
||||
BuildRequires: %{use_python}-bleach >= %{bleach_version}
|
||||
%requires_peq %{use_python}-bleach
|
||||
BuildRequires: (%{use_python}-canonicaljson >= %{canonicaljson_version})
|
||||
%requires_peq %{use_python}-canonicaljson
|
||||
BuildRequires: %{use_python}-cryptography >= %{cryptography_version}
|
||||
%requires_peq %{use_python}-cryptography
|
||||
BuildRequires: (%{use_python}-immutabledict >= %{immutabledict_version})
|
||||
%requires_peq %{use_python}-immutabledict
|
||||
BuildRequires: %{use_python}-idna >= %{idna_version}
|
||||
%requires_peq %{use_python}-idna
|
||||
BuildRequires: %{use_python}-ijson >= %{ijson_version}
|
||||
%requires_peq %{use_python}-ijson
|
||||
BuildRequires: %{use_python}-jsonschema >= %{jsonschema_version}
|
||||
%requires_peq %{use_python}-jsonschema
|
||||
BuildRequires: (%{use_python}-matrix_common >= %{matrix_common_version} with %{use_python}-matrix_common < %{matrix_common_max_version})
|
||||
%requires_peq %{use_python}-matrix_common
|
||||
BuildRequires: (%{use_python}-python-multipart >= %{python_multipart_version})
|
||||
%requires_peq %{use_python}-python-multipart
|
||||
BuildRequires: %{use_python}-msgpack >= %{msgpack_version}
|
||||
%requires_peq %{use_python}-msgpack
|
||||
BuildRequires: %{use_python}-netaddr >= %{netaddr_version}
|
||||
%requires_peq %{use_python}-netaddr
|
||||
BuildRequires: %{use_python}-phonenumbers >= %{phonenumbers_version}
|
||||
%requires_peq %{use_python}-phonenumbers
|
||||
BuildRequires: %{use_python}-prometheus_client >= %{prometheus_client_version}
|
||||
%requires_peq %{use_python}-prometheus_client
|
||||
BuildRequires: %{use_python}-psutil >= %{psutil_version}
|
||||
%requires_peq %{use_python}-psutil
|
||||
BuildRequires: %{use_python}-pyOpenSSL >= %{pyOpenSSL_version}
|
||||
%requires_peq %{use_python}-pyOpenSSL
|
||||
BuildRequires: %{use_python}-pyasn1 >= %{pyasn1_version}
|
||||
%requires_peq %{use_python}-pyasn1
|
||||
BuildRequires: %{use_python}-pyasn1-modules >= %{pyasn1_modules_version}
|
||||
%requires_peq %{use_python}-pyasn1-modules
|
||||
BuildRequires: %{use_python}-pymacaroons >= %{pymacaroons_version}
|
||||
%requires_peq %{use_python}-pymacaroons
|
||||
BuildRequires: %{use_python}-service_identity >= %{service_identity_version}
|
||||
%requires_peq %{use_python}-service_identity
|
||||
BuildRequires: (%{use_python}-signedjson >= %{signedjson_version} with %{use_python}-signedjson < %{signedjson_max_version})
|
||||
%requires_peq %{use_python}-signedjson
|
||||
BuildRequires: %{use_python}-sortedcontainers >= %{sortedcontainers_version}
|
||||
%requires_peq %{use_python}-sortedcontainers
|
||||
BuildRequires: %{use_python}-systemd >= %{systemd_version}
|
||||
%requires_peq %{use_python}-systemd
|
||||
BuildRequires: %{use_python}-typing_extensions >= %{typing_extensions_version}
|
||||
%requires_peq %{use_python}-typing_extensions
|
||||
BuildRequires: %{use_python}-treq >= %{treq_version}
|
||||
%requires_peq %{use_python}-treq
|
||||
BuildRequires: %{use_python}-unpaddedbase64 >= %{unpaddedbase64_version}
|
||||
%requires_peq %{use_python}-unpaddedbase64
|
||||
# Specify all CONDITIONAL_REQUIREMENTS (we Require them to avoid no-recommends
|
||||
# breaking very commonly-used bits of matrix-synapse such as postgresql).
|
||||
%if %{with synapse_ldap}
|
||||
BuildRequires: %{use_python}-matrix-synapse-ldap3 >= %{matrix_synapse_ldap3_version}
|
||||
%requires_peq %{use_python}-matrix-synapse-ldap3
|
||||
%endif
|
||||
BuildRequires: %{use_python}-packaging >= %{packaging_version}
|
||||
%requires_peq %{use_python}-packaging
|
||||
BuildRequires: %{use_python}-pydantic >= %{pydantic_version}
|
||||
%requires_peq %{use_python}-pydantic
|
||||
BuildRequires: %{use_python}-psycopg2 >= %{psycopg2_version}
|
||||
%requires_peq %{use_python}-psycopg2
|
||||
BuildRequires: %{use_python}-pysaml2 >= %{pysaml2_version}
|
||||
%requires_peq %{use_python}-pysaml2
|
||||
%if %{with synapse_oidc}
|
||||
BuildRequires: %{use_python}-Authlib >= %{Authlib_version}
|
||||
%requires_peq %{use_python}-Authlib
|
||||
%endif
|
||||
BuildRequires: %{use_python}-lxml >= %{lxml_version}
|
||||
%requires_peq %{use_python}-lxml
|
||||
%if %{with synapse_sentry}
|
||||
BuildRequires: %{use_python}-sentry-sdk >= %{sentry_sdk_version}
|
||||
%requires_peq %{use_python}-sentry-sdk
|
||||
%endif
|
||||
%if %{with synapse_opentracing}
|
||||
BuildRequires: %{use_python}-jaeger-client >= %{jaeger_client_version}
|
||||
%requires_peq %{use_python}-jaeger-client
|
||||
BuildRequires: %{use_python}-opentracing >= %{opentracing_version}
|
||||
%requires_peq %{use_python}-opentracing
|
||||
%endif
|
||||
%if %{with synapse_redis}
|
||||
BuildRequires: %{use_python}-hiredis >= %{hiredis_version}
|
||||
%requires_peq %{use_python}-hiredis
|
||||
BuildRequires: %{use_python}-txredisapi >= %{txredisapi_version}
|
||||
%requires_peq %{use_python}-txredisapi
|
||||
%endif
|
||||
BuildRequires: %{use_python}-Pympler >= %{Pympler_version}
|
||||
%requires_peq %{use_python}-Pympler
|
||||
BuildRequires: %{use_python}-PyICU >= %{pyicu_version}
|
||||
%requires_peq %{use_python}-PyICU
|
||||
# We only provide/obsolete python2 to ensure that users upgrade.
|
||||
Obsoletes: python2-matrix-synapse < %{version}-%{release}
|
||||
Provides: python2-matrix-synapse = %{version}-%{release}
|
||||
Obsoletes: %{use_python}-matrix-synapse < %{version}-%{release}
|
||||
Provides: %{use_python}-matrix-synapse = %{version}-%{release}
|
||||
|
||||
%description
|
||||
Synapse is a Python-based reference "homeserver" implementation of
|
||||
Matrix. Matrix is a system for federated Instant Messaging and VoIP.
|
||||
|
||||
%prep
|
||||
%autosetup -p1 -a1
|
||||
|
||||
# Remove all un-needed #!-lines.
|
||||
find synapse/ -type f -not -path './vendor/**' -exec sed -i '1{/^#!/d}' {} \;
|
||||
# Replace all #!/usr/bin/env lines to use #!/usr/bin/$1 directly.
|
||||
find ./ -type f -not -path './vendor/**' -exec \
|
||||
sed -i '1s|^#!/usr/bin/env |#!/usr/bin/|' {} \;
|
||||
# Force the usage of the default python3 sys executable
|
||||
find ./ -type f -not -path './vendor/**' \
|
||||
-exec sed -i '1s|^#!/usr/bin/python.*$|#!%{__python3}|' {} \;
|
||||
|
||||
# Update the python flavour in the service file.
|
||||
sed -i 's|@PYTHON_FLAVOR@|%{__python3}|g' %{S:50}
|
||||
|
||||
%build
|
||||
%pyproject_wheel
|
||||
%sysusers_generate_pre %{SOURCE47} %{name}
|
||||
|
||||
%install
|
||||
cp %{S:48} README.SUSE
|
||||
# We install scripts into /usr/lib to avoid silly conflicts with other pkgs.
|
||||
install -d -m 0755 %{buildroot}%{_libexecdir}/%{pkgname}
|
||||
%pyproject_install
|
||||
|
||||
install -d -m 0755 %{buildroot}%{_bindir} %{buildroot}%{_libexecdir}/%{pkgname}/
|
||||
# move scripts to the old place.
|
||||
mv %{buildroot}%{_bindir}/* %{buildroot}%{_libexecdir}/%{pkgname}/
|
||||
# While we provide a systemd service, link synctl so it's simpler to use.
|
||||
ln -s %{_libexecdir}/%{pkgname}/synctl %{buildroot}%{_bindir}/synctl
|
||||
|
||||
# Install default matrix-synapse configuration.
|
||||
# TODO: Switch to the debian default config.
|
||||
install -d -m 0750 \
|
||||
%{buildroot}%{_sysconfdir}/%{pkgname}/ \
|
||||
%{buildroot}%{_sysconfdir}/%{pkgname}/{conf,keys}.d/
|
||||
install -D -m 0640 contrib/systemd/log_config.yaml %{buildroot}%{_sysconfdir}/%{pkgname}/log.yaml
|
||||
install -D -m 0640 contrib/systemd/log_config.yaml %{buildroot}%{_sysconfdir}/%{pkgname}/log.systemd.yaml
|
||||
install -D -m 0640 contrib/example_log_config.yaml %{buildroot}%{_sysconfdir}/%{pkgname}/log.file.yaml
|
||||
|
||||
# Man pages.
|
||||
install -D -m 0644 -t %{buildroot}%{_mandir}/man1 debian/*.1
|
||||
|
||||
# system configuration.
|
||||
mkdir -p %{buildroot}%{_sbindir}
|
||||
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{pkgname}
|
||||
#
|
||||
install -D -m 0644 %{S:50} %{buildroot}%{_unitdir}/%{pkgname}.service
|
||||
install -D -m 0644 %{S:49} %{buildroot}%{_tmpfilesdir}/%{pkgname}.conf
|
||||
install -D -m 0644 %{SOURCE47} %{buildroot}%{_sysusersdir}/%{name}.conf
|
||||
#
|
||||
install -D -m 0755 %{S:51} %{buildroot}%{_sbindir}/matrix-synapse-generate-config
|
||||
|
||||
# User directory.
|
||||
install -d -m 0750 %{buildroot}%{_rundir}/%{pkgname}
|
||||
install -d -m 0750 %{buildroot}%{_localstatedir}/lib/%{pkgname}
|
||||
install -d -m 0750 %{buildroot}%{_localstatedir}/log/%{pkgname}
|
||||
|
||||
%fdupes %{buildroot}%{python3_sitearch}
|
||||
|
||||
%pre -f %{name}.pre
|
||||
%service_add_pre %{pkgname}.service
|
||||
|
||||
%post
|
||||
%tmpfiles_create %{_tmpfilesdir}/%{pkgname}.conf
|
||||
%service_add_post %{pkgname}.service
|
||||
|
||||
%preun
|
||||
%service_del_preun %{pkgname}.service
|
||||
|
||||
%postun
|
||||
%service_del_postun %{pkgname}.service
|
||||
|
||||
%files -n %{pkgname}
|
||||
%doc *.rst CHANGES.md README.SUSE
|
||||
%license LICENSE
|
||||
%config(noreplace) %attr(-,root,synapse) %{_sysconfdir}/%{pkgname}/
|
||||
%dir %attr(0750,%{modname},%{modname}) %{_localstatedir}/lib/%{pkgname}
|
||||
%dir %attr(0750,%{modname},%{modname}) %{_localstatedir}/log/%{pkgname}
|
||||
%{python3_sitearch}/%{modname}
|
||||
%{python3_sitearch}/%{eggname}-*-info
|
||||
# Python helper scripts.
|
||||
%{_bindir}/synctl
|
||||
%{_libexecdir}/%{pkgname}
|
||||
# systemd service.
|
||||
%{_sbindir}/rc%{pkgname}
|
||||
%{_sbindir}/matrix-synapse-generate-config
|
||||
%{_unitdir}/%{pkgname}.service
|
||||
%{_sysusersdir}/%{name}.conf
|
||||
%{_tmpfilesdir}/%{pkgname}.conf
|
||||
# Man pages.
|
||||
%{_mandir}/man*/*
|
||||
%ghost %dir %attr(750,%{modname},%{modname}) /run/matrix-synapse
|
||||
|
||||
%changelog
|
2
matrix-synapse.tmpfiles.d
Normal file
2
matrix-synapse.tmpfiles.d
Normal file
@ -0,0 +1,2 @@
|
||||
# Type Path Mode UID GID Age Argument
|
||||
d /run/matrix-synapse 0750 synapse synapse - -
|
2
series
Normal file
2
series
Normal file
@ -0,0 +1,2 @@
|
||||
matrix-synapse-1.4.1-paths.patch
|
||||
bump-dependencies.patch
|
3
vendor.tar.zst
Normal file
3
vendor.tar.zst
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:df0325c14caa2cfbf67954376cbe5b4611ffff740ba1dd39c97ff4e1364ad4bc
|
||||
size 7263419
|
Loading…
Reference in New Issue
Block a user