New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
install-deps.sh: use DTS on centos if GCC is too old #19398
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,11 +26,11 @@ function munge_ceph_spec_in { | |
sed -e 's/@//g' -e 's/%bcond_with make_check/%bcond_without make_check/g' < ceph.spec.in > $OUTFILE | ||
} | ||
|
||
function ensure_decent_gcc { | ||
function ensure_decent_gcc_on_deb { | ||
# point gcc to the one offered by g++-7 if the used one is not | ||
# new enough | ||
old=$(gcc -dumpversion) | ||
new=$1 | ||
local old=$(gcc -dumpversion) | ||
local new=$1 | ||
if dpkg --compare-versions $old ge 5.1; then | ||
return | ||
fi | ||
|
@@ -50,6 +50,38 @@ function ensure_decent_gcc { | |
$SUDO ln -nsf /usr/bin/g++ /usr/bin/x86_64-linux-gnu-g++ | ||
} | ||
|
||
function version_lt { | ||
test $1 != $(echo -e "$1\n$2" | sort -rV | head -n 1) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice! |
||
} | ||
|
||
function ensure_decent_gcc_on_rh { | ||
local old=$(gcc -dumpversion) | ||
local expected=5.1 | ||
local dts_ver=$1 | ||
if version_lt $old $expected; then | ||
case $- in | ||
*i*) | ||
# interactive shell | ||
cat <<EOF | ||
Your GCC is too old. Please run following command to add DTS to your environment: | ||
|
||
scl enable devtoolset-7 bash | ||
|
||
Or add following line to the end of ~/.bashrc to add it permanently: | ||
|
||
source scl_source enable devtoolset-7 | ||
|
||
see https://www.softwarecollections.org/en/scls/rhscl/devtoolset-7/ for more details. | ||
EOF | ||
;; | ||
*) | ||
# non-interactive shell | ||
source /opt/rh/devtoolset-$dts_ver/enable | ||
;; | ||
esac | ||
fi | ||
} | ||
|
||
if [ x`uname`x = xFreeBSDx ]; then | ||
$SUDO pkg install -yq \ | ||
devel/babeltrace \ | ||
|
@@ -111,7 +143,7 @@ else | |
$SUDO add-apt-repository ppa:ubuntu-toolchain-r/test | ||
$SUDO apt-get update | ||
$SUDO apt-get install -y gcc-7 | ||
ensure_decent_gcc 7 | ||
ensure_decent_gcc_on_deb 7 | ||
;; | ||
*) | ||
$SUDO apt-get install -y gcc | ||
|
@@ -148,6 +180,12 @@ else | |
builddepcmd="dnf -y builddep --allowerasing" | ||
fi | ||
echo "Using $yumdnf to install dependencies" | ||
if [ $(lsb_release -si) = CentOS -a $(uname -m) = aarch64 ]; then | ||
$SUDO yum-config-manager --disable centos-sclo-sclo || true | ||
$SUDO yum-config-manager --disable centos-sclo-rh || true | ||
$SUDO yum remove centos-release-scl || true | ||
fi | ||
|
||
$SUDO $yumdnf install -y redhat-lsb-core | ||
case $(lsb_release -si) in | ||
Fedora) | ||
|
@@ -169,19 +207,29 @@ else | |
$SUDO yum-config-manager --enable cr | ||
case $(uname -m) in | ||
x86_64) | ||
$SUDO yum install centos-release-scl;; | ||
$SUDO yum -y install centos-release-scl | ||
dts_ver=7 | ||
;; | ||
aarch64) | ||
$SUDO yum install centos-release-scl-rh;; | ||
$SUDO yum -y install centos-release-scl-rh | ||
$SUDO yum-config-manager --disable centos-sclo-rh | ||
$SUDO yum-config-manager --enable centos-sclo-rh-testing | ||
dts_ver=6 | ||
;; | ||
esac | ||
elif test $(lsb_release -si) = RedHatEnterpriseServer -a $MAJOR_VERSION = 7 ; then | ||
$SUDO yum-config-manager --enable rhel-server-rhscl-7-rpms | ||
dts_ver=7 | ||
elif test $(lsb_release -si) = VirtuozzoLinux -a $MAJOR_VERSION = 7 ; then | ||
$SUDO yum-config-manager --enable cr | ||
fi | ||
;; | ||
esac | ||
munge_ceph_spec_in $DIR/ceph.spec | ||
$SUDO $builddepcmd $DIR/ceph.spec 2>&1 | tee $DIR/yum-builddep.out | ||
if [ -n dts_ver ]; then | ||
ensure_decent_gcc_on_rh $dts_ver | ||
fi | ||
! grep -q -i error: $DIR/yum-builddep.out || exit 1 | ||
;; | ||
opensuse|suse|sles) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ktdreyer this reflects the different support of DTS from RHEL and CentOS.