From e59782d4dc61233f64111bad0bb6df9d3f0102010db11f88a5d2465a1439053b Mon Sep 17 00:00:00 2001 From: Marcus Rueckert Date: Mon, 17 Oct 2022 09:52:14 +0000 Subject: [PATCH] Accepting request 1011102 from home:bnavigator:branches:network:messaging:matrix - Replace fragile workaround which is not specification compliant with 14085-extra-check.patch -- gh#matrix-org/synapse#14085 - Fix python site-packages fdupes OBS-URL: https://build.opensuse.org/request/show/1011102 OBS-URL: https://build.opensuse.org/package/show/network:messaging:matrix/matrix-synapse?expand=0&rev=244 --- 14085-extra-check.patch | 48 +++++++++++++++++++++++++++++++++++++++++ matrix-synapse.changes | 7 ++++++ matrix-synapse.spec | 16 +++++--------- 3 files changed, 60 insertions(+), 11 deletions(-) create mode 100644 14085-extra-check.patch diff --git a/14085-extra-check.patch b/14085-extra-check.patch new file mode 100644 index 0000000..bee7f2c --- /dev/null +++ b/14085-extra-check.patch @@ -0,0 +1,48 @@ +From 42031876e16af041367c3066023994d4c970df57 Mon Sep 17 00:00:00 2001 +From: David Robertson +Date: Thu, 6 Oct 2022 15:46:11 +0100 +Subject: PR #14085 Unpin build-system requirements, but impose an upper-bound + +Fixes #14079, properly. Reverts #14080. + +A summary of the problem: + +Synapse defines an extra called url_preview with an underscore. +Synapse looks up its own packaging metadata at runtime to check if the dependencies needed for url_preview are installed. +Poetry-core 1.3.0 now normalises extra names when writing metadata, per PEP 685. +This means the extra will be written to metadata as url-preview with a hyphen. +So the lookup in point 2 will fail if Synapse was built/installed by poetry-core 1.3.0. + +--- a/pyproject.toml ++++ b/pyproject.toml +@@ -219,7 +219,7 @@ oidc = ["authlib"] + # `systemd.journal.JournalHandler`, as is documented in + # `contrib/systemd/log_config.yaml`. + systemd = ["systemd-python"] +-url_preview = ["lxml"] ++url-preview = ["lxml"] + sentry = ["sentry-sdk"] + opentracing = ["jaeger-client", "opentracing"] + jwt = ["authlib"] +@@ -250,7 +250,7 @@ all = [ + "pysaml2", + # oidc and jwt + "authlib", +- # url_preview ++ # url-preview + "lxml", + # sentry + "sentry-sdk", +diff --git a/synapse/config/repository.py b/synapse/config/repository.py +index 1033496bb43..e4759711ed9 100644 +--- a/synapse/config/repository.py ++++ b/synapse/config/repository.py +@@ -205,7 +205,7 @@ def read_config(self, config: JsonDict, **kwargs: Any) -> None: + ) + self.url_preview_enabled = config.get("url_preview_enabled", False) + if self.url_preview_enabled: +- check_requirements("url_preview") ++ check_requirements("url-preview") + + proxy_env = getproxies_environment() + if "url_preview_ip_range_blacklist" not in config: diff --git a/matrix-synapse.changes b/matrix-synapse.changes index 3b59044..324ade9 100644 --- a/matrix-synapse.changes +++ b/matrix-synapse.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Sat Oct 15 10:02:06 UTC 2022 - Ben Greiner + +- Replace fragile workaround which is not specification compliant + with 14085-extra-check.patch -- gh#matrix-org/synapse#14085 +- Fix python site-packages fdupes + ------------------------------------------------------------------- Fri Oct 14 13:34:26 UTC 2022 - Marcus Rueckert diff --git a/matrix-synapse.spec b/matrix-synapse.spec index dc262aa..4c7ba09 100644 --- a/matrix-synapse.spec +++ b/matrix-synapse.spec @@ -176,12 +176,14 @@ Source99: series Patch: matrix-synapse-1.4.1-paths.patch Patch1: bump-dependencies.patch Patch2: https://patch-diff.githubusercontent.com/raw/matrix-org/synapse/pull/13952.patch +# PATCH-FIX-UPSTREAM 14085-extra-check.patch https://github.com/matrix-org/synapse/pull/14085 +Patch3: 14085-extra-check.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 +BuildRequires: %{use_python}-poetry-core >= 1.0.0 BuildRequires: %{use_python}-setuptools BuildRequires: %{use_python}-wheel BuildRequires: cargo @@ -194,7 +196,7 @@ BuildRequires: unzip %{?systemd_ordering} %{sysusers_requires} %requires_peq %{use_python}-base -BuildRequires: %{use_python}-setuptools-rust +BuildRequires: %{use_python}-setuptools-rust >= 1.3 # NOTE: Keep this is in the same order as pyproject.toml. # some version locks based on poetry.lock BuildRequires: %{use_python}-Jinja2 >= %{Jinja2_version} @@ -333,14 +335,6 @@ cp %{S:48} README.SUSE install -d -m 0755 %{buildroot}%{_libexecdir}/%{pkgname} %pyproject_install -# workaround for poetry >= 1.3.0 boo#1204312 -METADATA_FILE="%{buildroot}%{python3_sitearch}/%{eggname}-%{version}.dist-info/METADATA" -if [ -e ${METADATA_FILE} ] ; then - perl -p -i.backup -e 's/(Provides-Extra: url-preview\n)/${1}Provides-Extra: url_preview\n/g' ${METADATA_FILE} - diff -urN ${METADATA_FILE}{.backup,} ||: - rm -f ${METADATA_FILE}.backup -fi - install -d -m 0755 %{buildroot}%{_bindir} %{buildroot}%{_libexecdir}/%{pkgname}/ # move scripts to the old place. mv %{buildroot}%{_bindir}/* %{buildroot}%{_libexecdir}/%{pkgname}/ @@ -374,7 +368,7 @@ 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_sitelib} +%fdupes %{buildroot}%{python3_sitearch} %pre -f %{name}.pre %service_add_pre %{pkgname}.service