From 7f19bf39d6991e3f716389b9f43cec3595ea2c73 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Thu, 6 Jun 2019 11:10:41 +0800 Subject: [PATCH] install-deps.sh: populate WITH_SEASTAR in the same way as for_make_check because `install-deps.sh` is executed using `source`, we have to pass these options using env variables. but before this change, `WITH_SEASTAR` is used directly, while `FOR_MAKE_CHECK` is checked and translated to a local variable `for_make_check`. which, in my opinion, has better readability. so, in this change, `WITH_SEASTAR` is translated to `with_seastar` variable in `install-deps.sh`. Signed-off-by: Kefu Chai --- install-deps.sh | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/install-deps.sh b/install-deps.sh index 9e45920ebea..62bd1297deb 100755 --- a/install-deps.sh +++ b/install-deps.sh @@ -24,12 +24,14 @@ export LC_ALL=C # the following is vulnerable to i18n ARCH=$(uname -m) function munge_ceph_spec_in { + local with_seastar=$1 + shift local for_make_check=$1 shift local OUTFILE=$1 sed -e 's/@//g' < ceph.spec.in > $OUTFILE # http://rpm.org/user_doc/conditional_builds.html - if [ $WITH_SEASTAR ]; then + if $with_seastar; then sed -i -e 's/%bcond_with seastar/%bcond_without seastar/g' $OUTFILE fi if $for_make_check; then @@ -40,6 +42,8 @@ function munge_ceph_spec_in { function munge_debian_control { local version=$1 shift + local with_seastar=$1 + shift local for_make_check=$1 shift local control=$1 @@ -49,7 +53,7 @@ function munge_debian_control { grep -v babeltrace debian/control > $control ;; esac - if [ $with_seastar ]; then + if $with_seastar; then sed -i -e 's/^# Crimson[[:space:]]//g' $control fi if $for_make_check; then @@ -261,6 +265,7 @@ else else for_make_check=false fi + [ $WITH_SEASTAR ] && with_seastar=true || with_seastar=false source /etc/os-release case $ID in debian|ubuntu|devuan) @@ -289,7 +294,7 @@ else touch $DIR/status backports="" - control=$(munge_debian_control "$VERSION" "$for_make_check" "debian/control") + control=$(munge_debian_control "$VERSION" "$with_seastar" "$for_make_check" "debian/control") case "$VERSION" in *squeeze*|*wheezy*) backports="-t $codename-backports" @@ -354,7 +359,7 @@ else fi ;; esac - munge_ceph_spec_in $for_make_check $DIR/ceph.spec + munge_ceph_spec_in $with_seastar $for_make_check $DIR/ceph.spec $SUDO $yumdnf install -y \*rpm-macros $SUDO $builddepcmd $DIR/ceph.spec 2>&1 | tee $DIR/yum-builddep.out [ ${PIPESTATUS[0]} -ne 0 ] && exit 1 @@ -369,7 +374,7 @@ else echo "Using zypper to install dependencies" zypp_install="zypper --gpg-auto-import-keys --non-interactive install --no-recommends" $SUDO $zypp_install systemd-rpm-macros - munge_ceph_spec_in $for_make_check $DIR/ceph.spec + munge_ceph_spec_in $with_seastar $for_make_check $DIR/ceph.spec $SUDO $zypp_install $(rpmspec -q --buildrequires $DIR/ceph.spec) || exit 1 $SUDO $zypp_install libxmlsec1-1 libxmlsec1-nss1 libxmlsec1-openssl1 xmlsec1-devel xmlsec1-openssl-devel ;; -- 2.39.5