From f96619298db872b87c139194029cfa8ddf4c00ac Mon Sep 17 00:00:00 2001 From: Ali Maredia Date: Fri, 10 Feb 2017 08:52:04 -0500 Subject: [PATCH] nfs-ganesha: debian fixes, various additions Signed-off-by: Ali Maredia --- nfs-ganesha/build/build_deb | 31 +++++++++---------- nfs-ganesha/build/failure | 9 ++++++ nfs-ganesha/build/setup | 4 +++ .../config/definitions/nfs-ganesha.yml | 12 +++++++ 4 files changed, 39 insertions(+), 17 deletions(-) create mode 100644 nfs-ganesha/build/failure diff --git a/nfs-ganesha/build/build_deb b/nfs-ganesha/build/build_deb index bb0de429..4630e2ab 100644 --- a/nfs-ganesha/build/build_deb +++ b/nfs-ganesha/build/build_deb @@ -7,14 +7,10 @@ if test "$DISTRO" != "debian" -a "$DISTRO" != "ubuntu"; then fi -## Install any setup-time deps -# TODO: add file to /etc/apt/sources.list.d/ to get repos for librgw-dev and libcephfs-dev and run sudo apt-get update - # We need this for system, to build ganesha, and to enable FSAL_CEPH and # FSAL_RGW in the .spec file when cmake command runs -sudo apt-get -y install "cmake equivs libkrb5-dev bison flex quilt -libdbus-1-dev libnfsidmap-dev libwbclient-dev libntirpc-dev (>= 1.4.3) libattr1-dev libacl1-dev libcap-dev glusterfs-common (>= 3.8.4) python-qt4 pyqt4-dev-tools pkgconf -librgw-dev libcephfs-dev" +sudo apt-get update +sudo apt-get -y install cmake equivs libkrb5-dev bison flex quilt librgw-dev libcephfs-dev # Normalize variables across rpm/deb builds NORMAL_DISTRO=$DISTRO @@ -41,24 +37,23 @@ cd build cmake -DCMAKE_BUILD_TYPE=Maintainer -DUSE_FSAL_GLUSTER=OFF -DUSE_FSAL_CEPH=ON -DUSE_FSAL_RGW=ON $WORKSPACE/nfs-ganesha/src && make dist || exit 1 # move unpacked tarball code into nfs-ganesha-debian/src -VERSION=`grep -om 1 '[[:digit:]]\+\.[[:digit:]]\+-dev-[[:digit:]]\+' $WORKSPACE/nfs-ganesha/build/CPackSourceConfig.cmake | sed s/-//g` -BUILD=`grep -om 1 "[[:digit:]]\+-g\w\w\w\w\w\w\w" $WORKSPACE/nfs-ganesha/build/include/config.h` -NFS_GANESHA_ORIG_TAR_GZ="nfs-ganesha_${VERSION}.orig.tar.gz" NFS_GANESHA_SOURCE_DIR=`grep -om 1 'nfs-ganesha-[[:digit:]]\+\.[[:digit:]]\+-dev-[[:digit:]]\+-[[:digit:]]\+\.[[:digit:]]\+\.[[:digit:]]\+-Source' $WORKSPACE/nfs-ganesha/build/CPackSourceConfig.cmake` +VERSION=`grep -om 1 '[[:digit:]]\+\.[[:digit:]]\+-dev-[[:digit:]]\+' $WORKSPACE/nfs-ganesha/build/CPackSourceConfig.cmake` +TAR_VERSION=`grep -om 1 '[[:digit:]]\+\.[[:digit:]]\+-dev' $WORKSPACE/nfs-ganesha/build/CPackSourceConfig.cmake` +NFS_GANESHA_ORIG_TAR_GZ="nfs-ganesha_${TAR_VERSION}.orig.tar.gz" +mkdir nfs-ganesha-${VERSION} tar xzf ${NFS_GANESHA_SOURCE_DIR}.tar.gz -mv ${NFS_GANESHA_SOURCE_DIR}.tar.gz ${NFS_GANESHA_ORIG_TAR_GZ} -mv ${NFS_GANESHA_SOURCE_DIR} nfs-ganesha-${VERSION} -rm -rf $WORKSPACE/nfs-ganesha-debian/debian/patches +mv ${NFS_GANESHA_SOURCE_DIR} nfs-ganesha-${VERSION}/src +tar czf ${NFS_GANESHA_ORIG_TAR_GZ} nfs-ganesha-${VERSION}/src mv $WORKSPACE/nfs-ganesha-debian/debian $WORKSPACE/nfs-ganesha/build/nfs-ganesha-${VERSION}/debian +cd nfs-ganesha-${VERSION} ## Get some basic information about the system and the repository DEB_ARCH=$(dpkg-architecture -qDEB_BUILD_ARCH) -cd $WORKSPACE/nfs-ganesha-debian - ## Prepare the debian files # Bump the changelog -dch -v "$VERSION-$BUILD" "New release ($VERSION)" +dch -v "$VERSION" "Dev release ($VERSION)" # Create .dsc and source tarball sudo dpkg-buildpackage -S -us -uc -d @@ -74,8 +69,10 @@ mkdir -p $WORKSPACE/dist/deb # use libcephfs and librgw from shaman REPO_URL="https://shaman.ceph.com/api/repos/ceph/$CEPH_BRANCH/$CEPH_SHA1/$DISTRO/$DIST/repo" +SHAMAN_MIRROR=`curl -L ${REPO_URL}` echo "EXTRAPACKAGES=\"libcephfs-dev librgw-dev\"" >> ~/.pbuilderrc -echo "OTHERMIRROR=deb ${REPO_URL}" >> ~/.pbuildrrc +echo "OTHERMIRROR=\"${SHAMAN_MIRROR}\"" >> ~/.pbuilderrc +cat ~/.pbuilderrc echo "Building debs for $DIST" sudo pbuilder build \ @@ -83,7 +80,7 @@ sudo pbuilder build \ --basetgz $PBUILDDIR/$DIST.tgz \ --buildresult $WORKSPACE/dist/deb/ \ --debbuildopts "-j`grep -c processor /proc/cpuinfo`" \ - $WORKSPACE/dist/nfs-ganesha_$VERSION.dsc + $WORKSPACE/nfs-ganesha/build/nfs-ganesha_${VERSION}.dsc ## Upload the created RPMs to chacra diff --git a/nfs-ganesha/build/failure b/nfs-ganesha/build/failure new file mode 100644 index 00000000..6a4fe024 --- /dev/null +++ b/nfs-ganesha/build/failure @@ -0,0 +1,9 @@ +#!/bin/bash -ex + +# note: the failed_build_status call relies on normalized variable names that +# are infered by the builds themselves. If the build fails before these are +# set, they will be posted with empty values +NFS_GANESHA_BRANCH=`branch_slash_filter $NFS_GANESHA_BRANCH` + +# update shaman with the failed build status +failed_build_status "nfs-ganesha" $NORMAL_DISTRO $NORMAL_DISTRO_VERSION $NORMAL_ARCH diff --git a/nfs-ganesha/build/setup b/nfs-ganesha/build/setup index 4abb7088..78c61c20 100644 --- a/nfs-ganesha/build/setup +++ b/nfs-ganesha/build/setup @@ -11,6 +11,7 @@ # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # + set -ex # Make sure we execute at the top level directory before we do anything @@ -43,6 +44,9 @@ export LC_ALL=C # the following is vulnerable to i18n pkgs=( "chacractl>=0.0.4" ) install_python_packages "pkgs[@]" +NFS_GANESHA_BRANCH=`branch_slash_filter $NFS_GANESHA_BRANCH` +CEPH_BRANCH=`branch_slash_filter $CEPH_BRANCH` + # ask shaman which chacra instance to use chacra_url=`curl -f -u $SHAMAN_API_USER:$SHAMAN_API_KEY https://shaman.ceph.com/api/nodes/next/` # create the .chacractl config file using global variables diff --git a/nfs-ganesha/config/definitions/nfs-ganesha.yml b/nfs-ganesha/config/definitions/nfs-ganesha.yml index 7bdb47cf..98afac11 100644 --- a/nfs-ganesha/config/definitions/nfs-ganesha.yml +++ b/nfs-ganesha/config/definitions/nfs-ganesha.yml @@ -134,6 +134,18 @@ If this is checked, then the binaries will be built and pushed to chacra even if - ../../build/setup - ../../build/build_rpm + publishers: + - postbuildscript: + script-only-if-failed: True + script-only-if-succeeded: False + builders: + - inject: + properties-file: ${WORKSPACE}/build_info + - shell: + !include-raw: + - ../../../scripts/build_utils.sh + - ../../build/failure + wrappers: - inject-passwords: global: true -- 2.39.5