Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
provision: Replace transifex-client with new transifex-cli.
Josh Klar0c44b933c8da
diff --git a/.tx/config b/.tx/configindex 6fd94503ced..db432f095fb 100644--- a/.tx/config+++ b/.tx/config@@ -1,32 +1,39 @@+# Migrated from transifex-client format with `tx migrate`+#+# See https://developers.transifex.com/docs/using-the-client which hints at+# this format, but in general, the headings are in the format of:+#+# [o:<org>:p:<project>:r:<resource>]+[main]host = https://www.transifex.comlang_map = zh-Hans: zh_Hans, zh-Hant: zh_Hant-[zulip.djangopo]+[o:zulip:p:zulip:r:djangopo]file_filter = locale/<lang>/LC_MESSAGES/django.posource_file = locale/en/LC_MESSAGES/django.posource_lang = entype = PO-[zulip.translationsjson]-file_filter = locale/<lang>/translations.json-source_file = locale/en/translations.json+[o:zulip:p:zulip:r:mobile]+file_filter = locale/<lang>/mobile.json+source_file = locale/en/mobile.jsonsource_lang = entype = KEYVALUEJSON-[zulip.mobile]-file_filter = locale/<lang>/mobile.json-source_file = locale/en/mobile.json+[o:zulip:p:zulip:r:translationsjson]+file_filter = locale/<lang>/translations.json+source_file = locale/en/translations.jsonsource_lang = entype = KEYVALUEJSON-[zulip-test.djangopo]+[o:zulip:p:zulip-test:r:djangopo]file_filter = locale/<lang>/LC_MESSAGES/django.posource_file = locale/en/LC_MESSAGES/django.posource_lang = entype = PO-[zulip-test.translationsjson]+[o:zulip:p:zulip-test:r:translationsjson]file_filter = locale/<lang>/translations.jsonsource_file = locale/en/translations.jsonsource_lang = endiff --git a/tools/lib/provision.py b/tools/lib/provision.pyindex 2a911be3ed4..5994bf8e298 100755--- a/tools/lib/provision.py+++ b/tools/lib/provision.py@@ -109,7 +109,6 @@ COMMON_DEPENDENCIES = ["ca-certificates", # Explicit dependency in case e.g. curl is already installed"puppet", # Used by lint (`puppet parser validate`)"gettext", # Used by makemessages i18n- "transifex-client", # Needed to sync translations from transifex"curl", # Used for testing our API documentation"moreutils", # Used for sponge command"unzip", # Needed for Slack import@@ -429,6 +428,9 @@ def main(options: argparse.Namespace) -> NoReturn:# Install shfmt.run_as_root(["tools/setup/install-shfmt"])+ # Install transifex-cli.+ run_as_root([*proxy_env, "tools/setup/install-transifex-cli"])+setup_venvs.main()run_as_root(["cp", REPO_STOPWORDS_PATH, TSEARCH_STOPWORDS_PATH])diff --git a/tools/setup/install-transifex-cli b/tools/setup/install-transifex-clinew file mode 100755index 00000000000..ed08914046f--- /dev/null+++ b/tools/setup/install-transifex-cli@@ -0,0 +1,40 @@+#!/usr/bin/env bash+#+# As of 07 December 2022, per https://pkgs.org/download/transifex-cli, only+# Void Linux and KaOS package the new Go-based Transifex CLI officially, so our+# safest bet is to pull the binaries from GitHub Releases directly for now.+#+# These binaries do not dynamically link to anything, and thus should work on+# glibc and musl (Alpine, Void, etc.) systems equally well.+set -euo pipefail++version=1.6.4+arch="$(uname -m)"++case $arch in+ x86_64)+ tarball="tx-linux-amd64.tar.gz"+ sha256=954207aba3da6139886922c8927c67098a51602c3d78558864f164a791c39e77+ ;;++ aarch64)+ tarball="tx-linux-arm64.tar.gz"+ sha256=2d0a115edef8e2fda6c1a431d28fe3541de073c35dc1ec677ffff0e6d1dd7a08+ ;;+esac++check_version() {+ out="$(tx --version)" && [ "$out" = "TX Client, version=${version}" ]+}++if ! check_version 2>/dev/null; then+ tmpdir="$(mktemp -d)"+ trap 'rm -r "$tmpdir"' EXIT+ cd "$tmpdir"+ curl_opts=(-fLO --retry 3)+ curl "${curl_opts[@]}" "https://github.com/transifex/cli/releases/download/v${version}/${tarball}"+ sha256sum -c <<<"$sha256 $tarball"+ tar -xzf "$tarball" --no-same-owner tx+ install -Dm755 tx /usr/local/bin/tx+ check_version+fi