-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathupdate-cbindgen-sources.sh
executable file
·39 lines (31 loc) · 1.21 KB
/
update-cbindgen-sources.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash
set -eo pipefail
if (($# < 1)); then
echo "Usage: $0 CBINDGEN_VERSION"
echo ""
echo "Example: $0 v0.23.0"
exit 1
fi
CBINDGEN_VERSION="$1" # cbindgen version tag
CBINDGEN_REPO="https://github.com/eqrion/cbindgen"
PACKAGE=cbindgen
SOURCES_FILE="$PACKAGE-sources.json"
MANIFEST_FILE="eu.betterbird.Betterbird.yml"
# clone cbindgen repo
[ -d cbindgen ] && rm -rf cbindgen
git clone -n $CBINDGEN_REPO cbindgen
cd cbindgen
cbindgen_commit=$(git rev-list -1 $CBINDGEN_VERSION)
git checkout $cbindgen_commit
cd ..
# update cbindgen release tag and commit in manifest
yq -i '(.modules[] | select(.name=="cbindgen") | .sources[] | select(.type=="git") | .commit) = "'$cbindgen_commit'"' $MANIFEST_FILE
yq -i '(.modules[] | select(.name=="cbindgen") | .sources[] | select(.type=="git") | .tag) = "'$CBINDGEN_VERSION'"' $MANIFEST_FILE
# update cbindgen-sources.json
flatpak-builder-tools/cargo/flatpak-cargo-generator.py cbindgen/Cargo.lock -o cbindgen-sources.json
rm -rf cbindgen
cat << EOT
The files were successfully updated to cbindgen $CBINDGEN_VERSION.
You can commit the result by executing the following command:
git commit --message='Update to cbindgen $CBINDGEN_VERSION' -- '$SOURCES_FILE' '$MANIFEST_FILE'
EOT