summaryrefslogtreecommitdiff
path: root/ci
diff options
context:
space:
mode:
authorAdriaan de Groot <groot@kde.org>2020-02-06 13:11:23 +0100
committerAdriaan de Groot <groot@kde.org>2020-02-06 13:11:23 +0100
commitdec30d70fd971b8e7a5d58a72757a82d1c88b24a (patch)
tree9c7be3524e5f8418110bb3f84fba71c2717ac82a /ci
parent0d2425ca78a4e733c21066c4a5b79290dbc28144 (diff)
CI: tidy up scripts
- Add SPDX headers - Indent consistently (tabs, not a mix of 2-space, 4-space, and tabs) The scripts were originally added without a license header. Since they are simple, and re-usable, and not particularly interesting, I've made the license explicitly 2-clause BSD. This is unlike the rest of Calamares, which is GPLv3+; the build system and support scripts are not the software itself.
Diffstat (limited to 'ci')
-rw-r--r--ci/txcheck.sh26
-rwxr-xr-xci/txpull.sh64
-rwxr-xr-xci/txpush.sh106
3 files changed, 116 insertions, 80 deletions
diff --git a/ci/txcheck.sh b/ci/txcheck.sh
index 8eef04571..9ce8f0c30 100644
--- a/ci/txcheck.sh
+++ b/ci/txcheck.sh
@@ -37,18 +37,18 @@ TX_FILE_LIST="lang/calamares_en.ts lang/python.pot src/modules/dummypythonqt/lan
# normally used much later in the script.
tx_cleanup()
{
- # Cleanup artifacs of checking
- git worktree remove --force build-txcheck-head
- git worktree remove --force build-txcheck-prev
- git branch -D build-txcheck-head > /dev/null 2>&1
+ # Cleanup artifacs of checking
+ git worktree remove --force build-txcheck-head
+ git worktree remove --force build-txcheck-prev
+ git branch -D build-txcheck-head > /dev/null 2>&1
}
if test "x$1" = "x--cleanup" ; then
- tx_cleanup
- exit 0
+ tx_cleanup
+ exit 0
fi
if test "x$1" = "x--help" ; then
- sed -e '1,/USAGE/d' -e '/END.USAGE/,$d' < "$0"
+ sed -e '1,/USAGE/d' -e '/END.USAGE/,$d' < "$0"
fi
test -z "$1" || { echo "! Usage: txcheck.sh [--cleanup]" ; exit 1 ; }
@@ -59,22 +59,22 @@ test -z "$1" || { echo "! Usage: txcheck.sh [--cleanup]" ; exit 1 ; }
XMLLINT=""
for _xmllint in xmllint
do
- $_xmllint --version > /dev/null 2>&1 && XMLLINT=$_xmllint
- test -n "$XMLLINT" && break
+ $_xmllint --version > /dev/null 2>&1 && XMLLINT=$_xmllint
+ test -n "$XMLLINT" && break
done
# Distinguish GNU date from BSD date
if date +%s -d "1 week ago" > /dev/null 2>&1 ; then
- last_week() { date +%s -d "1 week ago" ; }
+ last_week() { date +%s -d "1 week ago" ; }
else
- last_week() { date -v1w +%s; }
+ last_week() { date -v1w +%s; }
fi
# Distinguish GNU SHA executables from BSD ones
if which sha256sum > /dev/null 2>&1 ; then
- SHA256=sha256sum
+ SHA256=sha256sum
else
- SHA256=sha256
+ SHA256=sha256
fi
### CHECK WORKING DIRECTORY
diff --git a/ci/txpull.sh b/ci/txpull.sh
index b320da300..734a689b5 100755
--- a/ci/txpull.sh
+++ b/ci/txpull.sh
@@ -1,4 +1,18 @@
#!/bin/sh
+
+### LICENSE
+# === This file is part of Calamares - <https://github.com/calamares> ===
+#
+# SPDX-License-Identifier: BSD-2-Clause
+# SPDX-FileCopyrightText: 2017-2020 Adriaan de Groot <groot@kde.org>
+# SPDX-FileCopyrightText: 2015-2016 Teo Mrnjavac <teo@kde.org>
+#
+# This file is Free Software: you can redistribute it and/or modify
+# it under the terms of the 2-clause BSD License.
+#
+### END LICENSE
+
+### USAGE
#
# Fetch the Transifex translations for Calamares and incorporate them
# into the source tree, adding commits of the different files.
@@ -6,6 +20,8 @@
# Run this (occasionally) at the top-level directory to get
# new translations. See also CMakeLists.txt and ci/txstats.py
# for update instructions.
+#
+### END USAGE
### INITIAL SETUP
#
@@ -32,8 +48,8 @@ test -f "calamares.desktop" || { echo "! Not at Calamares top-level" ; exit 1 ;
XMLLINT=""
for _xmllint in xmllint
do
- $_xmllint --version > /dev/null 2>&1 && XMLLINT=$_xmllint
- test -n "$XMLLINT" && break
+ $_xmllint --version > /dev/null 2>&1 && XMLLINT=$_xmllint
+ test -n "$XMLLINT" && break
done
# XMLLINT is optional
@@ -53,9 +69,9 @@ tx pull --force --source --all
# so clean them up after pulling.
#
drop_language() {
- rm -rf lang/python/"$1" src/modules/dummypythonqt/lang/"$1" lang/calamares_"$1".ts
- grep -v "\\[$1]" calamares.desktop > calamares.desktop.new
- mv calamares.desktop.new calamares.desktop
+ rm -rf lang/python/"$1" src/modules/dummypythonqt/lang/"$1" lang/calamares_"$1".ts
+ grep -v "\\[$1]" calamares.desktop > calamares.desktop.new
+ mv calamares.desktop.new calamares.desktop
}
drop_language es_ES
@@ -68,10 +84,10 @@ mv calamares.desktop.new calamares.desktop
# And fixup the XML files like in txpush.sh
if test -n "$XMLLINT" ; then
- for TS_FILE in lang/calamares_*.ts
- do
- $XMLLINT --c14n11 "$TS_FILE" | { echo "<!DOCTYPE TS>" ; cat - ; } | $XMLLINT --format --encode utf-8 -o "$TS_FILE".new - && mv "$TS_FILE".new "$TS_FILE"
- done
+ for TS_FILE in lang/calamares_*.ts
+ do
+ $XMLLINT --c14n11 "$TS_FILE" | { echo "<!DOCTYPE TS>" ; cat - ; } | $XMLLINT --format --encode utf-8 -o "$TS_FILE".new - && mv "$TS_FILE".new "$TS_FILE"
+ done
fi
@@ -108,24 +124,24 @@ git diff --numstat src/modules | awk '($1==1 && $2==1){print $3}' | xargs git ch
# Go through the Python modules; those with a lang/ subdir have their
# own complete gettext-based setup.
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
- # Convert PO files to MO files
- for POFILE in $(find ${MODULE_DIR} -name "*.po") ; do
- sed -i'' '/^"Content-Type/s/CHARSET/UTF-8/' $POFILE
- msgfmt -o ${POFILE%.po}.mo $POFILE
- done
- git add --verbose ${MODULE_DIR}/lang/*
- git commit "$AUTHOR" --message="i18n: [${MODULE_NAME}] $BOILERPLATE" | true
- fi
- fi
+ 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
+ # Convert PO files to MO files
+ for POFILE in $(find ${MODULE_DIR} -name "*.po") ; do
+ sed -i'' '/^"Content-Type/s/CHARSET/UTF-8/' $POFILE
+ msgfmt -o ${POFILE%.po}.mo $POFILE
+ done
+ git add --verbose ${MODULE_DIR}/lang/*
+ git commit "$AUTHOR" --message="i18n: [${MODULE_NAME}] $BOILERPLATE" | true
+ fi
+ fi
done
for POFILE in $(find lang -name "python.po") ; do
- sed -i'' '/^"Content-Type/s/CHARSET/UTF-8/' $POFILE
- msgfmt -o ${POFILE%.po}.mo $POFILE
+ sed -i'' '/^"Content-Type/s/CHARSET/UTF-8/' $POFILE
+ msgfmt -o ${POFILE%.po}.mo $POFILE
done
git add --verbose lang/python*
git commit "$AUTHOR" --message="i18n: [python] $BOILERPLATE" | true
diff --git a/ci/txpush.sh b/ci/txpush.sh
index 6882fa523..3195f42b4 100755
--- a/ci/txpush.sh
+++ b/ci/txpush.sh
@@ -1,13 +1,33 @@
#!/bin/sh
+
+### LICENSE
+# === This file is part of Calamares - <https://github.com/calamares> ===
+#
+# SPDX-License-Identifier: BSD-2-Clause
+# SPDX-FileCopyrightText: 2017-2020 Adriaan de Groot <groot@kde.org>
+# SPDX-FileCopyrightText: 2015-2016 Teo Mrnjavac <teo@kde.org>
+#
+# This file is Free Software: you can redistribute it and/or modify
+# it under the terms of the 2-clause BSD License.
+#
+### END LICENSE
+
+### USAGE
#
# Extract translations from Calamares source and send them
-# to Transifex.
+# to Transifex. Also (forcibly) updates the git "translation"
+# tag to document that source texts were updated and sent;
+# this is used by txcheck.sh to ensure that there's enough
+# time between updates and releases, and that strings don't
+# change between updates and releases.
#
# Run this at the top-level.
#
# Use the --no-tx option to do the extraction, but not the
# pushing-to-Transifex part. This can be useful to check for
# new strings or when testing the tools themselves.
+#
+### END USAGE
### INITIAL SETUP
#
@@ -28,21 +48,21 @@ test -f ".tx/config" || { echo "! Not at Calamares top-level" ; exit 1 ; }
test -f "calamares.desktop" || { echo "! Not at Calamares top-level" ; exit 1 ; }
if test "x$1" = "x--no-tx" ; then
- # tx is the transifex command -- eat its arguments and do nothing
- tx() {
- echo "Skipped tx $*"
- }
- # txtag is used to tag in git to measure changes -- skip it too
- txtag() {
- echo "Skipped tx tagging."
- }
+ # tx is the transifex command -- eat its arguments and do nothing
+ tx() {
+ echo "Skipped tx $*"
+ }
+ # txtag is used to tag in git to measure changes -- skip it too
+ txtag() {
+ echo "Skipped tx tagging."
+ }
else
- # tx is the regular transifex command
- # txtag is used to tag in git to measure changes
- txtag() {
- git tag -f translation
- git push --force origin translation
- }
+ # tx is the regular transifex command
+ # txtag is used to tag in git to measure changes
+ txtag() {
+ git tag -f translation
+ git push --force origin translation
+ }
fi
@@ -52,18 +72,18 @@ fi
LUPDATE=""
for _lupdate in lupdate-qt5 lupdate
do
- export QT_SELECT=5
- $_lupdate -version > /dev/null 2>&1 || export QT_SELECT=qt5
- $_lupdate -version > /dev/null 2>&1 && LUPDATE=$_lupdate
- test -n "$LUPDATE" && break
+ export QT_SELECT=5
+ $_lupdate -version > /dev/null 2>&1 || export QT_SELECT=qt5
+ $_lupdate -version > /dev/null 2>&1 && LUPDATE=$_lupdate
+ test -n "$LUPDATE" && break
done
test -n "$LUPDATE" || { echo "! No working lupdate" ; lupdate -version ; exit 1 ; }
XMLLINT=""
for _xmllint in xmllint
do
- $_xmllint --version > /dev/null 2>&1 && XMLLINT=$_xmllint
- test -n "$XMLLINT" && break
+ $_xmllint --version > /dev/null 2>&1 && XMLLINT=$_xmllint
+ test -n "$XMLLINT" && break
done
# XMLLINT is optional
@@ -82,8 +102,8 @@ $LUPDATE -no-obsolete $_srcdirs -ts lang/calamares_en.ts
# $LUPDATE -no-obsolete -extensions cxxtr src/libcalamares/locale -ts lang/tz_en.ts
if test -n "$XMLLINT" ; then
- TS_FILE="lang/calamares_en.ts"
- $XMLLINT --c14n11 "$TS_FILE" | { echo "<!DOCTYPE TS>" ; cat - ; } | $XMLLINT --format --encode utf-8 -o "$TS_FILE".new - && mv "$TS_FILE".new "$TS_FILE"
+ TS_FILE="lang/calamares_en.ts"
+ $XMLLINT --c14n11 "$TS_FILE" | { echo "<!DOCTYPE TS>" ; cat - ; } | $XMLLINT --format --encode utf-8 -o "$TS_FILE".new - && mv "$TS_FILE".new "$TS_FILE"
fi
tx push --source --no-interactive -r calamares.calamares-master
@@ -103,29 +123,29 @@ PYGETTEXT="xgettext --keyword=_n:1,2 -L python"
SHARED_PYTHON=""
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} -o ${MODULE_NAME}.pot ${MODULE_DIR}/*.py
- POTFILE="${MODULE_DIR}/lang/${MODULE_NAME}.pot"
- if [ -f "$POTFILE" ]; then
- sed -i'' '/^"Content-Type/s/CHARSET/UTF-8/' "$POTFILE"
- tx set -r calamares.${MODULE_NAME} --source -l en "$POTFILE"
- tx push --source --no-interactive -r calamares.${MODULE_NAME}
- fi
- else
- SHARED_PYTHON="$SHARED_PYTHON $FILES"
- fi
- fi
+ 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} -o ${MODULE_NAME}.pot ${MODULE_DIR}/*.py
+ POTFILE="${MODULE_DIR}/lang/${MODULE_NAME}.pot"
+ if [ -f "$POTFILE" ]; then
+ sed -i'' '/^"Content-Type/s/CHARSET/UTF-8/' "$POTFILE"
+ tx set -r calamares.${MODULE_NAME} --source -l en "$POTFILE"
+ tx push --source --no-interactive -r calamares.${MODULE_NAME}
+ fi
+ else
+ SHARED_PYTHON="$SHARED_PYTHON $FILES"
+ fi
+ fi
done
if test -n "$SHARED_PYTHON" ; then
- ${PYGETTEXT} -p lang -d python -o python.pot $SHARED_PYTHON
- POTFILE="lang/python.pot"
- sed -i'' '/^"Content-Type/s/CHARSET/UTF-8/' "$POTFILE"
- tx set -r calamares.python --source -l en "$POTFILE"
- tx push --source --no-interactive -r calamares.python
+ ${PYGETTEXT} -p lang -d python -o python.pot $SHARED_PYTHON
+ POTFILE="lang/python.pot"
+ sed -i'' '/^"Content-Type/s/CHARSET/UTF-8/' "$POTFILE"
+ tx set -r calamares.python --source -l en "$POTFILE"
+ tx push --source --no-interactive -r calamares.python
fi
txtag