diff --git a/ci/txpush.sh b/ci/txpush.sh index e27346bd0..186ede9b6 100755 --- a/ci/txpush.sh +++ b/ci/txpush.sh @@ -1,25 +1,55 @@ -#!/bin/bash - -# Make sure we can make Transifex and git operations from the Calamares Docker+Jenkins environment. -cp ~/jenkins-master/.transifexrc ~ -cp ~/jenkins-master/.gitconfig ~ -cp -R ~/jenkins-master/.ssh ~ - -cd "$WORKSPACE" -git config --global http.sslVerify false +#!/bin/sh +# +# Fetch the Transifex translations for Calamares and incorporate them +# into the source tree, adding commits of the different files. + +### INITIAL SETUP +# +# This stuff needs to be done once; in a real CI environment where it +# runs regularly in a container, the setup needs to be done when +# creating the container. +# +# +# cp ~/jenkins-master/.transifexrc ~ # Transifex user settings +# cp ~/jenkins-master/.gitconfig ~ # Git config, user settings +# cp -R ~/jenkins-master/.ssh ~ # SSH, presumably for github +# +# cd "$WORKSPACE" +# git config --global http.sslVerify false + +test -f "CMakeLists.txt" || { echo "! Not at Calamares top-level" ; exit 1 ; } +test -f ".tx/config" || { echo "! Not at Calamares top-level" ; exit 1 ; } +test -f "calamares.desktop" || { echo "! Not at Calamares top-level" ; exit 1 ; } + +### CREATE TRANSLATIONS +# +# Use local tools (depending on type of source) to create translation +# sources, then push to Transifex export QT_SELECT=5 lupdate src/ -ts -no-obsolete lang/calamares_en.ts +tx push --source --no-interactive -r calamares.calamares-master +tx push --no-interactive -r calamares.fdo + +### PYTHON MODULES +# +# The Python tooling depends on the underlying distro to provide +# gettext, and handles two cases: +# +# - python modules with their own lang/ subdir, for larger translations +# - python modules without lang/, which use one shared catalog +# + # Arch # PYGETTEXT=/usr/lib/python3.5/Tools/i18n/pygettext.py # Ubuntu PYGETTEXT=pygettext3 -for MODULE_DIR in `find src/modules -maxdepth 1 -mindepth 1 -type d`; do - FILES=(${MODULE_DIR}/*.py) - if [ ${#FILES[@]} -gt 0 ]; then +for MODULE_DIR in $(find src/modules -maxdepth 1 -mindepth 1 -type d) ; do + FILES=$(find "$MODULE_DIR" -name "*.py" -a -type f) + if test -n "$FILES" ; then MODULE_NAME=$(basename ${MODULE_DIR}) if [ -d ${MODULE_DIR}/lang ]; then ${PYGETTEXT} -p ${MODULE_DIR}/lang -d ${MODULE_NAME} ${MODULE_DIR}/*.py @@ -30,7 +60,3 @@ for MODULE_DIR in `find src/modules -maxdepth 1 -mindepth 1 -type d`; do fi fi done - -tx push --source --no-interactive -r calamares.calamares-master -tx push --no-interactive -r calamares.fdo -