]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-build.git/commitdiff
adds a util method that checks chacra to see if a binary exists
authorAndrew Schoen <aschoen@redhat.com>
Mon, 16 Nov 2015 20:35:26 +0000 (14:35 -0600)
committerAndrew Schoen <aschoen@redhat.com>
Mon, 16 Nov 2015 21:32:58 +0000 (15:32 -0600)
Also, uses this new function in the radosgw-agent job

Signed-off-by: Andrew Schoen <aschoen@redhat.com>
radosgw-agent/build/build
scripts/build_utils.sh

index efe68bb6e78a93bc2df9b8b1a137639b687b4618..298d488e528aba539914fe40d13ad2e1f634ddde 100644 (file)
@@ -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
index 36b7765fcdb04461f3433e0f9df687c0ca9989aa..889da587c22dbe6481641971a93160ed7aa3c448 100644 (file)
@@ -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
+
+}