2022-03-17 17:02:09 +01:00
#!/bin/bash
set -ex
oldwd = " $( pwd ) "
tmpdir = " $( mktemp -d) "
#zypper install yarn cargo gcc-c++ sqlcipher-devel libsecret-devel
version = $( grep "Version:" element-desktop.spec | awk '{print $2}' )
2022-08-03 16:50:22 +02:00
osc rm -f element-web-*.tar.gz
osc rm -f element-desktop-*.tar.gz
2022-03-17 17:02:09 +01:00
wget -c https://github.com/vector-im/element-desktop/archive/v${ version } .tar.gz -O element-desktop-${ version } .tar.gz
wget -c https://github.com/vector-im/element-web/archive/v${ version } .tar.gz -O element-web-${ version } .tar.gz
2022-08-03 16:50:22 +02:00
osc add -f element-web-*.tar.gz
osc add -f element-desktop-*.tar.gz
2022-03-18 16:42:34 +01:00
cp element-desktop.spec " $tmpdir / "
cd " $tmpdir "
2022-03-17 17:02:09 +01:00
rm -rf " element-desktop- ${ version } "
wget -c https://github.com/vector-im/element-desktop/archive/v${ version } .tar.gz -O element-desktop-${ version } .tar.gz
tar xzvf element-desktop-${ version } .tar.gz
cd element-desktop-${ version }
2023-09-25 16:14:11 +02:00
last_packaged_version = $( osc cat devel:languages:nodejs/element-desktop/element-desktop.spec | grep "^Version:" | awk '{print $NF}' )
changes = $( grep " ^Changes in \[ $last_packaged_version \] " -B10000 CHANGELOG.md | head -n -2 | sed -e '/^==*$/d' -e 's/Changes in \[\([^\[]*\)\].*/- Version \1/' -e 's/Changes in \[\([^\[]*\)\].*/- Version \1/' -e 's/^\([^-].*\)$/ \1/' )
2022-09-27 23:29:29 +02:00
2022-03-17 17:02:09 +01:00
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
2023-06-15 15:20:54 +02:00
export PATH = " $PATH :node_modules/.bin "
yarn run hak check
yarn run hak fetch
# prefetch cargo crates
pushd .hak/matrix-seshat/x86_64-unknown-linux-gnu/build
cargo vendor
mkdir -p .cargo
cat > .cargo/config.toml <<EOF
[ source.crates-io]
replace-with = "vendored-sources"
[ source.vendored-sources]
directory = "vendor"
EOF
popd
patch -p0 <<EOF
--- .hak/keytar/x86_64-unknown-linux-gnu/build/node_modules/node-gyp/gyp/pylib/gyp/input.py 2023-06-15 12:09:05.127000000 +0200
+++ .hak/keytar/x86_64-unknown-linux-gnu/build/node_modules/node-gyp/gyp/pylib/gyp/input.py 2023-06-15 13:34:18.969088855 +0200
@@ -1190,7 +1190,7 @@
else :
ast_code = compile( cond_expr_expanded, "<string>" , "eval" )
cached_conditions_asts[ cond_expr_expanded] = ast_code
- env = { "__builtins__" : { } , "v" : StrictVersion}
+ env = { "__builtins__" : { "openssl_fips" : "" } , "v" : StrictVersion}
if eval( ast_code, env, variables) :
return true_dict
return false_dict
EOF
2022-03-17 17:02:09 +01:00
tar czf npm-packages-offline-cache.tar.gz ./npm-packages-offline-cache
2023-06-15 15:20:54 +02:00
tar czf hak.tar.gz ./.hak
cp -v npm-packages-offline-cache.tar.gz hak.tar.gz " $oldwd / "
2022-03-17 17:02:09 +01:00
cd " $oldwd "
echo rm -rf " $tmpdir "
echo -e "\n\nDONE creating npm dependency offline cache file 'npm-packages-offline-cache.tar.gz'"
2022-09-27 23:29:29 +02:00
read -p "Write changes?"
2023-11-02 11:47:22 +01:00
osc vc -m " ${ changes } " element-desktop.changes