diff options
author | Kefu Chai <kchai@redhat.com> | 2020-11-09 04:58:10 +0100 |
---|---|---|
committer | Kefu Chai <kchai@redhat.com> | 2020-11-09 05:33:47 +0100 |
commit | b77aa9d685182f133e7ccd7bdeba2e5383c896af (patch) | |
tree | d92ac5779a4ca7352c89fc0e05ecd5cef228e05b /make-dist | |
parent | Merge PR #36998 into master (diff) | |
download | ceph-b77aa9d685182f133e7ccd7bdeba2e5383c896af.tar.xz ceph-b77aa9d685182f133e7ccd7bdeba2e5383c896af.zip |
make-dist: extract download_from() out
so we can reuse it
Signed-off-by: Kefu Chai <kchai@redhat.com>
Diffstat (limited to 'make-dist')
-rwxr-xr-x | make-dist | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/make-dist b/make-dist index b0eb74e75c3..a9b5b07fe76 100755 --- a/make-dist +++ b/make-dist @@ -27,32 +27,40 @@ if ! git submodule sync || ! git submodule update $force --init --recursive; the exit 1 fi -download_boost() { - boost_version=$1 +download_from() { + fname=$1 shift - boost_sha256=$1 + sha256=$1 shift - boost_version_underscore=$(echo $boost_version | sed 's/\./_/g') - boost_fname=boost_${boost_version_underscore}.tar.bz2 set +e while true; do url_base=$1 shift if [ -z $url_base ]; then - echo "Error: failed to download boost." + echo "Error: failed to download $name." exit fi - url=$url_base/$boost_fname - wget -c --no-verbose -O $boost_fname $url - if [ $? != 0 -o ! -e $boost_fname ]; then + url=$url_base/$fname + wget -c --no-verbose -O $fname $url + if [ $? != 0 -o ! -e $fname ]; then echo "Download of $url failed" - elif [ $(sha256sum $boost_fname | awk '{print $1}') != $boost_sha256 ]; then - echo "Error: failed to download boost: SHA256 mismatch." + elif [ $(sha256sum $fname | awk '{print $1}') != $sha256 ]; then + echo "Error: failed to download $name: SHA256 mismatch." else break fi done set -e +} + +download_boost() { + boost_version=$1 + shift + boost_sha256=$1 + shift + boost_version_underscore=$(echo $boost_version | sed 's/\./_/g') + boost_fname=boost_${boost_version_underscore}.tar.bz2 + download_from $boost_fname $boost_sha256 $* tar xjf $boost_fname -C src \ --exclude="$boost_version_underscore/libs/*/doc" \ --exclude="$boost_version_underscore/libs/*/example" \ |