From 84fdcba352ce3434ea700e95196c11ab9771f0fca25dea702d436fba2e9a03b0 Mon Sep 17 00:00:00 2001 From: Dominik Heidler Date: Mon, 30 Jan 2023 14:51:29 +0000 Subject: [PATCH] Accepting request 1061550 from home:gladiac:branches:devel:languages:nodejs - Fixed webpack with OpenSSL3 * Added webpack-fix-openssl3.patch - Fixed building for Fedora - Some spec file cleanup OBS-URL: https://build.opensuse.org/request/show/1061550 OBS-URL: https://build.opensuse.org/package/show/devel:languages:nodejs/element-web?expand=0&rev=33 --- element-web.changes | 8 ++++++++ element-web.spec | 40 +++++++++++++++++++++----------------- fix-webpack-oom.patch | 6 ++++-- webpack-fix-openssl3.patch | 16 +++++++++++++++ 4 files changed, 50 insertions(+), 20 deletions(-) create mode 100644 webpack-fix-openssl3.patch diff --git a/element-web.changes b/element-web.changes index 43b77c2..0317023 100644 --- a/element-web.changes +++ b/element-web.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Fri Jan 27 12:21:26 UTC 2023 - Andreas Schneider + +- Fixed webpack with OpenSSL3 + * Added webpack-fix-openssl3.patch +- Fixed building for Fedora +- Some spec file cleanup + ------------------------------------------------------------------- Fri Jan 20 13:12:45 UTC 2023 - Dominik Heidler diff --git a/element-web.spec b/element-web.spec index 5b4c37d..d70618e 100644 --- a/element-web.spec +++ b/element-web.spec @@ -27,26 +27,27 @@ Source1: npm-packages-offline-cache.tar.gz Source2: jitsi_external_api.min.js Source3: prepare.sh Patch0: fix-webpack-oom.patch +Patch1: webpack-fix-openssl3.patch BuildRequires: yarn -BuildRequires: nodejs18 +BuildRequires: nodejs-packaging +BuildRequires: fdupes BuildArch: noarch %description A glossy Matrix collaboration client - web files %prep -%autosetup -n element-web-%{version} -p0 +%autosetup -n element-web-%{version} -a1 -p1 %build echo 'yarn-offline-mirror "./npm-packages-offline-cache"' > .yarnrc -tar xf %{SOURCE1} -ls ./npm-packages-offline-cache | head +ls -l ./npm-packages-offline-cache | head # fix some strange dependency -cd ./npm-packages-offline-cache -cp matrix-analytics-events-0.0.1.tgz @matrix-analytics-events-0.0.1.tgz -cd .. -ls ./npm-packages-offline-cache | grep matrix-analytics-events +cp npm-packages-offline-cache/matrix-analytics-events-0.0.1.tgz \ + npm-packages-offline-cache/@matrix-analytics-events-0.0.1.tgz +ls -l ./npm-packages-offline-cache/*matrix-analytics-events* + sed -i -e 's| matrix-analytics-events "github:matrix-org/matrix-analytics-events.git#[^"]*"| matrix-analytics-events "^0.0.1"|' yarn.lock sed -i -e 's|"matrix-analytics-events@github:matrix-org/matrix-analytics-events#[^"]*"|matrix-analytics-events@^0.0.1|' yarn.lock @@ -58,24 +59,27 @@ echo 'return;' > scripts/build-jitsi.js DIST_VERSION=%{version} ./scripts/package.sh -cd dist +pushd dist || exit 1 tar xf element-%{version}.tar.gz -cd element-%{version} -cp ../../LICENSE ./ +popd +cp LICENSE dist/element-%{version}/LICENSE %install -cd dist -cd element-%{version} -install -d %{buildroot}/{usr/share/webapps,etc/webapps}/element +install -d -m 0755 %{buildroot}/usr/share/webapps/element -cp -r * "%{buildroot}%{_datadir}/webapps/element/" -install -Dm644 config.sample.json -t "%{buildroot}%{_sysconfdir}/webapps/element/" +cp -av dist/element-%{version}/* "%{buildroot}%{_datadir}/webapps/element/" + +install -d -m 0755 %{buildroot}%{_sysconfdir}/webapps/element/ +install -m 0644 config.sample.json "%{buildroot}%{_sysconfdir}/webapps/element/config.sample.json" + +%fdupes %{buildroot}%{_datadir}/webapps/element/ %files %license LICENSE %dir %{_datadir}/webapps -%dir %{_sysconfdir}/webapps %{_datadir}/webapps/element -%{_sysconfdir}/webapps/element +%dir %{_sysconfdir}/webapps +%dir %{_sysconfdir}/webapps/element +%config %{_sysconfdir}/webapps/element/config.sample.json %changelog diff --git a/fix-webpack-oom.patch b/fix-webpack-oom.patch index f639e9c..0720ec4 100644 --- a/fix-webpack-oom.patch +++ b/fix-webpack-oom.patch @@ -1,5 +1,7 @@ ---- package.json 2022-09-28 15:22:49.000000000 +0200 -+++ package.json 2022-12-23 11:10:18.838569341 +0100 +Index: element-web-1.11.20/package.json +=================================================================== +--- element-web-1.11.20.orig/package.json 2023-01-20 13:52:01.000000000 +0100 ++++ element-web-1.11.20/package.json 2023-01-27 13:02:23.452017454 +0100 @@ -37,7 +37,7 @@ "build:res": "node scripts/copy-res.js", "build:genfiles": "yarn build:res && yarn build:jitsi && yarn build:module_system", diff --git a/webpack-fix-openssl3.patch b/webpack-fix-openssl3.patch new file mode 100644 index 0000000..b508454 --- /dev/null +++ b/webpack-fix-openssl3.patch @@ -0,0 +1,16 @@ +Index: element-web-1.11.20/webpack.config.js +=================================================================== +--- element-web-1.11.20.orig/webpack.config.js 2023-01-20 13:52:01.000000000 +0100 ++++ element-web-1.11.20/webpack.config.js 2023-01-27 13:16:14.405927597 +0100 +@@ -1,5 +1,11 @@ + /* eslint-disable quote-props */ + ++// HACK: OpenSSL 3 does not support md4 any more, but webpack hardcodes it all ++// over the place: https://github.com/webpack/webpack/issues/13572 ++const crypto = require("crypto"); ++const crypto_orig_createHash = crypto.createHash; ++crypto.createHash = algorithm => crypto_orig_createHash(algorithm == "md4" ? "sha256" : algorithm); ++ + const dotenv = require("dotenv"); + const path = require("path"); + const webpack = require("webpack");