File indexing completed on 2024-04-14 14:08:48

0001 #!/bin/sh
0002 # Automate the build of the source dist
0003 # This script creates a branch, integrate the po and
0004 # create the tarball
0005 #
0006 # SPDX-FileCopyrightText: 2016 Bruno Coudoin <bruno.coudoin@gcompris.net>
0007 #
0008 #   SPDX-License-Identifier: GPL-3.0-or-later
0009 
0010 if [ ! -f org.kde.gcompris.appdata.xml ]
0011 then
0012     echo "ERROR: Run me from the top level GCompris source dir"
0013     exit 1
0014 fi
0015 
0016 # The current version
0017 version=$(sed -n -e 's/set(GCOMPRIS_MINOR_VERSION \([0-9]\+\)).*/\1/p' CMakeLists.txt)
0018 curbranch=$(git rev-parse --abbrev-ref HEAD)
0019 
0020 # Uncomment if this is not already done
0021 git checkout -b 0.${version}-po
0022 mkdir -p build
0023 cd build
0024 cmake ..
0025 
0026 # remove all translation files that should not be shipped
0027 # get all the locales to keep from LanguageList.qml
0028 languageListToKeep=`grep UTF-8\" ../src/core/LanguageList.qml | grep -v "//" | grep -o '[a-zA-Z_@]*.UTF-8' | cut -d'.' -f1`
0029 fullLanguageList=`echo $languageListToKeep | xargs`
0030 for f in $languageListToKeep; do
0031     # append short locales to the list
0032     fullLanguageList="$fullLanguageList `echo $f | cut -d'_' -f1`"
0033 done
0034 # remove each po file that is not within the previous list
0035 for f in ../poqm/*/gcompris_qt.po; do
0036     # get the locale from the filename
0037     locale=`echo $f | cut -d'/' -f3- | cut -d'/' -f1`
0038     echo $fullLanguageList | grep -q -w $locale
0039     if [[ $? -ne 0 ]]; then
0040         echo "Removing $locale as it is not shipped within gcompris"
0041         rm -f $f
0042     fi
0043 done
0044 
0045 git add -f ../poqm
0046 # Remove the po from po/ folder, they are unused
0047 git rm -rf ../po
0048 git commit -a -m "PO INTEGRATED / DO NOT PUSH ME"
0049 make dist
0050 git checkout ${curbranch}
0051 git branch -D 0.${version}-po