summarylogtreecommitdiffstats
path: root/update-submodule.sh
blob: e4c7f49ced44a4098f38c9411446ab67d0d1afcc (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
#!/bin/bash

BASE=$PWD
rm -rf tmp/*
mkdir -p tmp
git clone mozc tmp/mozc
(cd tmp/mozc; git fetch;git submodule update --init)
source $BASE/PKGBUILD
UPDATED=0
for url in $(echo ${source[@]}|xargs -n1|grep "^git"|sed -e 's/git+//' -e 's/#commit=.*//'|grep -vE 'dict-to-mozc|mozc|bcr')
do
    d=${url##*/}
    d=${d%.git}
    [[ "$d" == "googletest" ]] && d=gtest
    r=${d//-/_}
    CURRENT=$(grep -E "^_${r}_commit" PKGBUILD)
    [[ "$d" == "japanese-usage-dictionary" ]] && d=${d//-/_}
    LATEST=$(cd tmp/mozc/src/third_party/$d; git fetch;echo "_${r}_commit="$(git log -1 --pretty=%h))
    echo $CURRENT
    echo $LATEST
    if [[ $CURRENT != $LATEST ]];then
        UPDATED=1
        echo "submodule ${d} is changed."
        echo sed -i 's|^_'"${r}"'_commit=.*$|'"${LATEST}"'|' PKGBUILD*
        sed -i 's|^_'"${r}"'_commit=.*$|'"${LATEST}"'|' PKGBUILD*
    fi
done
if [[ $UPDATED == 1 ]];then
    echo "submodule checksum is updated."
    for f in $(ls PKGBUILD*)
    do
        eval $(makepkg -g --noprepare -do -p $f)
        ./update_sha512sums.sh $f "${sha512sums[@]}"
    done
fi