The main purpose of this patch is trying to fix the problem about
"sudo pip xxxx" error. In this patch, the following things will be
done.
1. Add a function which is used for checking pip environments in
iec-compass-build.sh.
The check_env function was added in iec-compass-build.sh file.
It will be used for checking whether there is any error when
running "sudo pip xxx" and "pip xxx" command. If error existed,
the pip software will be reinstall.
2. Remove the "sed" command which is used for replaceing the "sudo
pip xxx" command.
Since the compass requires some software which need to be run on
sudo mode, there is no need to replace those "sudo" command by
"python -m pip install xxx". So the replace cmd was removed.
Signed-off-by: Jingzhao.Ni <Jingzhao.Ni@arm.com>
Change-Id: I384e8213926e86ec9aafbcf20c3586291f63e016
#!/bin/bash
set -e
+check_env(){
+ #Checking python-pip software status. If failed, reinstall it.
+ set +e
+ sudo pip --version
+ CHECK_PIP_SUDO=$?
+
+ pip --version
+ CHECK_PIP_USER=$?
+ set -e
+
+ #Check command result, if failed, reinstall the pip
+ if [ ${CHECK_PIP_SUDO} -ne 0 ] || [ ${CHECK_PIP_USER} -ne 0 ]; then
+ echo "Reinstall pip"
+ sudo python -m pip uninstall -y pip
+ curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
+ sudo python get-pip.py pip
+ rm get-pip.py
+ hash -r
+ fi
+}
+
+check_env
+
echo "begin build compass"
git clone https://github.com/opnfv/compass4nfv.git
curl -s http://people.linaro.org/~yibo.cai/compass/compass4nfv-arm64-fixup.sh | bash || true
-sed -i "s/sudo pip install pyyaml/python -m pip install pyyaml --user/g" build.sh
-
./build.sh
exit 0