-msg_step="Prepare for jenkins build"
-
-set -x
-export BUILD_GROUP="jenkins"
-export WGET_OPENDEV="wget --no-check-certificate"
-export LOCALDISK="${WORKSPACE}/localdisk"
-export MIRROR_DIR="${WORKSPACE}/mirror"
-
-mkdir -p ${LOCALDISK}/loadbuild/mock-cache
-mkdir -p ${LOCALDISK}/loadbuild/mock
-mkdir -p ${LOCALDISK}/designer
-mkdir -p ${LOCALDISK}/loadbuild
-
-#sudo mkdir -p ${MIRROR_DIR}/CentOS
-get_mirror
-
-sudo chmod 775 ${LOCALDISK}/loadbuild/mock
-sudo chown root:mock ${LOCALDISK}/loadbuild/mock
-sudo chmod 775 ${LOCALDISK}/loadbuild/mock-cache
-sudo chown root:mock ${LOCALDISK}/loadbuild/mock-cache
-
-# Download required dependencies by mirror/build processes.
-sudo yum install -y \
- anaconda \
- anaconda-runtime \
- autoconf-archive \
- autogen \
- automake \
- bc \
- bind \
- bind-utils \
- bison \
- cpanminus \
- createrepo \
- createrepo_c \
- deltarpm \
- docker-client \
- expat-devel \
- flex \
- isomd5sum \
- gcc \
- gettext \
- git \
- libguestfs-tools \
- libtool \
- libxml2 \
- lighttpd \
- lighttpd-fastcgi \
- lighttpd-mod_geoip \
- net-tools \
- mkisofs \
- mongodb \
- mongodb-server \
- pax \
- perl-CPAN \
- python-deltarpm \
- python-pep8 \
- python-pip \
- python-psutil \
- python2-psutil \
- python36-psutil \
- python36-requests \
- python3-devel \
- python-sphinx \
- python-subunit \
- python-virtualenv \
- python-yaml \
- python2-ruamel-yaml \
- postgresql \
- qemu-kvm \
- quilt \
- rpm-build \
- rpm-sign \
- rpm-python \
- squashfs-tools \
- sudo \
- systemd \
- syslinux \
- udisks2 \
- vim-enhanced \
- wget
-
-# clone the tools repo
-cd ~
-git clone https://opendev.org/starlingx/tools.git
-
-# mock custumizations
-# forcing chroots since a couple of packages naughtily insist on network access and
-# we dont have nspawn and networks happy together.
-sudo useradd -s /sbin/nologin -u 9001 -g 9001 mockbuild
-sudo rmdir /var/lib/mock
-sudo ln -s ${LOCALDISK}/loadbuild/mock /var/lib/mock
-sudo rmdir /var/cache/mock
-sudo ln -s ${LOCALDISK}/loadbuild/mock-cache /var/cache/mock
-echo "config_opts['use_nspawn'] = False" | sudo tee -a /etc/mock/site-defaults.cfg
-echo "config_opts['rpmbuild_networking'] = True" | sudo tee -a /etc/mock/site-defaults.cfg
-echo | sudo tee -a /etc/mock/site-defaults.cfg
-
-# cpan modules, installing with cpanminus to avoid stupid questions since cpan is whack
-sudo cpanm --notest Fatal
-sudo cpanm --notest XML::SAX
-sudo cpanm --notest XML::SAX::Expat
-sudo cpanm --notest XML::Parser
-sudo cpanm --notest XML::Simple
-
-# Install repo tool
-sudo wget https://storage.googleapis.com/git-repo-downloads/repo -O /usr/local/bin/repo
-sudo chmod a+x /usr/local/bin/repo
-
-# installing go and setting paths
-export GOPATH="/usr/local/go"
-export PATH="${GOPATH}/bin:${PATH}"
-sudo yum install -y golang
-sudo mkdir -p ${GOPATH}/bin
-curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sudo sh
-
-# pip installs
-# Install required python modules globally; versions are in the constraints file.
-# Be careful not to replace modules provided by RPMs as it may break
-# other system packages. Look for warnings similar to "Uninstalling a
-# distutils installed project has been deprecated" from pip.
-sudo pip install -c ~/tools/toCOPY/builder-constraints.txt \
- testrepository \
- fixtures \
- pbr \
- git-review \
- python-subunit \
- junitxml \
- testtools
-
-# Create a sane py27 virtualenv
-virtualenv /opt/py27 && \
- source /opt/py27/bin/activate && \
- sudo pip install -c ~/tools/toCOPY/builder-opt-py27-constraints.txt \
- tox \
- && \
- for prog in tox ; do \
- ln -s /opt/py27/bin/$prog /usr/bin ; \
- done
-
-# Inherited tools for mock stuff
-# we at least need the mock_cache_unlock tool
-# they install into /usr/bin
-sudo cp -rf ~/tools/toCOPY/mock_overlay /opt/mock_overlay
-cd /opt/mock_overlay
-make
-sudo make install
-
-# This image requires a set of scripts and helpers
-# for working correctly, in this section they are
-# copied inside the image.
-sudo cp ~/tools/toCOPY/finishSetup.sh /usr/local/bin
-sudo cp ~/tools/toCOPY/populate_downloads.sh /usr/local/bin
-sudo cp ~/tools/toCOPY/generate-local-repo.sh /usr/local/bin
-sudo cp ~/tools/toCOPY/generate-centos-repo.sh /usr/local/bin
-sudo cp ~/tools/toCOPY/lst_utils.sh /usr/local/bin