forked from ocaml/opam-repository
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.travis-ci.sh
executable file
·84 lines (76 loc) · 2.29 KB
/
.travis-ci.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
echo pull req: $TRAVIS_PULL_REQUEST
if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
curl https://github.com/$TRAVIS_REPO_SLUG/pull/$TRAVIS_PULL_REQUEST.diff -o pullreq.diff
else
git show > pullreq.diff.tmp
merge=`grep "^Merge: " pullreq.diff.tmp | awk -F: '{print $2}'`
if [ "$merge" = "" ]; then
echo Not a merge
mv pullreq.diff.tmp pullreq.diff
else
echo Merge detected, extracting $merge diff
git show $merge > pullreq.diff
fi
fi
# Install OCaml and OPAM PPAs
case "$OCAML_VERSION,$OPAM_VERSION" in
3.12.1,1.0.0) ppa=avsm/ocaml312+opam10 ;;
3.12.1,1.1.0) ppa=avsm/ocaml312+opam11 ;;
4.00.1,1.0.0) ppa=avsm/ocaml40+opam10 ;;
4.00.1,1.1.0) ppa=avsm/ocaml40+opam11 ;;
4.01.0,1.0.0) ppa=avsm/ocaml41+opam10 ;;
4.01.0,1.1.0) ppa=avsm/ocaml41+opam11 ;;
*) echo Unknown $OCAML_VERSION,$OPAM_VERSION; exit 1 ;;
esac
echo "yes" | sudo add-apt-repository ppa:$ppa
sudo apt-get update -qq
sudo apt-get install -qq ocaml ocaml-native-compilers camlp4-extra opam time
echo OCaml version
ocaml -version
echo OPAM versions
opam --version
opam --git-version
export OPAMYES=1
cd $TRAVIS_BUILD_DIR
echo Pull request:
cat pullreq.diff
# CR: this will be replaced with the OCamlot analysis of affected packages
cat pullreq.diff | sort -u | grep '^... b/packages' | sed -E 's,\+\+\+ b/packages/.*/(.*)/.*,\1,' | grep -v '^files' | awk -F. '{print $1}'| sort -u > tobuild.txt
echo To Build:
cat tobuild.txt
function build_one {
pkg=$1
echo build one: $pkg
rm -rf ~/.opam
opam init .
# list all packages changed from opam 1.0 to 1.1
case "$OPAM_VERSION" in
1.0.0) allpkgs=`opam list -s` ;;
*) allpkgs=`opam list -s -a` ;;
esac
# test for installability
ok=0
for pkgi in $allpkgs; do if [ "$pkgi" = "$pkg" ]; then ok=1; fi; done
if [ $ok = "0" ]; then
echo Skipping $pkg as not installable
else
depext=`opam install $pkg -e ubuntu`
echo Ubuntu depexts: $depext
if [ "$depext" != "" ]; then
sudo apt-get install -qq pkg-config build-essential m4 $depext
fi
srcext=`opam install $pkg -e source,linux`
if [ "$srcext" != "" ]; then
curl -sL ${srcext} | bash
fi
opam install $pkg
opam remove $pkg
if [ "$depext" != "" ]; then
sudo apt-get remove $depext
sudo apt-get autoremove
fi
fi
}
for i in `cat tobuild.txt`; do
build_one $i
done