#!/bin/sh
gitname=RHVoice
pkgname=RHVoice
CWD=$(pwd)
for i in evgeniy-eng evgeniy-rus victoria-ru; do
if [ ! -d $i ]; then
	git clone https://github.com/RHVoice/${i}.git
else
	(cd $i
	git pull
	)
fi

( cd /data/GitHub/$gitname
cat <<EOF > .gitattributes
.gitattributes export-ignore
.git export-ignore
.git
.gitignore
EOF
git pull
git submodule init
git config submodule.data/voices/victoria.url "$CWD/victoria-ru"
git config submodule.data/voices/evgeniy-eng.url "$CWD/evgeniy-eng"
git config submodule.data/voices/evgeniy-rus.url "$CWD/evgeniy-rus"
git config submodule.src/third-party/cldr.active false
git config submodule.cmake/thirdparty/sanitizers.active false
git submodule update
gitrev=git$(git log -n 1 --format=format:%h .)
git archive --worktree-attributes --prefix=$pkgname-$gitrev/ master | xz > $CWD/$pkgname-$gitrev.tar.xz
rm .gitattributes
)
