]> git.apps.os.sepia.ceph.com Git - ceph-build.git/commitdiff
scripts/build_utils.sh: extract use_ppa() as a function
authorKefu Chai <tchaikov@gmail.com>
Mon, 25 Dec 2017 09:06:19 +0000 (17:06 +0800)
committerKefu Chai <kchai@redhat.com>
Fri, 5 Jan 2018 14:32:24 +0000 (22:32 +0800)
so it can be reused.

Signed-off-by: Kefu Chai <kchai@redhat.com>
scripts/build_utils.sh

index 0b16f60c52f92cf29145d30153f33536c9437668..5b243ee8ed7daa2e562a5ec1bdb1fda5706e7ffc 100644 (file)
@@ -411,9 +411,7 @@ setup_pbuilder() {
     fi
 }
 
-setup_pbuilder_for_ppa() {
-    # point gcc,g++ to the newly installed ones
-    local hookdir=$HOME/.pbuilder/hook.d
+use_ppa() {
     case $vers in
         10.*)
             # jewel
@@ -425,20 +423,29 @@ setup_pbuilder_for_ppa() {
             # mimic, nautilus, *
             case $DIST in
                 trusty)
-                    old=4.8
                     use_ppa=true;;
                 xenial)
-                    old=5
                     use_ppa=true;;
                 *)
-                    use_ppa=false
-                    ;;
+                    use_ppa=false;;
             esac
             ;;
     esac
-    if ! $use_ppa; then
+    $use_ppa
+}
+
+setup_pbuilder_for_ppa() {
+    # point gcc,g++ to the newly installed ones
+    local hookdir=$HOME/.pbuilder/hook.d
+    if ! use_ppa; then
         return
     fi
+    case $DIST in
+        trusty)
+            old=4.8;;
+        xenial)
+            old=5
+    esac
 
     echo "HOOKDIR=$hookdir"
 
@@ -487,26 +494,7 @@ EOF
 
 extra_cmake_args() {
     # statically link against libstdc++ for building new releases on old distros
-    case $vers in
-        10.*)
-            # jewel
-            use_ppa=false;;
-        12.*)
-            # luminous
-            use_ppa=false;;
-        *)
-            # mimic, nautilus, *
-            case $DIST in
-                trusty)
-                    use_ppa=true;;
-                xenial)
-                    use_ppa=true;;
-                *)
-                    use_ppa=false;;
-            esac
-            ;;
-    esac
-    if $use_ppa; then
+    if use_ppa; then
         echo "-DWITH_STATIC_LIBSTDCXX=ON"
     fi
 }