provision: Replace transifex-client with new transifex-cli.

transifex-client went EOL on November 30, 2022, replaced by
transifex/cli [^1].

Swap this in-place, since per the upstream README [^2]:

> The current version of the client maintains backwards compatibility
> for the tx push and tx pull commands. So, if you have a CI setup that
> uses them, you should not have to change anything.

As the mobile team found out, this is a partial truth if one previously
used some of the more advanced CLI flags, but all workflows referenced
in tools/ and docs/ use forwards-compatible flags to the new version.

[^1]: https://github.com/transifex/transifex-client/

[^2]: a0f28a1cf3/README.md
This commit is contained in:
Josh Klar 2022-12-07 23:25:46 -08:00 committed by Tim Abbott
parent c31dc14e9d
commit 0c44b933c8
3 changed files with 60 additions and 11 deletions

View File

@ -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] [main]
host = https://www.transifex.com host = https://www.transifex.com
lang_map = zh-Hans: zh_Hans, zh-Hant: zh_Hant lang_map = zh-Hans: zh_Hans, zh-Hant: zh_Hant
[zulip.djangopo] [o:zulip:p:zulip:r:djangopo]
file_filter = locale/<lang>/LC_MESSAGES/django.po file_filter = locale/<lang>/LC_MESSAGES/django.po
source_file = locale/en/LC_MESSAGES/django.po source_file = locale/en/LC_MESSAGES/django.po
source_lang = en source_lang = en
type = PO type = PO
[zulip.translationsjson] [o:zulip:p:zulip:r:mobile]
file_filter = locale/<lang>/translations.json
source_file = locale/en/translations.json
source_lang = en
type = KEYVALUEJSON
[zulip.mobile]
file_filter = locale/<lang>/mobile.json file_filter = locale/<lang>/mobile.json
source_file = locale/en/mobile.json source_file = locale/en/mobile.json
source_lang = en source_lang = en
type = KEYVALUEJSON type = KEYVALUEJSON
[zulip-test.djangopo] [o:zulip:p:zulip:r:translationsjson]
file_filter = locale/<lang>/translations.json
source_file = locale/en/translations.json
source_lang = en
type = KEYVALUEJSON
[o:zulip:p:zulip-test:r:djangopo]
file_filter = locale/<lang>/LC_MESSAGES/django.po file_filter = locale/<lang>/LC_MESSAGES/django.po
source_file = locale/en/LC_MESSAGES/django.po source_file = locale/en/LC_MESSAGES/django.po
source_lang = en source_lang = en
type = PO type = PO
[zulip-test.translationsjson] [o:zulip:p:zulip-test:r:translationsjson]
file_filter = locale/<lang>/translations.json file_filter = locale/<lang>/translations.json
source_file = locale/en/translations.json source_file = locale/en/translations.json
source_lang = en source_lang = en

View File

@ -109,7 +109,6 @@ COMMON_DEPENDENCIES = [
"ca-certificates", # Explicit dependency in case e.g. curl is already installed "ca-certificates", # Explicit dependency in case e.g. curl is already installed
"puppet", # Used by lint (`puppet parser validate`) "puppet", # Used by lint (`puppet parser validate`)
"gettext", # Used by makemessages i18n "gettext", # Used by makemessages i18n
"transifex-client", # Needed to sync translations from transifex
"curl", # Used for testing our API documentation "curl", # Used for testing our API documentation
"moreutils", # Used for sponge command "moreutils", # Used for sponge command
"unzip", # Needed for Slack import "unzip", # Needed for Slack import
@ -429,6 +428,9 @@ def main(options: argparse.Namespace) -> NoReturn:
# Install shfmt. # Install shfmt.
run_as_root(["tools/setup/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() setup_venvs.main()
run_as_root(["cp", REPO_STOPWORDS_PATH, TSEARCH_STOPWORDS_PATH]) run_as_root(["cp", REPO_STOPWORDS_PATH, TSEARCH_STOPWORDS_PATH])

View File

@ -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