From bf6739d050de5a98ae48366f1fe09d259c05579c Mon Sep 17 00:00:00 2001 From: Thomas Vachuska Date: Mon, 6 Aug 2018 20:09:53 -0700 Subject: [PATCH] Fixing cell-build to apply patch only if necessary. Change-Id: I08dcb74d2e421e4fe12c015b5afba1bf282896be --- tools/dev/bin/cell-build | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tools/dev/bin/cell-build b/tools/dev/bin/cell-build index 3e35eb7fe5..ac6e510c39 100755 --- a/tools/dev/bin/cell-build +++ b/tools/dev/bin/cell-build @@ -19,21 +19,20 @@ ssh -t -t $ONOS_USER@$OCN " source ~/.bash_aliases cd \$ONOS_ROOT - # Make sure the remote build machine is on the same commit hash as the local one - remoteCommit=\$(git log -n 1 | head -n1 | cut -d\ -f2) - # Clean-up the workspace and stash away any changes. git clean -f git stash + # Make sure the remote build machine is on the same commit hash as the local one + remoteCommit=\$(git log -n 1 | head -n1 | cut -d\ -f2) if [ "\$remoteCommit" != "$baseCommit" ]; then git checkout master git pull git checkout $baseCommit fi - # Apply the patch - git apply /tmp/$baseCommit.patch + # Apply the patch if necessary + [ -s /tmp/$baseCommit.patch ] && git apply /tmp/$baseCommit.patch # Run the build (neutralizing known environment mutations in SSH sessions) SHLVL=1 SSH_CLIENT=0 SSH_CONNECTION=0 bazel build onos