]> git.apps.os.sepia.ceph.com Git - ceph-build.git/commitdiff
setup_pbuilder: only use ppa on newer releases 928/head
authorKefu Chai <kchai@redhat.com>
Wed, 6 Dec 2017 12:57:27 +0000 (20:57 +0800)
committerKefu Chai <kchai@redhat.com>
Wed, 6 Dec 2017 13:02:16 +0000 (21:02 +0800)
* only use GCC-7 offered by ppa repo on mimic and newer release.
  we are dropping the support of trusty in mimic and newer releases,
  but we still need to use the old toolchain shipped with trusty to
  build jewel and luminous. so, only use GCC-7 on trusty for building
  mimic and up. as it should be safe to use the new GCC ABI on the
  supported distros, like xenial.
* extract the ppa setup related code into build_utils.sh, so the
  setup_pbuilder scripts can reuse it.

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

index 8cc0c22c8db0431059eb7b53d102441a8f65869b..c31b3c0bef7e0d1834f0da32ab91d19830e55524 100755 (executable)
@@ -83,41 +83,7 @@ echo "BUILD_HOME=`mktemp -d`" >> ~/.pbuilderrc
 # in newer versions. This ticket solves the specific issue in 8.1.1 (which vendors urllib3):
 # https://github.com/shazow/urllib3/issues/567
 echo "USENETWORK=yes" >> ~/.pbuilderrc
-# point gcc,g++ to the newly installed ones
-hookdir=$HOME/.pbuilder/hook.d
-if [ "$DIST" = "trusty" ]; then
-    cat >> ~/.pbuilderrc <<EOF
-OTHERMIRROR="deb http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu $DIST main"
-OTHERMIRROR="$OTHERMIRROR | deb http://mirror.cs.uchicago.edu/ubuntu-toolchain-r $DIST main"
-OTHERMIRROR="$OTHERMIRROR | deb http://mirror.yandex.ru/mirrors/launchpad/ubuntu-toolchain-r $DIST main"
-ALLOWUNTRUSTED=yes
-EXTRAPACKAGES="g++-7"
-HOOKDIR=$hookdir
-EOF
-fi
-
-if [ ! -e $hookdir ]; then
-    mkdir -p $hookdir
-    cat > $hookdir/E10update-gcc-alternatives <<EOF
-old=4.8
-new=7
-
-update-alternatives \
-  --install /usr/bin/gcc gcc /usr/bin/gcc-\${new} 20 \
-  --slave   /usr/bin/g++ g++ /usr/bin/g++-\${new}
-
-update-alternatives \
-  --install /usr/bin/gcc gcc /usr/bin/gcc-\${old} 10 \
-  --slave   /usr/bin/g++ g++ /usr/bin/g++-\${old}
-
-update-alternatives --auto gcc
-
-# cmake uses the latter by default
-ln -nsf /usr/bin/gcc /usr/bin/x86_64-linux-gnu-gcc
-ln -nsf /usr/bin/g++ /usr/bin/x86_64-linux-gnu-g++
-EOF
-    chmod +x $hookdir/E10update-gcc-alternatives
-fi
+setup_pbuilder_for_ppa
 
 sudo pbuilder --clean
 
index 8cc0c22c8db0431059eb7b53d102441a8f65869b..c31b3c0bef7e0d1834f0da32ab91d19830e55524 100755 (executable)
@@ -83,41 +83,7 @@ echo "BUILD_HOME=`mktemp -d`" >> ~/.pbuilderrc
 # in newer versions. This ticket solves the specific issue in 8.1.1 (which vendors urllib3):
 # https://github.com/shazow/urllib3/issues/567
 echo "USENETWORK=yes" >> ~/.pbuilderrc
-# point gcc,g++ to the newly installed ones
-hookdir=$HOME/.pbuilder/hook.d
-if [ "$DIST" = "trusty" ]; then
-    cat >> ~/.pbuilderrc <<EOF
-OTHERMIRROR="deb http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu $DIST main"
-OTHERMIRROR="$OTHERMIRROR | deb http://mirror.cs.uchicago.edu/ubuntu-toolchain-r $DIST main"
-OTHERMIRROR="$OTHERMIRROR | deb http://mirror.yandex.ru/mirrors/launchpad/ubuntu-toolchain-r $DIST main"
-ALLOWUNTRUSTED=yes
-EXTRAPACKAGES="g++-7"
-HOOKDIR=$hookdir
-EOF
-fi
-
-if [ ! -e $hookdir ]; then
-    mkdir -p $hookdir
-    cat > $hookdir/E10update-gcc-alternatives <<EOF
-old=4.8
-new=7
-
-update-alternatives \
-  --install /usr/bin/gcc gcc /usr/bin/gcc-\${new} 20 \
-  --slave   /usr/bin/g++ g++ /usr/bin/g++-\${new}
-
-update-alternatives \
-  --install /usr/bin/gcc gcc /usr/bin/gcc-\${old} 10 \
-  --slave   /usr/bin/g++ g++ /usr/bin/g++-\${old}
-
-update-alternatives --auto gcc
-
-# cmake uses the latter by default
-ln -nsf /usr/bin/gcc /usr/bin/x86_64-linux-gnu-gcc
-ln -nsf /usr/bin/g++ /usr/bin/x86_64-linux-gnu-g++
-EOF
-    chmod +x $hookdir/E10update-gcc-alternatives
-fi
+setup_pbuilder_for_ppa
 
 sudo pbuilder --clean
 
index 8cc0c22c8db0431059eb7b53d102441a8f65869b..c31b3c0bef7e0d1834f0da32ab91d19830e55524 100755 (executable)
@@ -83,41 +83,7 @@ echo "BUILD_HOME=`mktemp -d`" >> ~/.pbuilderrc
 # in newer versions. This ticket solves the specific issue in 8.1.1 (which vendors urllib3):
 # https://github.com/shazow/urllib3/issues/567
 echo "USENETWORK=yes" >> ~/.pbuilderrc
-# point gcc,g++ to the newly installed ones
-hookdir=$HOME/.pbuilder/hook.d
-if [ "$DIST" = "trusty" ]; then
-    cat >> ~/.pbuilderrc <<EOF
-OTHERMIRROR="deb http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu $DIST main"
-OTHERMIRROR="$OTHERMIRROR | deb http://mirror.cs.uchicago.edu/ubuntu-toolchain-r $DIST main"
-OTHERMIRROR="$OTHERMIRROR | deb http://mirror.yandex.ru/mirrors/launchpad/ubuntu-toolchain-r $DIST main"
-ALLOWUNTRUSTED=yes
-EXTRAPACKAGES="g++-7"
-HOOKDIR=$hookdir
-EOF
-fi
-
-if [ ! -e $hookdir ]; then
-    mkdir -p $hookdir
-    cat > $hookdir/E10update-gcc-alternatives <<EOF
-old=4.8
-new=7
-
-update-alternatives \
-  --install /usr/bin/gcc gcc /usr/bin/gcc-\${new} 20 \
-  --slave   /usr/bin/g++ g++ /usr/bin/g++-\${new}
-
-update-alternatives \
-  --install /usr/bin/gcc gcc /usr/bin/gcc-\${old} 10 \
-  --slave   /usr/bin/g++ g++ /usr/bin/g++-\${old}
-
-update-alternatives --auto gcc
-
-# cmake uses the latter by default
-ln -nsf /usr/bin/gcc /usr/bin/x86_64-linux-gnu-gcc
-ln -nsf /usr/bin/g++ /usr/bin/x86_64-linux-gnu-g++
-EOF
-    chmod +x $hookdir/E10update-gcc-alternatives
-fi
+setup_pbuilder_for_ppa
 
 sudo pbuilder --clean
 
index 11e2252bc68ea157078685c18a1b37124ef5d11b..6b8353b5978a301dca8d85fb9e84cab131b244af 100644 (file)
@@ -411,6 +411,61 @@ setup_pbuilder() {
     fi
 }
 
+setup_pbuilder_for_ppa() {
+    # point gcc,g++ to the newly installed ones
+    local hookdir=$HOME/.pbuilder/hook.d
+    case $vers in
+        10.*)
+            # jewel
+            use_ppa=false;;
+        12.*)
+            # luminous
+            use_ppa=false;;
+        *)
+            # mimic, nautilus, *
+            # in newer releases, the trusty support is dropped. and it's safe to use the new GCC ABI
+            if [ "$DIST" = "trusty" ]; then
+                use_ppa=true
+            else
+                use_ppa=false
+            fi
+    esac
+    if ! $use_ppa; then
+        return
+    fi
+
+    cat >> ~/.pbuilderrc <<EOF
+OTHERMIRROR="deb http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu $DIST main"
+OTHERMIRROR="$OTHERMIRROR | deb http://mirror.cs.uchicago.edu/ubuntu-toolchain-r $DIST main"
+OTHERMIRROR="$OTHERMIRROR | deb http://mirror.yandex.ru/mirrors/launchpad/ubuntu-toolchain-r $DIST main"
+ALLOWUNTRUSTED=yes
+EXTRAPACKAGES="g++-7"
+HOOKDIR=$hookdir
+EOF
+    if [ ! -e $hookdir ]; then
+        mkdir -p $hookdir
+        cat > $hookdir/E10update-gcc-alternatives <<EOF
+old=4.8
+new=7
+
+update-alternatives \
+  --install /usr/bin/gcc gcc /usr/bin/gcc-\${new} 20 \
+  --slave   /usr/bin/g++ g++ /usr/bin/g++-\${new}
+
+update-alternatives \
+  --install /usr/bin/gcc gcc /usr/bin/gcc-\${old} 10 \
+  --slave   /usr/bin/g++ g++ /usr/bin/g++-\${old}
+
+update-alternatives --auto gcc
+
+# cmake uses the latter by default
+ln -nsf /usr/bin/gcc /usr/bin/x86_64-linux-gnu-gcc
+ln -nsf /usr/bin/g++ /usr/bin/x86_64-linux-gnu-g++
+EOF
+        chmod +x $hookdir/E10update-gcc-alternatives
+    fi
+}
+
 delete_libvirt_vms() {
     # Delete any VMs leftover from previous builds.
     # Primarily used for Vagrant VMs leftover from docker builds.