]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
make-dist: extract download_from() out
authorKefu Chai <kchai@redhat.com>
Mon, 9 Nov 2020 03:58:10 +0000 (11:58 +0800)
committerKefu Chai <kchai@redhat.com>
Mon, 9 Nov 2020 04:33:47 +0000 (12:33 +0800)
so we can reuse it

Signed-off-by: Kefu Chai <kchai@redhat.com>
make-dist

index b0eb74e75c3a035f520960be6fead63a1717e06f..a9b5b07fe764fda40ffe92c4ce15c3523cd82cd1 100755 (executable)
--- 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" \