1
0

osc copypac from project:home:cyphar:matrix package:matrix-synapse revision:2

OBS-URL: https://build.opensuse.org/package/show/network:messaging:matrix/matrix-synapse?expand=0&rev=83
This commit is contained in:
Aleksa Sarai 2019-10-03 22:23:50 +00:00 committed by Git OBS Bridge
parent 49bcd2c968
commit 8bd8f596f5
9 changed files with 1460 additions and 104 deletions

View File

@ -1,16 +1,16 @@
<services>
<service name="tar_scm" mode="disabled">
<service name="obs_scm" mode="disabled">
<param name="filename">matrix-synapse</param>
<param name="versionformat">@PARENT_TAG@+@TAG_OFFSET@.%h</param>
<param name="versionformat">@PARENT_TAG@</param>
<param name="url">git://github.com/matrix-org/synapse.git</param>
<param name="scm">git</param>
<param name="revision">master</param>
<param name="changesgenerate">enable</param>
<param name="changesauthor">okurz@suse.com</param>
<param name="versionrewrite-pattern">v(.*)</param>
<param name="revision">v1.4.0</param>
</service>
<service name="recompress" mode="disabled">
<service name="set_version" mode="disabled"/>
<service name="tar" mode="buildtime"/>
<service name="recompress" mode="buildtime">
<param name="compression">xz</param>
<param name="file">*.tar</param>
</service>
<service name="set_version" mode="disabled"/>
</services>

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:9b051a545d3f76d9307711f9e7051f99ae8352d71c19421f612f403f13cbba4b
size 760090

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:55f7e21115fec2fe46b2f6bb12c5fb422a5b1f0966c6675ec60680d8027528f5
size 7017997

View File

71
matrix-synapse-test.spec Normal file
View File

@ -0,0 +1,71 @@
#
# spec file for package matrix-synapse-test
#
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
#
# 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 on newer distributions we
# only use python3. As a result, at no point do we have two versions of the
# matrix-synapse package.
%if 0%{?suse_version} < 1500
%define skip_python3 1
%else
%define skip_python2 1
%endif
# Disable debug packages since we're not installing anything.
%define debug_package %{nil}
%define pkgname matrix-synapse
Name: %{pkgname}-test
Version: 1.4.0
Release: 0
Summary: Test package for %{pkgname}
License: Apache-2.0
BuildRequires: %{pkgname} == %{version}
BuildRequires: python-rpm-macros
%description
.
%prep
touch %{_sourcedir}/%{pkgname}
%build
%install
%check
# Generate a sample config.
%{python_flavor} -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
%{python_flavor} -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

File diff suppressed because it is too large Load Diff

5
matrix-synapse.obsinfo Normal file
View File

@ -0,0 +1,5 @@
name: matrix-synapse
version: 1.4.0
mtime: 1570105364
commit: ecb69d824a39d420a20a1c0b24a7174cea392560

22
matrix-synapse.service Normal file
View File

@ -0,0 +1,22 @@
[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
ExecStartPre=@PYTHON_FLAVOR@ -m synapse.app.homeserver --config-path=/etc/matrix-synapse/homeserver.yaml --config-path=/etc/matrix-synapse/conf.d/ --generate-keys
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

View File

@ -1,7 +1,7 @@
#
# spec file for package matrix-synapse
#
# Copyright (c) 2017 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -12,62 +12,117 @@
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
# These come from matrix-synapse's CONDITIONAL_REQUIREMENTS.
%bcond_without email_notifs
%bcond_without ldap
%bcond_without postgres
%bcond_without saml
%bcond_without url_preview
%bcond_without jwt
# txacme is broken in openSUSE.
%bcond_with acme
# sentry-sdk isn't packaged on openSUSE.
%bcond_with sentry
## 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
# Synapse 1.1.0 and onwards only supports Python >= 3.5.
%define skip_python2 1
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define github_user matrix-org
%define short_name synapse
Name: matrix-%{short_name}
Version: 0.19.2
%define modname synapse
%define pkgname matrix-synapse
Name: %{pkgname}
Version: 1.4.0
Release: 0
Summary: Matrix protocol reference homeserver
License: Apache-2.0
Group: Productivity/Networking/Instant Messenger
Source0: matrix-synapse-0.19.2.tar.gz
Url: https://github.com/matrix-org/synapse
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: unzip
URL: https://github.com/matrix-org/synapse
Source0: %{pkgname}-%{version}.tar.xz
Source50: %{pkgname}.service
BuildRequires: %{python_module base}
BuildRequires: %{python_module psutil >= 2.0.0}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module treq >= 15.1.0}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
BuildRequires: systemd-rpm-macros
BuildRequires: unzip
%{?systemd_requires}
Requires(pre): shadow
%if 0%{?suse_version} >= 1330
# alternative: create a specific "synapse" group
Requires(pre): group(nogroup)
%ifpython3
Requires: %{python_flavor} >= 3.5
%endif
Requires: python-Twisted
Requires: python-bcrypt
Requires: python-msgpack-python
Requires: python-frozendict >= 0.4
Requires: python-unpaddedbase64 >= 1.1.0
Requires: python-canonicaljson >= 1.0.0
# NOTE: Keep this is in the same order as synapse/python_dependencie.py.
Requires: python-Pillow >= 4.3.0
Requires: python-PyNaCl >= 1.2.1
Requires: python-PyYAML >= 3.11
Requires: python-Twisted >= 18.9.0
Requires: python-attrs >= 17.4.0
Requires: python-bcrypt >= 3.1.0
Requires: python-canonicaljson >= 1.1.3
Requires: python-daemonize >= 2.3.1
Requires: python-frozendict >= 1
Requires: python-idna >= 2.5
Requires: python-jsonschema >= 2.5.1
Requires: python-msgpack >= 0.5.2
Requires: python-netaddr >= 0.7.18
Requires: python-phonenumbers >= 8.2.0
Requires: python-prometheus_client >= 0.4.0
Requires: python-psutil >= 2.0.0
Requires: python-pyOpenSSL >= 16.0.0
Requires: python-pyasn1 >= 0.1.9
Requires: python-pyasn1-modules >= 0.0.7
Requires: python-pymacaroons >= 0.13.0
Requires: python-service_identity >= 18.1.0
Requires: python-signedjson >= 1.0.0
# original from python_requirements.py
#BuildRequires: python-PyNaCl == 0.3.0
Requires: python-PyNaCl
Requires: python-service_identity >= 1.0.0
Requires: python-Twisted >= 16.0.0
Requires: python-pyOpenSSL >= 0.14
Requires: python-PyYAML
Requires: python-pyasn1
Requires: python-daemonize
Requires: python-Pillow
Requires: python-pydenticon
Requires: python-ujson
Requires: python-blist
Requires: python-pysaml2 >= 3.0.0
# original from python_requirements.py
#BuildRequires: python-pysaml2 < 4.0.0
Requires: python-pymacaroons-pynacl
Requires: python-msgpack-python >= 0.3.0
Requires(post): update-alternatives
Requires(postun): update-alternatives
BuildArch: noarch
%ifpython2
Provides: matrix-synapse = %{version}
Requires: python-six >= 1.10
Requires: python-sortedcontainers >= 1.4.4
Requires: python-treq >= 15.1
Requires: python-unpaddedbase64 >= 1.1.0
# Specify all CONDITIONAL_REQUIREMENTS (we Require them to avoid no-recommends
# breaking very commonly-used bits of matrix-synapse such as postgresql).
%if %{with email_notifs}
Requires: python-Jinja2 >= 2.9
Requires: python-bleach >= 1.4.3
%endif
%if %{with ldap}
Requires: python-matrix-synapse-ldap3 >= 0.1
%endif
%if %{with postgres}
Requires: python-psycopg2 >= 2.7
%endif
%if %{with acme}
Requires: python-txacme >= 0.9.2
%endif
%if %{with saml}
Requires: python-pysaml2 >= 4.5.0
%endif
%if %{with url_preview}
Requires: python-lxml >= 3.5.0
%endif
%if %{with sentry}
Requires: python-sentry-sdk >= 0.7.2
%endif
%if %{with jwt}
Requires: python-PyJWT >= 1.6.4
%endif
BuildArch: noarch
Provides: matrix-synapse = %{version}
# We only provide/obsolete python2 to ensure that users upgrade.
Obsoletes: python2-matrix-synapse < %{version}
Provides: python2-matrix-synapse = %{version}
%python_subpackages
@ -76,81 +131,91 @@ Synapse is a Python-based reference "homeserver" implementation of
Matrix. Matrix is a system for federated Instant Messaging and VoIP.
%prep
%setup -q -n %{short_name}-%{version}
for i in \
app/client_reader \
app/federation_sender \
app/synchrotron \
app/pusher \
app/media_repository \
app/homeserver \
app/appservice \
app/federation_reader \
push/pusherpool \
util/versionstring
do
sed -i '1d' synapse/$i.py
done
# patch the version requirement as it would be hard to supply exactly this
# version as dependency
sed -i 's/nacl==0.3.0/nacl>=0.3.0/g' synapse/python_dependencies.py
%setup -q
# Remove all un-needed #!-lines.
find synapse/ -type f -exec sed -i '1{/^#!/d}' {} \;
# Replace all #!/usr/bin/env lines to use #!/usr/bin/$1 directly.
find ./ -type f -exec \
sed -i '1s|^#!/usr/bin/env |#!/usr/bin/|' {} \;
# Force the usage of python_flavor.
find ./ -type f \
-exec sed -i '1s|^#!/usr/bin/python$|#!/usr/bin/%{python_flavor}|' {} \;
# Update the python flavour in the service file.
sed -i 's|@PYTHON_FLAVOR@|%{python_flavor}|g' %{S:50}
%build
%python_build
chmod +x build/lib/synapse/app/synctl.py
%install
%python_install
# We install scripts into /usr/lib to avoid silly conflicts with other pkgs.
install -d -m 0755 %{buildroot}%{_libexecdir}/%{pkgname}
%python_install "--install-scripts=%{_libexecdir}/%{pkgname}/"
mkdir -p "%{buildroot}%{_sysconfdir}/synapse"
install -m 0644 contrib/systemd/log_config.yaml \
"%{buildroot}%{_sysconfdir}/synapse"
# While we provide a systemd service, link synctl so it's simpler to use.
install -d -m 0755 %{buildroot}%{_bindir}
ln -s %{_libexecdir}/%{pkgname}/synctl %{buildroot}%{_bindir}/synctl
# Install default matrix-synapse configuration.
# TODO: Switch to the debian default config.
install -d -m 0755 %{buildroot}%{_sysconfdir}/%{pkgname}/conf.d
install -D -m 0644 docs/sample_config.yaml %{buildroot}%{_sysconfdir}/%{pkgname}/homeserver.yaml
install -D -m 0644 contrib/systemd/log_config.yaml %{buildroot}%{_sysconfdir}/%{pkgname}/log.yaml
# Man pages.
install -D -m 0644 -t %{buildroot}%{_mandir}/man1 debian/*.1
# Runtime-dir.
mkdir -p %{buildroot}%{_rundir}/%{pkgname}
# system configuration.
mkdir -p %{buildroot}%{_sbindir}
ln -s /usr/sbin/service %{buildroot}%{_sbindir}/rcsynapse
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{pkgname}
install -D -m 0644 contrib/systemd/%{pkgname}.service %{buildroot}%{_unitdir}/%{pkgname}.service
mkdir -p "%{buildroot}%{_unitdir}"
install -m 0644 contrib/systemd/synapse.service \
"%{buildroot}%{_unitdir}"
# User directory.
install -d -m 0755 %{buildroot}%{_rundir}/%{pkgname}
install -d -m 0750 %{buildroot}%{_localstatedir}/lib/%{pkgname}
mkdir -p "%{buildroot}%{_rundir}/synapse"
%python_expand %fdupes %{buildroot}%{$python_sitelib}
for p in hash_password register_new_matrix_user synapse_port_db synctl ; do
%python_clone -a %{buildroot}%{_bindir}/$p
done
%python_clone -a %{buildroot}%{_sbindir}/rcsynapse
%python_clone -a %{buildroot}%{_unitdir}/synapse.service
%python_clone -a %{buildroot}%{_sysconfdir}/synapse/log_config.yaml
%pre
getent group synapse >/dev/null || groupadd -r synapse
getent passwd synapse >/dev/null || \
/usr/sbin/useradd -r -g nogroup -s /sbin/nologin -c 'Matrix Synapse' \
/usr/sbin/useradd -r -g synapse -s /sbin/nologin -c 'Matrix Synapse' \
-d %{_localstatedir}/lib/synapse synapse
%service_add_pre synapse.service
%service_add_pre %{pkgname}.service
%post
%{python_install_alternative synctl hash_password register_new_matrix_user synapse_port_db rcsynapse synapse.service log_config.yaml}
%service_add_post synapse.service
%service_add_post %{pkgname}.service
%preun
%service_del_preun synapse.service
%service_del_preun %{pkgname}.service
%postun
%python_uninstall_alternative synctl
%service_del_postun synapse.service
%service_del_postun %{pkgname}.service
%if 0%{?suse_version} < 1500
%files -n %{pkgname}
%else
%files %{python_files}
%endif
%defattr(-,root,root,-)
%doc *.rst
%doc LICENSE
%dir %{_sysconfdir}/synapse
%doc *.rst CHANGES.md
%license LICENSE
%dir %{_sysconfdir}/%{pkgname}
%dir %{_sysconfdir}/%{pkgname}/conf.d
%config(noreplace) %{_sysconfdir}/%{pkgname}/*.yaml
%dir %attr(0750,%{modname},%{modname}) %{_localstatedir}/lib/%{pkgname}
%{python_sitelib}
%python_alternative %{_bindir}/hash_password
%python_alternative %{_bindir}/register_new_matrix_user
%python_alternative %{_bindir}/synapse_port_db
%python_alternative %{_bindir}/synctl
%python_alternative %{_sbindir}/rcsynapse
%python_alternative %{_unitdir}/synapse.service
%config %python_alternative %{_sysconfdir}/synapse/log_config.yaml
# Python helper scripts.
%{_bindir}/synctl
%{_libexecdir}/%{pkgname}
# systemd service.
%{_sbindir}/rc%{pkgname}
%{_unitdir}/%{pkgname}.service
# Man pages.
%{_mandir}/man*/*
%changelog