]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-build.git/commitdiff
ceph-*build/setup_rpm: extract setup_rpm_build_deps
authorKefu Chai <kchai@redhat.com>
Sat, 15 Aug 2020 03:47:46 +0000 (11:47 +0800)
committerKefu Chai <kchai@redhat.com>
Sat, 15 Aug 2020 05:44:23 +0000 (13:44 +0800)
less repeatings this way

Signed-off-by: Kefu Chai <kchai@redhat.com>
ceph-build/build/setup_rpm
ceph-dev-build/build/setup_rpm
ceph-dev-new-build/build/setup_rpm
scripts/build_utils.sh

index 5392d6fc035be606ce87530555dd005cc5109f24..61edfdd67236241a55dda9cb42d521dc56161ca5 100644 (file)
@@ -29,83 +29,8 @@ tar xzf *.orig.tar.gz
 cd $(basename *.orig.tar.gz .orig.tar.gz | sed s/_/-/)
 pwd
 
-$SUDO yum install -y yum-utils
-
-get_rpm_dist() {
-    LSB_RELEASE=/usr/bin/lsb_release
-    [ ! -x $LSB_RELEASE ] && echo unknown && exit
-
-    ID=`$LSB_RELEASE --short --id`
-
-    case $ID in
-    RedHatEnterpriseServer)
-        RELEASE=`$LSB_RELEASE --short --release | cut -d. -f1`
-        DIST=rhel$RELEASE
-        DISTRO=rhel
-        ;;
-    CentOS)
-        RELEASE=`$LSB_RELEASE --short --release | cut -d. -f1`
-        DIST=el$RELEASE
-        DISTRO=centos
-        ;;
-    Fedora)
-        RELEASE=`$LSB_RELEASE --short --release`
-        DIST=fc$RELEASE
-        DISTRO=fedora
-        ;;
-    SUSE\ LINUX)
-        DESC=`$LSB_RELEASE --short --description`
-        RELEASE=`$LSB_RELEASE --short --release`
-        case $DESC in
-        *openSUSE*)
-                DIST=opensuse$RELEASE
-                DISTRO=opensuse
-            ;;
-        *Enterprise*)
-                DIST=sles$RELEASE
-                DISTRO=sles
-                ;;
-            esac
-        ;;
-    *)
-        DIST=unknown
-        DISTRO=unknown
-        ;;
-    esac
-
-    echo $DIST
-}
-
 get_rpm_dist
-
-if [ "$RELEASE" = 7 ]; then
-   if [ "$ARCH" = x86_64 ]; then
-       $SUDO yum install -y centos-release-scl
-   elif [ "$ARCH" = arm64 ]; then
-       $SUDO yum install -y centos-release-scl-rh
-       $SUDO yum-config-manager --disable centos-sclo-rh
-       $SUDO yum-config-manager --enable centos-sclo-rh-testing
-   fi
-elif [ "$RELEASE" = 8 ]; then
-    $SUDO dnf config-manager --set-enabled PowerTools
-    # before EPEL8 and PowerTools provide all dependencies, we use sepia for the dependencies
-    $SUDO dnf config-manager --add-repo http://apt-mirror.front.sepia.ceph.com/lab-extras/8/
-    $SUDO dnf config-manager --setopt=apt-mirror.front.sepia.ceph.com_lab-extras_8_.gpgcheck=0 --save
-fi
-
-sed -e 's/@//g' < ceph.spec.in > $DIR/ceph.spec
-
-if [ "$FLAVOR" = "crimson" ]; then
-    # enable more build depends required by crimson
-    sed -i -e 's/%bcond_with seastar/%bcond_without seastar/g' $DIR/ceph.spec
-fi
-
-# Make sure we have all the rpm macros installed and at the latest version
-# before installing the dependencies, python3-devel requires the
-# python-rpm-macro we use for identifying the python related dependencies
-$SUDO yum install -y python3-devel
-
-$SUDO yum-builddep -y --setopt=*.skip_if_unavailable=true $DIR/ceph.spec
+setup_rpm_build_deps
 
 BRANCH=`branch_slash_filter $BRANCH`
 
index ca43f2b0002ae7efe1069ee8ff4c1f2febbbde8b..9146c30070ffa73d585aebc7024d106446393499 100644 (file)
@@ -31,81 +31,8 @@ pwd
 
 $SUDO yum install -y yum-utils
 
-
-get_rpm_dist() {
-    LSB_RELEASE=/usr/bin/lsb_release
-    [ ! -x $LSB_RELEASE ] && echo unknown && exit
-
-    ID=`$LSB_RELEASE --short --id`
-
-    case $ID in
-    RedHatEnterpriseServer)
-        RELEASE=`$LSB_RELEASE --short --release | cut -d. -f1`
-        DIST=rhel$RELEASE
-        DISTRO=rhel
-        ;;
-    CentOS)
-        RELEASE=`$LSB_RELEASE --short --release | cut -d. -f1`
-        DIST=el$RELEASE
-        DISTRO=centos
-        ;;
-    Fedora)
-        RELEASE=`$LSB_RELEASE --short --release`
-        DIST=fc$RELEASE
-        DISTRO=fedora
-        ;;
-    SUSE\ LINUX)
-        DESC=`$LSB_RELEASE --short --description`
-        RELEASE=`$LSB_RELEASE --short --release`
-        case $DESC in
-        *openSUSE*)
-                DIST=opensuse$RELEASE
-                DISTRO=opensuse
-            ;;
-        *Enterprise*)
-                DIST=sles$RELEASE
-                DISTRO=sles
-                ;;
-            esac
-        ;;
-    *)
-        DIST=unknown
-        DISTRO=unknown
-        ;;
-    esac
-
-    echo $DIST
-}
-
 get_rpm_dist
-
-if [ "$RELEASE" = 7 ]; then
-   if [ "$ARCH" = x86_64 ]; then
-       $SUDO yum install -y centos-release-scl
-   elif [ "$ARCH" = arm64 ]; then
-       $SUDO yum install -y centos-release-scl-rh
-       $SUDO yum-config-manager --disable centos-sclo-rh
-       $SUDO yum-config-manager --enable centos-sclo-rh-testing
-   fi
-elif [ "$RELEASE" = 8 ]; then
-    $SUDO dnf config-manager --set-enabled PowerTools
-    # before EPEL8 and PowerTools provide all dependencies, we use sepia for the dependencies
-    $SUDO dnf config-manager --add-repo http://apt-mirror.front.sepia.ceph.com/lab-extras/8/
-    $SUDO dnf config-manager --setopt=apt-mirror.front.sepia.ceph.com_lab-extras_8_.gpgcheck=0 --save
-fi
-
-sed -e 's/@//g' < ceph.spec.in > $DIR/ceph.spec
-
-if [ "$FLAVOR" = "crimson" ]; then
-    # enable more build depends required by crimson
-    sed -i -e 's/%bcond_with seastar/%bcond_without seastar/g' $DIR/ceph.spec
-fi
-
-# before installing the dependencies, python3-devel requires the
-# python-rpm-macro we use for identifying the python related dependencies
-$SUDO yum install -y python3-devel
-
-$SUDO yum-builddep -y --setopt=*.skip_if_unavailable=true $DIR/ceph.spec
+setup_rpm_build_deps
 
 BRANCH=`branch_slash_filter $BRANCH`
 
index ca43f2b0002ae7efe1069ee8ff4c1f2febbbde8b..5e6700794ff640e112857b2dd3fec7734434e19e 100644 (file)
@@ -29,83 +29,8 @@ tar xzf *.orig.tar.gz
 cd $(basename *.orig.tar.gz .orig.tar.gz | sed s/_/-/)
 pwd
 
-$SUDO yum install -y yum-utils
-
-
-get_rpm_dist() {
-    LSB_RELEASE=/usr/bin/lsb_release
-    [ ! -x $LSB_RELEASE ] && echo unknown && exit
-
-    ID=`$LSB_RELEASE --short --id`
-
-    case $ID in
-    RedHatEnterpriseServer)
-        RELEASE=`$LSB_RELEASE --short --release | cut -d. -f1`
-        DIST=rhel$RELEASE
-        DISTRO=rhel
-        ;;
-    CentOS)
-        RELEASE=`$LSB_RELEASE --short --release | cut -d. -f1`
-        DIST=el$RELEASE
-        DISTRO=centos
-        ;;
-    Fedora)
-        RELEASE=`$LSB_RELEASE --short --release`
-        DIST=fc$RELEASE
-        DISTRO=fedora
-        ;;
-    SUSE\ LINUX)
-        DESC=`$LSB_RELEASE --short --description`
-        RELEASE=`$LSB_RELEASE --short --release`
-        case $DESC in
-        *openSUSE*)
-                DIST=opensuse$RELEASE
-                DISTRO=opensuse
-            ;;
-        *Enterprise*)
-                DIST=sles$RELEASE
-                DISTRO=sles
-                ;;
-            esac
-        ;;
-    *)
-        DIST=unknown
-        DISTRO=unknown
-        ;;
-    esac
-
-    echo $DIST
-}
-
 get_rpm_dist
-
-if [ "$RELEASE" = 7 ]; then
-   if [ "$ARCH" = x86_64 ]; then
-       $SUDO yum install -y centos-release-scl
-   elif [ "$ARCH" = arm64 ]; then
-       $SUDO yum install -y centos-release-scl-rh
-       $SUDO yum-config-manager --disable centos-sclo-rh
-       $SUDO yum-config-manager --enable centos-sclo-rh-testing
-   fi
-elif [ "$RELEASE" = 8 ]; then
-    $SUDO dnf config-manager --set-enabled PowerTools
-    # before EPEL8 and PowerTools provide all dependencies, we use sepia for the dependencies
-    $SUDO dnf config-manager --add-repo http://apt-mirror.front.sepia.ceph.com/lab-extras/8/
-    $SUDO dnf config-manager --setopt=apt-mirror.front.sepia.ceph.com_lab-extras_8_.gpgcheck=0 --save
-fi
-
-sed -e 's/@//g' < ceph.spec.in > $DIR/ceph.spec
-
-if [ "$FLAVOR" = "crimson" ]; then
-    # enable more build depends required by crimson
-    sed -i -e 's/%bcond_with seastar/%bcond_without seastar/g' $DIR/ceph.spec
-fi
-
-# before installing the dependencies, python3-devel requires the
-# python-rpm-macro we use for identifying the python related dependencies
-$SUDO yum install -y python3-devel
-
-$SUDO yum-builddep -y --setopt=*.skip_if_unavailable=true $DIR/ceph.spec
+setup_rpm_build_deps
 
 BRANCH=`branch_slash_filter $BRANCH`
 
index 61be4a6de3baf9b89c47eac076cfaf97b4ffce2b..bbfa5da83ab907e81f996a03e1feab60c1d0bff5 100644 (file)
@@ -1088,6 +1088,83 @@ maybe_reset_ci_container() {
     fi
 }
 
+get_rpm_dist() {
+    LSB_RELEASE=/usr/bin/lsb_release
+    [ ! -x $LSB_RELEASE ] && echo unknown && exit
+
+    ID=`$LSB_RELEASE --short --id`
+
+    case $ID in
+    RedHatEnterpriseServer)
+        RELEASE=`$LSB_RELEASE --short --release | cut -d. -f1`
+        DIST=rhel$RELEASE
+        DISTRO=rhel
+        ;;
+    CentOS)
+        RELEASE=`$LSB_RELEASE --short --release | cut -d. -f1`
+        DIST=el$RELEASE
+        DISTRO=centos
+        ;;
+    Fedora)
+        RELEASE=`$LSB_RELEASE --short --release`
+        DIST=fc$RELEASE
+        DISTRO=fedora
+        ;;
+    SUSE\ LINUX)
+        DESC=`$LSB_RELEASE --short --description`
+        RELEASE=`$LSB_RELEASE --short --release`
+        case $DESC in
+        *openSUSE*)
+                DIST=opensuse$RELEASE
+                DISTRO=opensuse
+            ;;
+        *Enterprise*)
+                DIST=sles$RELEASE
+                DISTRO=sles
+                ;;
+            esac
+        ;;
+    *)
+        DIST=unknown
+        DISTRO=unknown
+        ;;
+    esac
+
+    echo $DIST
+}
+
+setup_rpm_build_deps() {
+    $SUDO yum install -y yum-utils
+    if [ "$RELEASE" = 7 ]; then
+        if [ "$ARCH" = x86_64 ]; then
+            $SUDO yum install -y centos-release-scl
+        elif [ "$ARCH" = arm64 ]; then
+            $SUDO yum install -y centos-release-scl-rh
+            $SUDO yum-config-manager --disable centos-sclo-rh
+            $SUDO yum-config-manager --enable centos-sclo-rh-testing
+        fi
+    elif [ "$RELEASE" = 8 ]; then
+        $SUDO dnf config-manager --set-enabled PowerTools
+        # before EPEL8 and PowerTools provide all dependencies, we use sepia for the dependencies
+        $SUDO dnf config-manager --add-repo http://apt-mirror.front.sepia.ceph.com/lab-extras/8/
+        $SUDO dnf config-manager --setopt=apt-mirror.front.sepia.ceph.com_lab-extras_8_.gpgcheck=0 --save
+    fi
+
+    sed -e 's/@//g' < ceph.spec.in > $DIR/ceph.spec
+
+    if [ "$FLAVOR" = "crimson" ]; then
+        # enable more build depends required by crimson
+        sed -i -e 's/%bcond_with seastar/%bcond_without seastar/g' $DIR/ceph.spec
+    fi
+
+    # Make sure we have all the rpm macros installed and at the latest version
+    # before installing the dependencies, python3-devel requires the
+    # python-rpm-macro we use for identifying the python related dependencies
+    $SUDO yum install -y python3-devel
+
+    $SUDO yum-builddep -y --setopt=*.skip_if_unavailable=true $DIR/ceph.spec
+}
+
 setup_rpm_build_area() {
     local build_area=$1
     shift