blob: 5e19bfe80783cc0dd85eaa6f3544237894824c07 (
plain)
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
#!/bin/bash
#SudahiDict
SudachiDict_DATE=$(curl -s 'http://sudachi.s3-website-ap-northeast-1.amazonaws.com/sudachidict-raw/' | grep -o '<td>[0-9]*</td>' | grep -o '[0-9]*' | sort -n | tail -n 1)
#ORIGINAL_REPO=fcitx/mozc
ORIGINAL_REPO=$(grep "^url" PKGBUILD | tr -d '"' | sed -e 's|.*com/\(.*\)$|\1|' -e 's|.git$||')
BCR_REPO=bazelbuild/bazel-central-registry
FCITX5_MOZC_COMMIT=$(curl -s https://api.github.com/repos/$ORIGINAL_REPO/commits/fcitx|jq -r ".sha")
BCR_COMMIT=$(curl -s https://api.github.com/repos/$BCR_REPO/commits/main|jq -r ".sha")
# PKGBUILD
COMMIT=$(grep "^_mozc_commit" PKGBUILD|cut -f2 -d"=")
BCR_CURRENT_COMMIT=$(grep "^_bcr_commit" PKGBUILD|cut -f2 -d"=")
SUDACHI_DATE=$(grep "^_sudachidict_date" PKGBUILD|cut -f2 -d"=")
echo $ORIGINAL_REPO
echo "Latest:"
echo "Fcitx5 :" $FCITX5_MOZC_COMMIT
echo "BCR :" $BCR_COMMIT
echo "SudachiDict:" $SudachiDict_DATE
echo
echo "Current:"
echo "Fcitx5 :" $COMMIT
echo "BCR :" $BCR_CURRENT_COMMIT
echo "SudachiDict:" $SUDACHI_DATE
UPDATED_FLAG=0
MSGS=""
if [[ $(cd mozc; git rev-list --count $COMMIT..$FCITX5_MOZC_COMMIT)>0 ]]; then
echo "Mozc Updated."
echo "Current: $COMMIT"
echo "Latest : $FCITX5_MOZC_COMMIT"
UPDATED_FLAG=1
fi
if [[ "$SudachiDict_DATE" != "$SUDACHI_DATE" ]];then
echo "SudachiDict Updated."
echo "${SUDACHI_DATE}"
echo "${SudachiDict_DATE}"
UPDATED_FLAG=1
fi
if [[ "$SudachiDict_DATE" != "$SUDACHI_DATE" ]];then
sed -i 's|^_sudachidict_date=.*$|_sudachidict_date='"${SudachiDict_DATE}"'|' PKGBUILD*
rm -f *_lex.zip
for f in $(ls PKGBUILD*)
do
eval $(makepkg -g --noprepare -do -p $f)
./update_sha512sums.sh $f "${sha512sums[@]}"
done
git diff
[[ -z $MSGS ]] && MSGS="Update: SudachiDict=$SudachiDict_DATE" || MSGS+="\nUpdate: SudachiDict=$SudachiDict_DATE"
fi
if [[ "$COMMIT" != "$FCITX5_MOZC_COMMIT" ]]; then
sed -i 's|^_mozc_commit=.*$|_mozc_commit='"${FCITX5_MOZC_COMMIT}"'|' PKGBUILD*
sed -i 's|^_bcr_commit=.*$|_bcr_commit='"${BCR_COMMIT}"'|' PKGBUILD*
for f in $(ls PKGBUILD*)
do
eval $(makepkg -g --noprepare -do -p $f)
./update_sha512sums.sh $f "${sha512sums[@]}"
done
git diff
[[ -z $MSGS ]] && MSGS="Update: _mozc_commit=$FCITX5_MOZC_COMMIT" || MSGS+="\nUpdate: _mozc_commit=$FCITX5_MOZC_COMMIT"
fi
function pkgver() {
cd "tmp/mozc" || exit
source <(grep = src/data/version/mozc_version_template.bzl| tr -d ' ')
printf "%s.%s.%s.%s" "$MAJOR" "$MINOR" "$BUILD_OSS" "$((REVISION+2))"
}
function pkgrel() {
FLAG=$1
for f in $(ls PKGBUILD*)
do
PKGREL=$(grep -E "^pkgrel=" $f|cut -f2 -d"=")
[[ -z $FLAG ]] && PKGREL=$((${PKGREL}+1)) || PKGREL=1
sed -i 's|^pkgrel=.*$|pkgrel='"${PKGREL}"'|' $f
done
}
if [[ "$UPDATED_FLAG" == "1" ]]; then
./partial-clone.sh
echo "Change Detected."
./update-submodule.sh
CURRENT_PKGVER=$(grep "pkgver=" PKGBUILD|cut -f2 -d"=")
PKGVER=$(pkgver)
if [[ "$CURRENT_PKGVER" == "$PKGVER" ]];then
pkgrel
else
sed -i 's|^pkgver=.*$|pkgver='"${PKGVER}"'|' PKGBUILD*
pkgrel 1
fi
makepkg --printsrcinfo > .SRCINFO
git commit -a -m "$(echo -e $MSGS)"
#git push
./partial-clone.sh
else
echo "No change Detected."
fi
|