aboutsummaryrefslogtreecommitdiffstats
path: root/tools/bin
diff options
context:
space:
mode:
Diffstat (limited to 'tools/bin')
-rwxr-xr-xtools/bin/clion_wrapper.sh24
-rwxr-xr-xtools/bin/export_ccnx_env.sh13
-rw-r--r--tools/bin/getStatus.sh32
-rw-r--r--tools/bin/gitAddUpstream.sh37
-rwxr-xr-xtools/bin/gitCloneOneOf.sh38
-rw-r--r--tools/bin/gitStatus.sh72
6 files changed, 216 insertions, 0 deletions
diff --git a/tools/bin/clion_wrapper.sh b/tools/bin/clion_wrapper.sh
new file mode 100755
index 00000000..2c40ed55
--- /dev/null
+++ b/tools/bin/clion_wrapper.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+script_dir=$(dirname "$BASH_SOURCE")
+
+export DISTILLERY_BUILD_NAME=-debug
+
+cd "${script_dir}"
+source ./export_ccnx_env.sh
+
+cd ${DISTILLERY_ROOT_DIR}/src
+
+osType=`uname -s`
+
+case "$osType" in
+ Darwin)
+ open /Applications/CLion.app
+ ;;
+ Linux)
+ clion.sh
+ ;;
+ *)
+ echo "System not recognized, edit ${0} to add support"
+ ;;
+esac
+
diff --git a/tools/bin/export_ccnx_env.sh b/tools/bin/export_ccnx_env.sh
new file mode 100755
index 00000000..6172a191
--- /dev/null
+++ b/tools/bin/export_ccnx_env.sh
@@ -0,0 +1,13 @@
+#!/bin/bash
+
+working_dir=`pwd`
+script_dir=$(dirname "$BASH_SOURCE")
+
+cd "${script_dir}"/../../
+
+env=`make -f Makefile -s env`
+for def in $env; do
+ { export $def; }
+done
+
+cd "$working_dir"
diff --git a/tools/bin/getStatus.sh b/tools/bin/getStatus.sh
new file mode 100644
index 00000000..a1bff083
--- /dev/null
+++ b/tools/bin/getStatus.sh
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+GIT_DIRECTORY=$1
+GIT_REPO=`basename ${GIT_DIRECTORY}`
+
+cd ${GIT_DIRECTORY}
+
+CURRENT_SHA=`git branch -av | grep "\*" | awk '{print $3}'`
+CURRENT_BRANCH=`git branch -av | grep "\*" | awk '{print $2}'`
+UPSTREAM_SHA=`git branch -av | grep "remotes/ccnx_upstream/master" | awk '{print $2}'`
+
+if [ x${UPSTREAM_SHA} = x ]; then
+ # We don't have an upstream...
+ UPSTREAM_SHA="NO_UPSTREAM"
+else
+ PARC_MASTER_IN_BRANCH=`git branch -v --contains $UPSTREAM_SHA | grep "\*" | awk '{print $3}'`
+fi
+
+
+echo '===================================================================='
+
+if [ "x${CCNX_MASTER_IN_BRANCH}" != "x" ]; then
+ # This branch is master OR ahead of master
+ if [ x${CURRENT_SHA} = x${UPSTREAM_SHA} ]; then
+ echo "CCNX ${GIT_REPO} ${CURRENT_BRANCH} ${CURRENT_SHA}::${UPSTREAM_SHA}"
+ else
+ echo "CCNX++ ${GIT_REPO} ${CURRENT_BRANCH} ${CURRENT_SHA}::${UPSTREAM_SHA}"
+ fi
+else
+ echo "------ ${GIT_REPO} ${CURRENT_BRANCH} ${CURRENT_SHA}::${UPSTREAM_SHA}"
+fi
+git status -s
diff --git a/tools/bin/gitAddUpstream.sh b/tools/bin/gitAddUpstream.sh
new file mode 100644
index 00000000..a91f2be2
--- /dev/null
+++ b/tools/bin/gitAddUpstream.sh
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+if [ $# -lt 4 ]; then
+ echo "ERROR incorrect number of parameters"
+ echo "Usage:"
+ echo " $0 <repo_name> <repo_directory> <remote_name> <remote_url>"
+ echo
+ echo "$0 adds a remote named <remote_name> to repository <repo_name> located"
+ echo "in directory <repo_directory>. The remote will point towards <remote_url>"
+ echo "If <remote_name> already exits nothing will be done."
+ exit 1
+fi
+
+REPO_NAME=$1
+REPO_DIR=$2
+REMOTE_NAME=$3
+REMOTE_URL=$4
+
+if [ ! -d $REPO_DIR ]; then
+ echo "ERROR running $0"
+ echo " Directory $REPO_DIR not found"
+ exit 1
+fi
+
+echo "###################################################################"
+echo "# Updationg remote $REMOTE_NAME for $REPO_NAME"
+
+cd $REPO_DIR
+
+git remote add $REMOTE_NAME $REMOTE_URL > /dev/null 2>&1
+if [ $? -ne 0 ]; then
+ echo "# Skipped - not needed"
+ exit 0
+fi
+
+echo "# Added $REMOTE_URL"
+exit 0
diff --git a/tools/bin/gitCloneOneOf.sh b/tools/bin/gitCloneOneOf.sh
new file mode 100755
index 00000000..fecdf990
--- /dev/null
+++ b/tools/bin/gitCloneOneOf.sh
@@ -0,0 +1,38 @@
+#!/bin/bash
+
+if [ $# -lt 3 ]; then
+ echo "ERROR incorrect number of parameters"
+ echo "Usage:"
+ echo " $0 <repo_name> <repo_directory> <remote1> [<remote2>...]"
+ echo
+ echo "$0 clones repository <repo_name> to the directory <repo_directory>"
+ echo "It clones off of <remote1>. If git can't clone off of <remote1> it tries"
+ echo "to clone off of <remote2>, then <remote3> etc."
+ exit 1
+fi
+
+REPO_NAME=$1
+REPO_DIR=$2
+
+REMOTES=${@:3}
+
+if [ -d $REPO_DIR ]; then
+ echo "Directory $REPO_DIR exists, no need to clone"
+ exit 0
+fi
+
+echo "###################################################################"
+echo "# Cloning $REPO_NAME"
+
+for remote in $REMOTES; do
+ echo "# Trying $remote"
+ git clone $remote $REPO_DIR >/dev/null 2>&1
+ ERROR=$?
+ if [ $ERROR -eq 0 ]; then
+ echo "# SUCCESS"
+ exit 0
+ fi
+ echo "# Skipped "
+done
+echo "# FAILED cloning "
+exit 1
diff --git a/tools/bin/gitStatus.sh b/tools/bin/gitStatus.sh
new file mode 100644
index 00000000..a586c644
--- /dev/null
+++ b/tools/bin/gitStatus.sh
@@ -0,0 +1,72 @@
+#!/bin/sh
+
+if [ $# -lt 5 ]; then
+ echo "ERROR incorrect number of parameters"
+ echo "Usage:"
+ echo " $0 <repo_name> <repo_directory> <origin> <remote_name> <remote_url>"
+ echo
+ echo "$0 check the values of the repo. Compare what git things with what we would like"
+ echo " repo_name - Name of the repo (cosmetic)"
+ echo " repo_directory - Directory where to find the git repo"
+ echo " origin - What origin should be set to"
+ echo " remote_name - The name of a remote to check"
+ echo " remote_url - What that remote should be set to"
+ exit 1
+fi
+
+REPO_NAME=$1
+REPO_DIR=$2
+ORIGIN=$3
+REMOTE_NAME=$4
+REMOTE_URL=$5
+
+if [ ! -d $REPO_DIR ]; then
+ echo "ERROR running $0"
+ echo " Directory $REPO_DIR not found"
+ exit 1
+fi
+
+cd $REPO_DIR
+
+NEEDS_UPDATE=NO
+
+echo "###################################################################"
+echo "# $REPO_NAME "
+
+# An origin of - means we should ignore the origin check
+if [ $ORIGIN != - ]; then
+ ORIGIN_ACTUAL=`git config --get remote.origin.url`
+ if [ $ORIGIN_ACTUAL != $ORIGIN ]; then
+ echo "# WARNING: remote origin missmatch"
+ echo "# Expected $ORIGIN"
+ echo "# Found $ORIGIN_ACTUAL"
+ NEEDS_UPDATE=YES
+ fi
+fi
+
+REMOTE_URL_ACTUAL=`git config --get remote.$REMOTE_NAME.url 2>/dev/null`
+
+if [ $? -ne 0 ]; then
+ echo "# WARNING remote $REMOTE_NAME does not exist"
+ echo "# Expected $REMOTE_NAME = $REMOTE_URL"
+ echo "# Found a remote called $REMOTE_NAME does not exist"
+ NEEDS_UPDATE=YES
+else
+ if [ $REMOTE_URL_ACTUAL != $REMOTE_URL ]; then
+ echo "# WARNING remote $REMOTE_NAME missmatch"
+ echo "# Expected $REMOTE_NAME = $REMOTE_URL"
+ echo "# Found $REMOTE_NAME = $REMOTE_URL_ACTUAL"
+ NEEDS_UPDATE=YES
+ fi
+fi
+
+if [ $NEEDS_UPDATE = NO ]; then
+ echo "# Up to date"
+ exit 0
+fi
+
+echo "#"
+echo "# Your settings don't match the default settings for $REPO_NAME"
+echo "# located at $REPO_DIR"
+
+