]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
ci: factor out common code
authorTravis Cross <tc@traviscross.com>
Sun, 6 May 2012 02:58:16 +0000 (02:58 +0000)
committerTravis Cross <tc@traviscross.com>
Sun, 6 May 2012 04:28:15 +0000 (04:28 +0000)
scripts/ci/common.sh [new file with mode: 0755]
scripts/ci/debsrcbuilder.sh
scripts/ci/rpmbuilder.sh
scripts/ci/sounds-en-us-callie.sh
scripts/ci/src_tarball.sh

diff --git a/scripts/ci/common.sh b/scripts/ci/common.sh
new file mode 100755 (executable)
index 0000000..61f8549
--- /dev/null
@@ -0,0 +1,29 @@
+#!/bin/bash
+##### -*- mode:shell-script; indent-tabs-mode:nil; sh-basic-offset:2 -*-
+
+src_repo="$(pwd)"
+tmp_dir=${TMP_DIR:="/tmp"}
+
+parse_version () {
+  local ver="$1"
+  local major=$(echo "$ver" | cut -d. -f1)
+  local minor=$(echo "$ver" | cut -d. -f2)
+  local micro=$(echo "$ver" | cut -d. -f3)
+  local rev=$(echo "$ver" | cut -d. -f4)
+  echo "ver='$ver'"
+  echo "major='$major'"
+  echo "minor='$minor'"
+  echo "micro='$micro'"
+  echo "rev='$rev'"
+}
+
+if [ ! -d .git ]; then
+  echo "error: must be run from within the top level of a FreeSWITCH git tree." 1>&2
+  exit 1;
+fi
+
+if [ -z "$1" ]; then
+  echo "usage: $0 MAJOR.MINOR.MICRO[.REVISION] BUILD_NUMBER" 1>&2
+  exit 1;
+fi
+
index 4d9175c4ac33748f247d1b2ddf6fba411be233b0..3551f3fc490a3890814794ccba50e85598f28bd1 100755 (executable)
@@ -1,24 +1,11 @@
 #!/bin/bash
 ##### -*- mode:shell-script; indent-tabs-mode:nil; sh-basic-offset:2 -*-
 
-src_repo="$(pwd)"
-
-if [ ! -d .git ]; then
-  echo "error: must be run from within the top level of a FreeSWITCH git tree." 1>&2
-  exit 1;
-fi
-
-if [ -z "$1" ]; then
-  echo "usage: ./scripts/ci/debbuilder.sh MAJOR.MINOR.MICRO[.REVISION] BUILD_NUMBER" 1>&2
-  exit 1;
-fi
-
-ver="$1"
-major=$(echo "$ver" | cut -d. -f1)
-minor=$(echo "$ver" | cut -d. -f2)
-micro=$(echo "$ver" | cut -d. -f3)
-rev=$(echo "$ver" | cut -d. -f4)
+sdir="."
+[ -n "${0%/*}" ] && sdir="${0%/*}"
+. $sdir/common.sh
 
+eval $(parse_version "$1")
 datestamp="$(date +%Y%m%dT%H%M%SZ)"
 nightly="n${datestamp}"
 build="b$2"
index 55e484d0140dccb1e17bb4a2a73847528091b289..5f2dd20ec62b1f619774fa33e24da73f71c879b4 100755 (executable)
@@ -1,24 +1,11 @@
 #!/bin/bash
 ##### -*- mode:shell-script; indent-tabs-mode:nil; sh-basic-offset:2 -*-
 
-src_repo="$(pwd)"
-
-if [ ! -d .git ]; then
-  echo "error: must be run from within the top level of a FreeSWITCH git tree." 1>&2
-  exit 1;
-fi
-
-if [ -z "$1" ]; then
-  echo "usage: ./scripts/ci/rpmbuilder.sh MAJOR.MINOR.MICRO[.REVISION] BUILD_NUMBER" 1>&2
-  exit 1;
-fi
-
-ver="$1"
-major=$(echo "$ver" | cut -d. -f1)
-minor=$(echo "$ver" | cut -d. -f2)
-micro=$(echo "$ver" | cut -d. -f3)
-rev=$(echo "$ver" | cut -d. -f4)
+sdir="."
+[ -n "${0%/*}" ] && sdir="${0%/*}"
+. $sdir/common.sh
 
+eval $(parse_version "$1")
 build="$2"
 
 dst_name="freeswitch-$major.$minor.$micro"
index 1e7ec20c38878f76c5d021d5a2e81007d62ec582..fbcf1ea422f146556a5d81e3e8a2f661849c7086 100755 (executable)
@@ -1,23 +1,11 @@
 #!/bin/bash
 ##### -*- mode:shell-script; indent-tabs-mode:nil; sh-basic-offset:2 -*-
 
-src_repo="$(pwd)"
-
-if [ ! -d .git ]; then
-  echo "error: must be run from within the top level of a FreeSWITCH git tree." 1>&2
-  exit 1;
-fi
-
-if [ -z "$1" ]; then
-  echo "usage: ./scripts/ci/rpmbuilder.sh MAJOR.MINOR.MICRO[.REVISION] BUILD_NUMBER" 1>&2
-  exit 1;
-fi
-
-ver="$1"
-major=$(echo "$ver" | cut -d. -f1)
-minor=$(echo "$ver" | cut -d. -f2)
-micro=$(echo "$ver" | cut -d. -f3)
+sdir="."
+[ -n "${0%/*}" ] && sdir="${0%/*}"
+. $sdir/common.sh
 
+eval $(parse_version "$1")
 build="$2"
 
 cd rpmbuild/SOURCES
index 926ef6ec89cc1cf7b33d0888fcec0cd121e8f954..27c9c77a8aca16b805f0cd2d136408905606fcbd 100755 (executable)
@@ -1,25 +1,11 @@
 #!/bin/bash
 ##### -*- mode:shell-script; indent-tabs-mode:nil; sh-basic-offset:2 -*-
 
-src_repo="$(pwd)"
+sdir="."
+[ -n "${0%/*}" ] && sdir="${0%/*}"
+. $sdir/common.sh
 
-if [ ! -d .git ]; then
-  echo "error: must be run from within the top level of a FreeSWITCH git tree." 1>&2
-  exit 1;
-fi
-
-if [ -z "$1" ]; then
-  echo "usage: ./scripts/dailys.sh MAJOR.MINOR.MICRO[.REVISION] BUILD_NUMBER" 1>&2
-  exit 1;
-fi
-
-ver="$1"
-major=$(echo "$ver" | cut -d. -f1)
-minor=$(echo "$ver" | cut -d. -f2)
-micro=$(echo "$ver" | cut -d. -f3)
-rev=$(echo "$ver" | cut -d. -f4)
-
-tmp_dir=${TMP_DIR:="/tmp"}
+eval $(parse_version "$1")
 
 dst_name="freeswitch-$major.$minor.$micro"
 dst_parent="${tmp_dir}/jenkis.$$/"