summaryrefslogtreecommitdiffstats
path: root/storage/mroonga/packages/yum/build-in-vm.sh
blob: fc84e45024c71aeac915d53d430a215ea794d93e (plain)
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
85
#!/bin/sh

if [ $# != 5 ]; then
    echo "Usage: $0 PACKAGE SPEC_DIR MYSQL_VARIANTS ARCHITECTURES"
    echo " e.g.: $0 mroonga ../rpm/centos 'mysql55 mariadb' 'i386 x86_64' '6 7'"
    exit 1
fi

PACKAGE="$1"
SPEC_DIR="$2"
MYSQL_VARIANTS="$3"
ARCHITECTURES="$4"
CENTOS_VERSIONS="$5"

run()
{
  "$@"
  if test $? -ne 0; then
    echo "Failed $@"
    exit 1
  fi
}

run vagrant destroy --force

for mysql_variant in ${MYSQL_VARIANTS}; do
  rm -rf tmp/centos/
  mkdir -p tmp/centos/
  cp ${SPEC_DIR}/${mysql_variant}-${PACKAGE}.spec tmp/centos/

  architectures="${ARCHITECTURES}"
  case ${mysql_variant} in
    mysql55)
      centos_versions="6"
      ;;
    mysql56-community)
      centos_versions="6 7"
      ;;
    mysql57-community)
      centos_versions="6 7"
      ;;
    mariadb)
      centos_versions="7"
      ;;
    mariadb-10.1)
      centos_versions="6 7"
      ;;
    mariadb-10.2)
      centos_versions="6 7"
      ;;
    percona-server-56)
      centos_versions="6 7"
      ;;
    percona-server-57)
      centos_versions="6 7"
      ;;
  esac

  for architecture in ${architectures}; do
    for centos_version in ${centos_versions}; do
      skip=1
      for given_version in ${CENTOS_VERSIONS}; do
        if [ ${given_version} = ${centos_version} ]; then
          skip=0
        fi
      done
      if [ $skip -eq 1 ]; then
        continue
      fi
      if [ ${mysql_variant} = mysql55 -a ${centos_version} = 6 -a ${architecture} = i386 ]; then
        continue
      fi
      if [ ${centos_version} = 7 -a ${architecture} = i386 ]; then
        continue
      fi
      id=centos-${centos_version}-${architecture}
      vagrant up ${id}
      build_status=$?
      if [ $build_status -ne 0 ]; then
        exit $build_status
      fi
      vagrant destroy --force ${id}
    done
  done
done