expose top level subtyping functions
[hiphop-php.git] / hphp / hack / opam_helpers.sh
blobd97dafdc717f1189b0540fdb6d0d2f0d4320ec11
1 #!/bin/bash
2 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
4 # To be sourced by main script
6 # Shamelessly copied from
7 # https://github.com/facebook/infer/blob/master/scripts/opam_utils.sh
8 # Many thanks to the infer team :D
10 opam_require_version_2 () {
11 local status=0
12 local version=0
13 { version=$(opam --version 2>/dev/null); status=$?; }
14 if [ "$status" != 0 ]; then
15 # Suppress Warning: the `` without quotes in the next line is intentional
16 # shellcheck disable=SC2016
17 printf '*** ERROR: `opam --version` failed, please install opam version 2\n' >&2
18 env >&2
19 exit 1
21 case $version in
22 2*) ;;
24 printf '*** ERROR: opam version "%s" is not supported, please install opam version 2\n' "$version" >&2
25 printf '*** NOTE: opam is "%s"\n' "$(command -v opam)" >&2
26 env >&2
27 exit 1
28 esac