fune/taskcluster/scripts/builder/build-l10n.sh
Ricky Stewart 34344a8073 Bug 1661624 - Include psutil in the mach virtualenvs r=firefox-build-system-reviewers,rstewart
Install `psutil` when setting up the `mach` `virtualenv`s and stop importing the in-tree version in the build.

Nothing in-tree currently assumes or mandates the installation of `psutil` (all uses of `psutil` are guarded with imports of the form `try : import psutil; except ImportError: psutil = None`), so there's no back-incompatibility concerns here. There will be an awkward period where telemetry will be lacking CPU/disk data for everyone until they re-run `mach bootstrap` or `mach create-mach-environment`, but that will come back as people gradually update their `virtualenv`s.

An alternative to circumvent that issue is REQUIRING that `psutil` be installed by adding an assertion in `mach` that `psutil` can be found (allowing us to remove all the conditional logic in-tree around whether `psutil` is installed), but I wouldn't claim that we're ready to do that and deal with whatever fallout might occur.

Differential Revision: https://phabricator.services.mozilla.com/D90914
2020-11-27 21:05:00 +00:00

111 lines
3 KiB
Bash
Executable file

#! /bin/bash -vex
set -x -e
echo "running as" $(id)
. /builds/worker/scripts/xvfb.sh
####
# Taskcluster friendly wrapper for performing fx desktop l10n repacks via mozharness.
# Based on ./build-linux.sh
####
# Inputs, with defaults
: MOZHARNESS_SCRIPT ${MOZHARNESS_SCRIPT}
: MOZHARNESS_CONFIG ${MOZHARNESS_CONFIG}
: MOZHARNESS_CONFIG_PATHS ${MOZHARNESS_CONFIG_PATHS}
: MOZHARNESS_ACTIONS ${MOZHARNESS_ACTIONS}
: MOZHARNESS_OPTIONS ${MOZHARNESS_OPTIONS}
: TOOLTOOL_CACHE ${TOOLTOOL_CACHE:=/builds/worker/tooltool-cache}
: MOZ_SCM_LEVEL ${MOZ_SCM_LEVEL:=1}
: NEED_XVFB ${NEED_XVFB:=false}
: MOZ_SCM_LEVEL ${MOZ_SCM_LEVEL:=1}
: WORKSPACE ${WORKSPACE:=/builds/worker/workspace}
: MOZ_OBJDIR ${MOZ_OBJDIR:=$WORKSPACE/obj-build}
set -v
fail() {
echo # make sure error message is on a new line
echo "[build-l10n.sh:error]" "${@}"
exit 1
}
export MOZ_CRASHREPORTER_NO_REPORT=1
export TINDERBOX_OUTPUT=1
# Ensure that in tree libraries can be found
export LIBRARY_PATH=$LIBRARY_PATH:$WORKSPACE/obj-build:$WORKSPACE/src/gcc/lib64
# test required parameters are supplied
if [[ -z ${MOZHARNESS_SCRIPT} ]]; then fail "MOZHARNESS_SCRIPT is not set"; fi
if [[ -z "${MOZHARNESS_CONFIG}" && -z "${EXTRA_MOZHARNESS_CONFIG}" ]]; then fail "MOZHARNESS_CONFIG or EXTRA_MOZHARNESS_CONFIG is not set"; fi
cleanup() {
local rv=$?
cleanup_xvfb
exit $rv
}
trap cleanup EXIT INT
# run XVfb in the background, if necessary
if $NEED_XVFB; then
start_xvfb '1024x768x24' 2
fi
# set up mozharness configuration, via command line, env, etc.
# $TOOLTOOL_CACHE bypasses mozharness completely and is read by tooltool_wrapper.sh to set the
# cache. However, only some mozharness scripts use tooltool_wrapper.sh, so this may not be
# entirely effective.
export TOOLTOOL_CACHE
export MOZ_OBJDIR
config_path_cmds=""
for path in ${MOZHARNESS_CONFIG_PATHS}; do
config_path_cmds="${config_path_cmds} --extra-config-path ${GECKO_PATH}/${path}"
done
# support multiple, space delimited, config files
config_cmds=""
for cfg in $MOZHARNESS_CONFIG; do
config_cmds="${config_cmds} --config ${cfg}"
done
# if MOZHARNESS_ACTIONS is given, only run those actions (completely overriding default_actions
# in the mozharness configuration)
if [ -n "$MOZHARNESS_ACTIONS" ]; then
actions=""
for action in $MOZHARNESS_ACTIONS; do
actions="$actions --$action"
done
fi
# if MOZHARNESS_OPTIONS is given, append them to mozharness command line run
if [ -n "$MOZHARNESS_OPTIONS" ]; then
options=""
for option in $MOZHARNESS_OPTIONS; do
options="$options --$option"
done
fi
cd /builds/worker
$GECKO_PATH/mach python \
--requirements $GECKO_PATH/taskcluster/scripts/builder/requirements.txt \
-- \
$GECKO_PATH/testing/${MOZHARNESS_SCRIPT} \
${config_path_cmds} \
${config_cmds} \
$actions \
$options \
--log-level=debug \
--work-dir=$WORKSPACE \