install-deps.sh: use GCC-7 on xenial also

Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit 8a0935988f)
This commit is contained in:
Kefu Chai 2017-12-09 19:29:58 +08:00
parent f95ab869e8
commit acfc351095

View File

@ -31,10 +31,19 @@ function ensure_decent_gcc_on_deb {
# new enough
local old=$(gcc -dumpversion)
local new=$1
if dpkg --compare-versions $old ge 5.1; then
if dpkg --compare-versions $old ge 7.0; then
return
fi
if [ ! -f /usr/bin/gcc-${old} ]; then
case $(lsb_release --short --codename) in
trusty)
old=4.8;;
xenial)
old=5;;
esac
fi
$SUDO update-alternatives --remove-all gcc || true
$SUDO update-alternatives \
--install /usr/bin/gcc gcc /usr/bin/gcc-${new} 20 \
--slave /usr/bin/g++ g++ /usr/bin/g++-${new}
@ -139,7 +148,7 @@ else
$SUDO apt-get install -y lsb-release devscripts equivs
$SUDO apt-get install -y dpkg-dev
case "$VERSION" in
*Trusty*)
*Trusty*|*Xenial*)
$SUDO apt-get install -y software-properties-common
$SUDO add-apt-repository ppa:ubuntu-toolchain-r/test
$SUDO apt-get update