From: Andrew Schoen Date: Mon, 16 Nov 2015 20:35:26 +0000 (-0600) Subject: adds a util method that checks chacra to see if a binary exists X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=9a3754633ed5458537207d91ffdfae26c04d22ed;p=ceph-build.git adds a util method that checks chacra to see if a binary exists Also, uses this new function in the radosgw-agent job Signed-off-by: Andrew Schoen --- diff --git a/radosgw-agent/build/build b/radosgw-agent/build/build index efe68bb6e..298d488e5 100644 --- a/radosgw-agent/build/build +++ b/radosgw-agent/build/build @@ -35,13 +35,7 @@ if [[ -f /etc/redhat-release || -f /usr/bin/zypper ]] ; then chacra_endpoint="radosgw-agent/${chacra_ref}/${DISTRO}/${DISTRO_VERSION}" - $VENV/chacractl exists binaries/${chacra_endpoint}/noarch ; exists=$? - - # if the binary already exists in chacra, do not rebuild - if [ $exists -eq 0 ] && [ "$FORCE" = false ] ; then - echo "The endpoint at ${chacra_endpoint}/noarch already exists and FORCE was not set, Exiting..." - exit 0 - fi + check_binary_existence $chacra_endpoint/noarch suse=$(uname -n | grep -ic -e suse -e sles || true) if [ $suse -gt 0 ] @@ -79,13 +73,7 @@ else chacra_endpoint="radosgw-agent/${chacra_ref}/${DISTRO}/${DEB_BUILD}/noarch" - $VENV/chacractl exists binaries/${chacra_endpoint} ; exists=$? - - # if the binary already exists in chacra, do not rebuild - if [ $exists -eq 0 ] && [ "$FORCE" = false ] ; then - echo "The endpoint at ${chacra_endpoint} already exists and FORCE was not set, Exiting..." - exit 0 - fi + check_binary_existence $chacra_endpoint dpkg-source -b . # we no longer sign the .dsc or .changes files (done by default with diff --git a/scripts/build_utils.sh b/scripts/build_utils.sh index 36b7765fc..889da587c 100644 --- a/scripts/build_utils.sh +++ b/scripts/build_utils.sh @@ -80,3 +80,18 @@ get_rpm_dist() { esac } + +check_binary_existence () { + url=$1 + + # we have to use ! here so thet -e will ignore the error code for the command + # because of this, the exit code is also reversed + ! $VENV/chacractl exists binaries/${url} ; exists=$? + + # if the binary already exists in chacra, do not rebuild + if [ $exists -eq 1 ] && [ "$FORCE" = false ] ; then + echo "The endpoint at ${chacra_endpoint} already exists and FORCE was not set, Exiting..." + exit 0 + fi + +}