[build] fix opam_retry

Summary:
Not sure what's going on but even though `set -e` is passed,
`install_opam_deps` was seen as succeeding even when the `opam install`
command failed. This prevented `opam_retry` from getting triggered (and
the error was also silently ignored).

Also get rid of a couple of useless subshells in `opam_retry`.

Reviewed By: jberdine

Differential Revision: D18615860

fbshipit-source-id: 360232623
master
Jules Villard 5 years ago committed by Facebook Github Bot
parent 190fc51f25
commit b82450d576

@ -122,8 +122,8 @@ if [ "$INTERACTIVE" == "no" ] || [ "$USER_OPAM_SWITCH" == "no" ]; then
fi fi
setup_opam () { setup_opam () {
opam var root 1>/dev/null 2>/dev/null || opam init --reinit --bare --no-setup opam var root 1>/dev/null 2>/dev/null || opam init --reinit --bare --no-setup &&
opam_switch_create_if_needed "$INFER_OPAM_SWITCH" "$INFER_OPAM_COMPILER" opam_switch_create_if_needed "$INFER_OPAM_SWITCH" "$INFER_OPAM_COMPILER" &&
opam switch set "$INFER_OPAM_SWITCH" opam switch set "$INFER_OPAM_SWITCH"
} }
@ -132,7 +132,7 @@ install_opam_deps () {
if [ "$USE_OPAM_LOCK" == yes ]; then if [ "$USE_OPAM_LOCK" == yes ]; then
locked=--locked locked=--locked
fi fi
opam install --deps-only infer "$INFER_ROOT" $locked opam install --deps-only infer "$INFER_ROOT" $locked &&
if [ -n "$SANDCASTLE" ]; then if [ -n "$SANDCASTLE" ]; then
opam pin list | grep yojson || opam pin add yojson "${DEPENDENCIES_DIR}/yojson-1.7.0fix" opam pin list | grep yojson || opam pin add yojson "${DEPENDENCIES_DIR}/yojson-1.7.0fix"
fi fi

@ -7,17 +7,17 @@
# source this script to import its utility functions # source this script to import its utility functions
opam_retry () { opam_retry () {
"$@" || ( \ "$@" || {
echo >&2; \ echo >&2;
printf '*** `%s` failed\n' "$*" >&2; \ printf '*** `%s` failed\n' "$*" >&2;
echo '*** Updating opam then retrying' >&2; \ echo '*** Updating opam then retrying' >&2;
opam update && \ opam update &&
"$@" || ( \ "$@" || {
echo >&2; \ echo >&2;
printf '*** ERROR: `%s` failed\n' "$*" >&2; \ printf '*** ERROR: `%s` failed\n' "$*" >&2;
exit 1 \ exit 1
) \ }
) }
} }
opam_failed () { opam_failed () {

Loading…
Cancel
Save