aboutsummaryrefslogtreecommitdiff
path: root/helpers/llvm-common
diff options
context:
space:
mode:
authorRenato Golin <rengolin@gmail.com>2016-04-26 11:02:23 +0100
committerRenato Golin <rengolin@gmail.com>2016-04-26 11:02:23 +0100
commit94cc104f044261f74fbff3ff587855df1a05f64d (patch)
tree7c6664fdf7e7fab54fea926b1fc6196a09b6540f /helpers/llvm-common
downloadlinaro-scripts-94cc104f044261f74fbff3ff587855df1a05f64d.tar.gz
Initial Commit, moving from dev-private and removing private stuff
Diffstat (limited to 'helpers/llvm-common')
-rwxr-xr-xhelpers/llvm-common60
1 files changed, 60 insertions, 0 deletions
diff --git a/helpers/llvm-common b/helpers/llvm-common
new file mode 100755
index 0000000..5cf3f4a
--- /dev/null
+++ b/helpers/llvm-common
@@ -0,0 +1,60 @@
+#!/usr/bin/env bash
+
+# The common script is only meant to be included from other LLVM helper scripts
+
+if [[ $LLVM_SRC = '' ]]; then
+ echo "Please, define \$LLVM_SRC"
+ exit -1
+fi
+if [[ $LLVM_BLD = '' ]]; then
+ echo "Please, define \$LLVM_BLD"
+ exit -1
+fi
+if [[ $LLVM_GITRW = '' ]]; then
+ echo "Please, define \$LLVM_GITRW"
+ exit -1
+fi
+if [[ $LLVM_GITRW = 'yes' ]]; then
+ if [[ $LLVM_SVNUSER = '' ]] || [[ $LLVM_GITUSER = '' ]]; then
+ echo "Please, define \$LLVM_GITUSER and \$LLVM_SVNUSER when using GITRW=yes"
+ echo "GITUSER is your Linaro git user, SVNUSER is your LLVM commit user"
+ exit 1
+ fi
+fi
+
+get_branch() {
+ branch=`git rev-parse --abbrev-ref HEAD`
+ if [[ $? != 0 ]]; then
+ local dir=`pwd`
+ echo "Source dir '$dir' is not in a git repository" 1>&2
+ exit -1
+ fi
+ echo $branch
+}
+
+get_branches() {
+ branches=`git for-each-ref --sort=-committerdate refs/heads/ --format='%(refname:short)'`
+ if [[ $? != 0 ]]; then
+ local dir=`pwd`
+ echo "Source dir '$dir' is not in a git repository" 1>&2
+ exit -1
+ fi
+ echo $branches
+}
+
+safe_run() {
+ CMD="$*"
+ $CMD
+ if [[ $? != 0 ]]; then
+ echo "'$CMD' failed, bailing out"
+ exit 1
+ fi
+}
+
+is_git() {
+ test -d `git rev-parse --show-toplevel`/.git
+}
+
+is_git_svn() {
+ test -f `git rev-parse --show-toplevel`/.git/svn/.metadata
+}