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> <services>
<service name="tar_scm" mode="disabled"> <service name="obs_scm" mode="disabled">
<param name="filename">matrix-synapse</param> <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="url">git://github.com/matrix-org/synapse.git</param>
<param name="scm">git</param> <param name="scm">git</param>
<param name="revision">master</param> <param name="versionrewrite-pattern">v(.*)</param>
<param name="changesgenerate">enable</param> <param name="revision">v1.4.0</param>
<param name="changesauthor">okurz@suse.com</param>
</service> </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="compression">xz</param>
<param name="file">*.tar</param> <param name="file">*.tar</param>
</service> </service>
<service name="set_version" mode="disabled"/>
</services> </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 # 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 # All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed # 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) # license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative. # 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-%{**}} %{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define github_user matrix-org %define modname synapse
%define short_name synapse %define pkgname matrix-synapse
Name: matrix-%{short_name} Name: %{pkgname}
Version: 0.19.2 Version: 1.4.0
Release: 0 Release: 0
Summary: Matrix protocol reference homeserver Summary: Matrix protocol reference homeserver
License: Apache-2.0 License: Apache-2.0
Group: Productivity/Networking/Instant Messenger Group: Productivity/Networking/Instant Messenger
Source0: matrix-synapse-0.19.2.tar.gz URL: https://github.com/matrix-org/synapse
Url: https://github.com/matrix-org/synapse Source0: %{pkgname}-%{version}.tar.xz
BuildRoot: %{_tmppath}/%{name}-%{version}-build Source50: %{pkgname}.service
BuildRequires: unzip
BuildRequires: %{python_module base} BuildRequires: %{python_module base}
BuildRequires: %{python_module psutil >= 2.0.0}
BuildRequires: %{python_module setuptools} BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module treq >= 15.1.0}
BuildRequires: fdupes BuildRequires: fdupes
BuildRequires: python-rpm-macros BuildRequires: python-rpm-macros
BuildRequires: systemd-rpm-macros
BuildRequires: unzip
%{?systemd_requires}
Requires(pre): shadow Requires(pre): shadow
%if 0%{?suse_version} >= 1330 %ifpython3
# alternative: create a specific "synapse" group Requires: %{python_flavor} >= 3.5
Requires(pre): group(nogroup)
%endif %endif
Requires: python-Twisted # NOTE: Keep this is in the same order as synapse/python_dependencie.py.
Requires: python-bcrypt Requires: python-Pillow >= 4.3.0
Requires: python-msgpack-python Requires: python-PyNaCl >= 1.2.1
Requires: python-frozendict >= 0.4 Requires: python-PyYAML >= 3.11
Requires: python-unpaddedbase64 >= 1.1.0 Requires: python-Twisted >= 18.9.0
Requires: python-canonicaljson >= 1.0.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 Requires: python-signedjson >= 1.0.0
# original from python_requirements.py Requires: python-six >= 1.10
#BuildRequires: python-PyNaCl == 0.3.0 Requires: python-sortedcontainers >= 1.4.4
Requires: python-PyNaCl Requires: python-treq >= 15.1
Requires: python-service_identity >= 1.0.0 Requires: python-unpaddedbase64 >= 1.1.0
Requires: python-Twisted >= 16.0.0 # Specify all CONDITIONAL_REQUIREMENTS (we Require them to avoid no-recommends
Requires: python-pyOpenSSL >= 0.14 # breaking very commonly-used bits of matrix-synapse such as postgresql).
Requires: python-PyYAML %if %{with email_notifs}
Requires: python-pyasn1 Requires: python-Jinja2 >= 2.9
Requires: python-daemonize Requires: python-bleach >= 1.4.3
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}
%endif %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 %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. Matrix. Matrix is a system for federated Instant Messaging and VoIP.
%prep %prep
%setup -q -n %{short_name}-%{version} %setup -q
for i in \
app/client_reader \ # Remove all un-needed #!-lines.
app/federation_sender \ find synapse/ -type f -exec sed -i '1{/^#!/d}' {} \;
app/synchrotron \ # Replace all #!/usr/bin/env lines to use #!/usr/bin/$1 directly.
app/pusher \ find ./ -type f -exec \
app/media_repository \ sed -i '1s|^#!/usr/bin/env |#!/usr/bin/|' {} \;
app/homeserver \ # Force the usage of python_flavor.
app/appservice \ find ./ -type f \
app/federation_reader \ -exec sed -i '1s|^#!/usr/bin/python$|#!/usr/bin/%{python_flavor}|' {} \;
push/pusherpool \
util/versionstring # Update the python flavour in the service file.
do sed -i 's|@PYTHON_FLAVOR@|%{python_flavor}|g' %{S:50}
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
%build %build
%python_build %python_build
chmod +x build/lib/synapse/app/synctl.py
%install %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" # While we provide a systemd service, link synctl so it's simpler to use.
install -m 0644 contrib/systemd/log_config.yaml \ install -d -m 0755 %{buildroot}%{_bindir}
"%{buildroot}%{_sysconfdir}/synapse" 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} 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}" # User directory.
install -m 0644 contrib/systemd/synapse.service \ install -d -m 0755 %{buildroot}%{_rundir}/%{pkgname}
"%{buildroot}%{_unitdir}" install -d -m 0750 %{buildroot}%{_localstatedir}/lib/%{pkgname}
mkdir -p "%{buildroot}%{_rundir}/synapse"
%python_expand %fdupes %{buildroot}%{$python_sitelib} %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 %pre
getent group synapse >/dev/null || groupadd -r synapse
getent passwd synapse >/dev/null || \ 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 -d %{_localstatedir}/lib/synapse synapse
%service_add_pre synapse.service %service_add_pre %{pkgname}.service
%post %post
%{python_install_alternative synctl hash_password register_new_matrix_user synapse_port_db rcsynapse synapse.service log_config.yaml} %service_add_post %{pkgname}.service
%service_add_post synapse.service
%preun %preun
%service_del_preun synapse.service %service_del_preun %{pkgname}.service
%postun %postun
%python_uninstall_alternative synctl %service_del_postun %{pkgname}.service
%service_del_postun synapse.service
%if 0%{?suse_version} < 1500
%files -n %{pkgname}
%else
%files %{python_files} %files %{python_files}
%endif
%defattr(-,root,root,-) %defattr(-,root,root,-)
%doc *.rst %doc *.rst CHANGES.md
%doc LICENSE %license LICENSE
%dir %{_sysconfdir}/synapse %dir %{_sysconfdir}/%{pkgname}
%dir %{_sysconfdir}/%{pkgname}/conf.d
%config(noreplace) %{_sysconfdir}/%{pkgname}/*.yaml
%dir %attr(0750,%{modname},%{modname}) %{_localstatedir}/lib/%{pkgname}
%{python_sitelib} %{python_sitelib}
%python_alternative %{_bindir}/hash_password # Python helper scripts.
%python_alternative %{_bindir}/register_new_matrix_user %{_bindir}/synctl
%python_alternative %{_bindir}/synapse_port_db %{_libexecdir}/%{pkgname}
%python_alternative %{_bindir}/synctl # systemd service.
%python_alternative %{_sbindir}/rcsynapse %{_sbindir}/rc%{pkgname}
%python_alternative %{_unitdir}/synapse.service %{_unitdir}/%{pkgname}.service
%config %python_alternative %{_sysconfdir}/synapse/log_config.yaml # Man pages.
%{_mandir}/man*/*
%changelog %changelog