source: calamares/trunk/fuentes/ci/txpush.sh @ 7538

Last change on this file since 7538 was 7538, checked in by kbut, 13 months ago

sync with github

  • Property svn:executable set to *
File size: 2.6 KB
Line 
1#!/bin/sh
2#
3# Fetch the Transifex translations for Calamares and incorporate them
4# into the source tree, adding commits of the different files.
5
6### INITIAL SETUP
7#
8# This stuff needs to be done once; in a real CI environment where it
9# runs regularly in a container, the setup needs to be done when
10# creating the container.
11#
12#
13# cp ~/jenkins-master/.transifexrc ~  # Transifex user settings
14# cp ~/jenkins-master/.gitconfig ~    # Git config, user settings
15# cp -R ~/jenkins-master/.ssh ~       # SSH, presumably for github
16#
17# cd "$WORKSPACE"
18# git config --global http.sslVerify false
19
20test -f "CMakeLists.txt" || { echo "! Not at Calamares top-level" ; exit 1 ; }
21test -f ".tx/config" || { echo "! Not at Calamares top-level" ; exit 1 ; }
22test -f "calamares.desktop" || { echo "! Not at Calamares top-level" ; exit 1 ; }
23
24if test "x$1" = "x--no-tx" ; then
25  tx() {
26    echo "Skipped tx $*"
27  }
28fi
29
30### CREATE TRANSLATIONS
31#
32# Use local tools (depending on type of source) to create translation
33# sources, then push to Transifex
34
35export QT_SELECT=5
36# Don't pull branding translations in,
37# those are done separately.
38_srcdirs="src/calamares src/libcalamares src/libcalamaresui src/modules src/qml"
39lupdate $_srcdirs -ts -no-obsolete lang/calamares_en.ts
40
41tx push --source --no-interactive -r calamares.calamares-master
42tx push --source --no-interactive -r calamares.fdo
43
44### PYTHON MODULES
45#
46# The Python tooling depends on the underlying distro to provide
47# gettext, and handles two cases:
48#
49# - python modules with their own lang/ subdir, for larger translations
50# - python modules without lang/, which use one shared catalog
51#
52
53PYGETTEXT="xgettext --keyword=_n:1,2 -L python"
54
55SHARED_PYTHON=""
56for MODULE_DIR in $(find src/modules -maxdepth 1 -mindepth 1 -type d) ; do
57  FILES=$(find "$MODULE_DIR" -name "*.py" -a -type f)
58  if test -n "$FILES" ; then
59    MODULE_NAME=$(basename ${MODULE_DIR})
60    if [ -d ${MODULE_DIR}/lang ]; then
61      ${PYGETTEXT} -p ${MODULE_DIR}/lang -d ${MODULE_NAME} -o ${MODULE_NAME}.pot ${MODULE_DIR}/*.py
62      POTFILE="${MODULE_DIR}/lang/${MODULE_NAME}.pot"
63      if [ -f "$POTFILE" ]; then
64        sed -i'' '/^"Content-Type/s/CHARSET/UTF-8/' "$POTFILE"
65        tx set -r calamares.${MODULE_NAME} --source -l en "$POTFILE"
66        tx push --source --no-interactive -r calamares.${MODULE_NAME}
67      fi
68    else
69      SHARED_PYTHON="$SHARED_PYTHON $FILES"
70    fi
71  fi
72done
73
74if test -n "$SHARED_PYTHON" ; then
75  ${PYGETTEXT} -p lang -d python -o python.pot $SHARED_PYTHON
76  POTFILE="lang/python.pot"
77  sed -i'' '/^"Content-Type/s/CHARSET/UTF-8/' "$POTFILE"
78  tx set -r calamares.python --source -l en "$POTFILE"
79  tx push --source --no-interactive -r calamares.python
80fi
Note: See TracBrowser for help on using the repository browser.