f77336fab666ec9748b38c982254c42fc7c3e913
[releng/builder.git] / packer / provision / devstack-pre-pip.sh
1 #!/bin/bash
2
3 # force any errors to cause the script and job to end in failure
4 set -xeu -o pipefail
5
6 # add in a test copr repo
7 wget http://copr.fedoraproject.org/coprs/tykeal/odl-updates/repo/epel-7/tykeal-odl-updates-epel-7.repo -O /etc/yum.repos.d/tykeal-odl-updates-epel-7.repo
8 # Install xpath
9 yum install -y perl-XML-XPath python-pip python-six
10
11 # install crudini command line tool for editing config files
12 yum install -y crudini
13
14 echo '---> Installing non-baseline requirements'
15 yum install -y deltarpm nc python{,-{crypto,devel,lxml,setuptools}} \
16     @development {lib{xml2,xslt,ffi},openssl}-devel git wget
17
18 echo '---> Updating net link setup'
19 if [ ! -f /etc/udev/rules.d/80-net-setup-link.rules ]; then
20     ln -s /dev/null /etc/udev/rules.d/80-net-setup-link.rules
21 fi
22
23 echo '---> Pre-installing yum and pip packages'
24 projs="requirements keystone glance cinder neutron nova horizon"
25 # shellcheck disable=SC2154
26 branch=${os_branch}
27 # strip the "stable" off of the branch
28 branch_name=$(cut -d'/' -f2 <<< "${branch}")
29
30 # Do not upgrade pip to v10. v10 does not allow uninstalling
31 # distutils installed packages. This fails the openstack pip installs
32 # below when it attempts to uninstall packages.
33 # devstack patch that is trying to get pip 10 working:
34 # https://review.openstack.org/#/c/561597/
35 # wget https://bootstrap.pypa.io/get-pip.py
36 # python get-pip.py
37
38 mkdir tmp
39 cd tmp
40
41 git clone https://github.com/openstack-dev/devstack.git
42 (cd devstack && git checkout "${branch}")
43 sed -e 's/#.*//' devstack/files/rpms/general | xargs yum install -y
44
45 base_url=https://github.com/openstack/
46 for proj in $projs
47 do
48     git clone "${base_url}${proj}"
49     (cd "${proj}" && git checkout "${branch}")
50     pip install -c requirements/upper-constraints.txt -e "${proj}"
51     pip install -c requirements/upper-constraints.txt -r "${proj}/test-requirements.txt"
52 done
53
54 echo '---> Installing openvswitch from relevant openstack branch'
55 yum install -y "centos-release-openstack-${branch_name}"
56
57 # install 2.8.2 for queens.
58 # 2.9.0 is the current version in openstack-queens, but it is buggy.
59 # Remove this when https://review.rdoproject.org/r/#/c/13839/ merges and 2.9.2 is in the repo.
60 if [ "${branch}" == "stable/queens" ]; then
61     yum install -y --nogpgcheck openvswitch-1:2.8.2
62 else
63     yum install -y --nogpgcheck openvswitch
64 fi
65
66 cd "$OLDPWD"
67 rm -fr tmp
68
69 # vim: sw=4 ts=4 sts=4 et :