Accepting request 961663 from devel:languages:javascript

- Version 1.10.4
  * Improve build process: Perform actual "build" on OBS

OBS-URL: https://build.opensuse.org/request/show/961663
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/element-web?expand=0&rev=9
This commit is contained in:
Dominique Leuenberger 2022-03-14 18:35:39 +00:00 committed by Git OBS Bridge
parent 4cbc6555cb
commit b9bd2f5d22
9 changed files with 111 additions and 39 deletions

View File

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

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:21036274ff3a2036d07415b193e57dde60b79abda9f2dc8d5594a879c0c5f488
size 1410632

View File

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

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Mon Mar 14 11:14:41 UTC 2022 - Dominik Heidler <dheidler@suse.de>
- Version 1.10.4
* Improve build process: Perform actual "build" on OBS
-------------------------------------------------------------------
Mon Jan 31 15:11:03 UTC 2022 - Dominik Heidler <dheidler@suse.de>

View File

@ -17,27 +17,54 @@
Name: element-web
Version: 1.9.9
Version: 1.10.4
Release: 0
Summary: A glossy Matrix collaboration client - web files
License: Apache-2.0
URL: https://github.com/vector-im/element-web
Source0: element-%{version}.tar.gz
Source1: https://github.com/vector-im/element-web/archive/v%{version}.tar.gz#/element-web-%{version}.tar.gz
Source2: prepare_tarball.sh
Source0: https://github.com/vector-im/element-web/archive/v%{version}.tar.gz#/element-web-%{version}.tar.gz
Source1: npm-packages-offline-cache.tar.gz
Source2: jitsi_external_api.min.js
Source3: prepare.sh
BuildRequires: nodejs-electron
BuildRequires: yarn
BuildArch: noarch
%description
A glossy Matrix collaboration client - web files
%prep
%autosetup -n element-%{version}
%autosetup -n element-web-%{version}
%build
tar xzvf %{SOURCE1} --strip-components 1 element-web-%{version}/LICENSE
echo 'yarn-offline-mirror "./npm-packages-offline-cache"' > .yarnrc
tar xf %{SOURCE1}
ls ./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
sed -i -e 's| matrix-analytics-events "github:matrix-org/matrix-analytics-events.git#dfa6feaa12bcfc8e99b05a148e12fff7f9d62f08"| matrix-analytics-events "^0.0.1"|' yarn.lock
sed -i -e 's|"matrix-analytics-events@github:matrix-org/matrix-analytics-events#dfa6feaa12bcfc8e99b05a148e12fff7f9d62f08"|matrix-analytics-events@^0.0.1|' yarn.lock
yarn install --offline --pure-lockfile
mkdir -p webapp
cp %{SOURCE2} ./webapp/jitsi_external_api.min.js
echo 'return;' > scripts/build-jitsi.js
DIST_VERSION=%{version} ./scripts/package.sh
cd dist
tar xf element-%{version}.tar.gz
cd element-%{version}
cp ../../LICENSE ./
%install
cd dist
cd element-%{version}
install -d %{buildroot}/{usr/share/webapps,etc/webapps}/element
cp -r * "%{buildroot}%{_datadir}/webapps/element/"

3
jitsi_external_api.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:31ae8b120ad8eefbfe87522d7a376bb18f712c7532473a026dccb03ac466db7a
size 112817426

63
prepare.sh Normal file
View File

@ -0,0 +1,63 @@
#!/bin/bash
set -ex
oldwd="$(pwd)"
tmpdir="$(mktemp -d)"
version=$(grep "Version:" element-web.spec | awk '{print $2}')
osc rm element-web-*.tar.gz
wget -c https://github.com/vector-im/element-web/archive/v${version}.tar.gz -O element-web-${version}.tar.gz
wget https://meet.element.io/libs/external_api.min.js -O jitsi_external_api.min.js
osc add element-web-*.tar.gz
#zypper install yarn cargo gcc-c++ sqlcipher-devel libsecret-devel
rm -rf "element-web-${version}"
wget -c https://github.com/vector-im/element-web/archive/v${version}.tar.gz -O element-web-${version}.tar.gz
tar xzvf element-web-${version}.tar.gz
cd element-web-${version}
echo 'yarn-offline-mirror "./npm-packages-offline-cache"' > .yarnrc
yarn cache clean
rm -rf node_modules/
yarn install --pure-lockfile || : # this will download tha packages into the offline cache
# download some additional dependencie that slips through this earlier method
wget -O ./npm-packages-offline-cache/matrix-analytics-events-0.0.1.tgz $(grep -m1 -A2 "matrix-analytics-events" yarn.lock | grep resolved | awk '{print $NF}' | tr -d '"')
cd ./npm-packages-offline-cache/
mkdir package
tar xvf matrix-analytics-events-0.0.1.tgz --strip-components=1 -C package/
tar czf matrix-analytics-events-0.0.1.tgz package/
rm -r package
# fill sentry-cli cache with binaries for all architecutres
cd sentry-cli
sentry_cli_version=$(ls ../@sentry-cli-*.tgz | sed -e 's/.*cli-//' -e 's/.tgz//')
for arch in i686 x86_64 aarch64 armv7 ; do
url="https://downloads.sentry-cdn.com/sentry-cli/${sentry_cli_version}/sentry-cli-Linux-${arch}"
filehash=$(echo -n "$url" | md5sum | cut -c1-6)
target="${filehash}-sentry-cli-Linux-${arch/_/-}"
wget -O "$target" "$url"
chmod +x "$target"
done
cd ..
cd ..
tar czf npm-packages-offline-cache.tar.gz ./npm-packages-offline-cache
cp npm-packages-offline-cache.tar.gz "$oldwd/"
cd "$oldwd"
echo rm -rf "$tmpdir"
echo -e "\n\nDONE creating npm dependency offline cache file 'npm-packages-offline-cache.tar.gz'"
#DIST_VERSION=$version ./scripts/package.sh
#
#cp "dist/element-${version}.tar.gz" "$oldwd/"
#cd "$oldwd"
#rm -rf "$tmpdir"
#echo -e "\n\nDONE creating output file 'element-${version}.tar.gz'"

View File

@ -1,27 +0,0 @@
#!/bin/bash
set -ex
oldwd="$(pwd)"
tmpdir="$(mktemp -d)"
version=$(grep "Version:" element-web.spec | awk '{print $2}')
wget -c https://github.com/vector-im/element-web/archive/v${version}.tar.gz -O element-web-${version}.tar.gz
cp element-web.spec "$tmpdir/"
cd "$tmpdir"
#zypper install yarn cargo gcc-c++ sqlcipher-devel libsecret-devel
rm -rf "element-web-${version}"
wget -c https://github.com/vector-im/element-web/archive/v${version}.tar.gz -O element-web-${version}.tar.gz
tar xzvf element-web-${version}.tar.gz
cd element-web-${version}
yarn install || :
DIST_VERSION=$version ./scripts/package.sh
cp "dist/element-${version}.tar.gz" "$oldwd/"
cd "$oldwd"
rm -rf "$tmpdir"
echo -e "\n\nDONE creating output file 'element-${version}.tar.gz'"