#! /bin/bash
#

set -ex

OCAML_VERSION=4.02.3

get()
{
  wget "https://raw.githubusercontent.com/ocaml/ocaml-ci-scripts/master/$1"
}

get .travis-ocaml.sh
sh  .travis-ocaml.sh

# list of packages -- excluding some that can't be installed on Travis
pkg()
{
	find packages/upstream -maxdepth 1 -mindepth 1 -type d \
	| awk -F/ '{print $NF}' \
	| egrep -v '^(systemd)'
}

# packages from xs/ that we can compile
XS='
cdrom
crc
fd-send-recv
nbd
netlink
opasswd
rpc
shared-block-ring
xapi-backtrace
xapi-inventory
xapi-rrd
xapi-stdext
xen-api-client
xenstore
xenstore_transport
'

# packages from xs-extra/ that we can compile
XS_EXTRA='
message-switch
vncproxy
'

# all of our packages that we can compile
XS_ALL="$XS $XS_EXTRA"

opam config exec -- opam repository add local file://$PWD
opam config exec -- opam repository remove default
opam config exec -- opam repository list
opam config exec -- opam install -y -j 2 $(pkg) $XS_ALL
# Workaround to mark failed uninstall as error
opam config exec -- opam remove -y $XS_ALL
opam config exec -- opam install -y -j 2 $XS_ALL



#! /bin/bash
#

set -ex

export OCAML_VERSION=4.02
export OPAM_INIT=false

get()
{
  wget "https://raw.githubusercontent.com/ocaml/ocaml-ci-scripts/master/$1"
}

get .travis-ocaml.sh
sh  .travis-ocaml.sh

# list of packages -- excluding some that can't be installed on Travis
pkg()
{
	find packages/upstream -maxdepth 1 -mindepth 1 -type d \
	| awk -F/ '{print $NF}' \
	| egrep -v '^(systemd)'
}

# packages from xs/ that we can compile
XS='
cdrom
crc
fd-send-recv
nbd
netlink
opasswd
rpc
shared-block-ring
xapi-backtrace
xapi-inventory
xapi-rrd
xapi-stdext
xen-api-client
xenstore
xenstore_transport
'

# packages from xs-extra/ that we can compile
XS_EXTRA='
message-switch
vncproxy
'

# all of our packages that we can compile
XS_ALL="$XS $XS_EXTRA"

opam init -y local file://$PWD
opam config exec -- opam install -y -j 4 $(pkg) $XS_ALL
# Workaround to mark failed uninstall as error. We only test
# the uninstall of the XS_ALL packages but not of the upstream packages.
opam config exec -- opam remove -y $XS_ALL
opam config exec -- opam install -y -j 4 $XS_ALL



Simplify and fix Opam setup in Travis
Simplify and fix Opam setup in Travis

This simplifies the setup of Opam in the Travis build. The Opam
repository only contains libraries from this repo and never uses
the public remote repository.

Previously the OACML_VERSION variable was not effective because it was
not exported and the script was executed in a sub shell. By exporting
it, it is now effective. Likewise, we use OCAML_INIT to avoid having the
Opam repository being initialised outside the travis.sh script.

Signed-off-by: Christian <4f88b50bc9dba63c9a7d9e208d4b3ac6f1a52800@citrix.com>
