wesnoth-l10n-tools/pack

64 lines
2.1 KiB
Plaintext
Raw Permalink Normal View History

2008-09-18 13:36:37 +01:00
#!/bin/bash
# Pack translations
2020-12-29 19:44:53 +00:00
# Copyright (C) 2007-2008 Andrius Štikonas <andrius@stikonas.eu>
2008-09-18 13:36:37 +01:00
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
2019-06-10 00:00:02 +01:00
source "$(dirname "$0")/variables"
2008-09-18 13:36:37 +01:00
counter=0
2013-03-28 11:23:11 +00:00
for BRANCH in $BRANCHES; do
2019-06-10 00:00:02 +01:00
echo -e "Checking out files from $BLUE$BRANCH$ENDCOLOR"
$GIT archive --remote "$REPO" --prefix="$BRANCH-temp/" --format=tar "$BRANCH:po" | tar x
2008-09-18 13:36:37 +01:00
mkdir "$LCODE-temp"
2013-03-28 11:23:11 +00:00
counter=0
2019-06-10 00:00:02 +01:00
for file in $(find "$BRANCH" -follow -name "*.$LCODE.po"); do
bfile=$(basename "$file")
2008-09-18 13:36:37 +01:00
echo -n "Processing catalog $bfile... ";
2019-06-10 00:00:02 +01:00
d=${bfile//".$LCODE.po"/}
dirdomain=$(echo "wesnoth-$d" | sed "s/wesnoth-wesnoth/wesnoth/")
2013-03-28 11:23:11 +00:00
if [ -f "$BRANCH-temp/$dirdomain/$LCODE.po" ]; then
if ! $DIFF -q "$file" "$BRANCH-temp/$dirdomain/$LCODE.po" > /dev/null ; then
mkdir "$LCODE-temp/$dirdomain"
2009-05-18 14:37:59 +01:00
cp "$file" "$LCODE-temp/$dirdomain/$LCODE.po"
2019-06-10 00:00:02 +01:00
echo -e "${GREEN}OK$ENDCOLOR"
counter=$((counter+1))
2008-09-18 13:36:37 +01:00
else
2019-06-10 00:00:02 +01:00
echo -e "${BLUE}Skipping$ENDCOLOR"
2008-09-18 13:36:37 +01:00
fi
else
mkdir -p "$LCODE-temp/$dirdomain"
2009-05-18 14:37:59 +01:00
cp "$file" "$LCODE-temp/$dirdomain/$LCODE.po"
2019-06-10 00:00:02 +01:00
echo -e "${GREEN}OK$ENDCOLOR"
counter=$((counter+1))
2008-09-18 13:36:37 +01:00
fi
done
2018-12-28 23:56:21 +00:00
if [ -f "$LCODE-$BRANCH.tar.bz2" ]; then
2008-09-18 13:36:37 +01:00
echo "Removing old archive."
2018-12-28 23:56:21 +00:00
rm -f "$LCODE-$BRANCH.tar.bz2"
2008-09-18 13:36:37 +01:00
fi
if [ ! $counter -eq 0 ]; then
2019-06-10 00:00:02 +01:00
cd "$LCODE-temp" || exit
$TAR --remove-files -cf "../$LCODE-$BRANCH.tar" wesnoth*
cd .. || exit
$BZIP -9 "$LCODE-$BRANCH.tar"
2008-09-18 13:36:37 +01:00
echo "New archive created."
fi
2019-06-10 00:00:02 +01:00
rm -rf "$BRANCH-temp"
rmdir "$LCODE-temp"
2008-09-18 13:36:37 +01:00
done
2019-06-10 00:00:02 +01:00
echo -e "${GREEN}Finished.$ENDCOLOR"