]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
ci: add continuous integration helper scripts
authorKen Rice <krice@tollfreegateway.com>
Sat, 24 Mar 2012 03:44:21 +0000 (03:44 +0000)
committerTravis Cross <tc@traviscross.com>
Sat, 24 Mar 2012 05:04:41 +0000 (05:04 +0000)
scripts/ci/extras/erlangbuilder.sh [new file with mode: 0755]
scripts/ci/get_extra_sources.sh [new file with mode: 0755]
scripts/ci/rpmbuilder.sh [new file with mode: 0755]
scripts/ci/sounds-en-us-callie.sh [new file with mode: 0755]
scripts/ci/sounds-music.sh [new file with mode: 0755]
scripts/ci/sounds-ru-ru-elena.sh [new file with mode: 0755]
scripts/ci/src_tarball.sh [new file with mode: 0755]
scripts/dailys.sh [new file with mode: 0755]

diff --git a/scripts/ci/extras/erlangbuilder.sh b/scripts/ci/extras/erlangbuilder.sh
new file mode 100755 (executable)
index 0000000..51a41ac
--- /dev/null
@@ -0,0 +1,26 @@
+#!/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/extras/erlangbuilder.sh" 1>&2
+  exit 1;
+fi
+
+mkdir -p $src_repo/rpmbuild/{SOURCES,BUILD,BUILDROOT,i386,x86_64,SOURCES,SPECS}
+cd $src_repo
+
+rpmbuild --define "_topdir %(pwd)/rpmbuild" \
+  --define "_rpmdir %{_topdir}" \
+  --define "_srcrpmdir %{_topdir}" \
+  -ba erlang.spec
+
+mkdir $src_repo/RPMS
+mv $src_repo/rpmbuild/*/*.rpm $src_repo/RPMS/.
+
diff --git a/scripts/ci/get_extra_sources.sh b/scripts/ci/get_extra_sources.sh
new file mode 100755 (executable)
index 0000000..add57c7
--- /dev/null
@@ -0,0 +1,21 @@
+#!/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
+
+mkdir -p $src_repo/rpmbuild/{SOURCES,BUILD,BUILDROOT,i386,x86_64,SOURCES,SPECS}
+
+cd $src_repo/rpmbuild/SOURCES
+
+for i in `grep 'Source..\?:' $src_repo/freeswitch.spec|grep -v Source0 |awk '{print $2}'`; do wget $i; done
+
+cat 1>&2 <<EOF
+----------------------------------------------------------------------
+Got the Extra Source Tarballs We Need....
+----------------------------------------------------------------------
+EOF
diff --git a/scripts/ci/rpmbuilder.sh b/scripts/ci/rpmbuilder.sh
new file mode 100755 (executable)
index 0000000..55e484d
--- /dev/null
@@ -0,0 +1,53 @@
+#!/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)
+
+build="$2"
+
+dst_name="freeswitch-$major.$minor.$micro"
+dst_parent="/tmp/"
+dst_dir="/tmp/$dst_name"
+
+mkdir -p $src_repo/rpmbuild/{SOURCES,BUILD,BUILDROOT,i386,x86_64,SPECS}
+
+cd $src_repo
+
+rpmbuild --define "VERSION_NUMBER $ver" \
+  --define "BUILD_NUMBER $build" \
+  --define "_topdir %(pwd)/rpmbuild" \
+  --define "_rpmdir %{_topdir}" \
+  --define "_srcrpmdir %{_topdir}" \
+  -ba freeswitch.spec
+
+# --define '_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm' \
+# --define "_sourcedir  %{_topdir}" \
+# --define "_builddir %{_topdir}" \
+
+
+mkdir $src_repo/RPMS
+mv $src_repo/rpmbuild/*/*.rpm $src_repo/RPMS/.
+
+cat 1>&2 <<EOF
+----------------------------------------------------------------------
+The v$ver-$build RPMs have been rolled, now we
+just need to push them to the YUM Repo
+----------------------------------------------------------------------
+EOF
+
diff --git a/scripts/ci/sounds-en-us-callie.sh b/scripts/ci/sounds-en-us-callie.sh
new file mode 100755 (executable)
index 0000000..1e7ec20
--- /dev/null
@@ -0,0 +1,43 @@
+#!/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)
+
+build="$2"
+
+cd rpmbuild/SOURCES
+
+wget http://files.freeswitch.org/freeswitch-sounds-en-us-callie-48000-$ver.tar.gz
+
+cd ../..
+
+rpmbuild --define "VERSION_NUMBER $ver" \
+  --define "BUILD_NUMBER 1" \
+  --define "_topdir %(pwd)/rpmbuild" \
+  --define "_rpmdir %{_topdir}" \
+  --define "_srcrpmdir %{_topdir}" \
+  -ba freeswitch-sounds-en-us-callie.spec
+
+mkdir $src_repo/RPMS
+mv $src_repo/rpmbuild/*/*.rpm $src_repo/RPMS/.
+
+cat 1>&2 <<EOF
+----------------------------------------------------------------------
+The Sound RPMs have been rolled
+----------------------------------------------------------------------
+EOF
diff --git a/scripts/ci/sounds-music.sh b/scripts/ci/sounds-music.sh
new file mode 100755 (executable)
index 0000000..118d6b7
--- /dev/null
@@ -0,0 +1,37 @@
+#!/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
+
+ver="1.0.8"
+
+cd rpmbuild/SOURCES
+
+wget http://files.freeswitch.org/freeswitch-sounds-music-8000-$ver.tar.gz
+wget http://files.freeswitch.org/freeswitch-sounds-music-16000-$ver.tar.gz
+wget http://files.freeswitch.org/freeswitch-sounds-music-32000-$ver.tar.gz
+wget http://files.freeswitch.org/freeswitch-sounds-music-48000-$ver.tar.gz
+
+cd ../..
+
+rpmbuild --define "VERSION_NUMBER $ver" \
+  --define "BUILD_NUMBER 1" \
+  --define "_topdir %(pwd)/rpmbuild" \
+  --define "_rpmdir %{_topdir}" \
+  --define "_srcrpmdir %{_topdir}" \
+  -ba freeswitch-sounds-music.spec
+
+mkdir $src_repo/RPMS
+mv $src_repo/rpmbuild/*/*.rpm $src_repo/RPMS/.
+
+cat 1>&2 <<EOF
+----------------------------------------------------------------------
+The Sound RPMs have been rolled
+----------------------------------------------------------------------
+EOF
+
diff --git a/scripts/ci/sounds-ru-ru-elena.sh b/scripts/ci/sounds-ru-ru-elena.sh
new file mode 100755 (executable)
index 0000000..93da322
--- /dev/null
@@ -0,0 +1,36 @@
+#!/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
+
+ver="1.0.13"
+
+build="2"
+
+cd rpmbuild/SOURCES
+
+wget http://files.freeswitch.org/freeswitch-sounds-ru-RU-elena-48000-$ver.tar.gz
+
+cd ../..
+
+rpmbuild --define "VERSION_NUMBER $ver" \
+  --define "BUILD_NUMBER $build" \
+  --define "_topdir %(pwd)/rpmbuild" \
+  --define "_rpmdir %{_topdir}" \
+  --define "_srcrpmdir %{_topdir}" \
+  -ba freeswitch-sounds-ru-RU-elena.spec
+
+mkdir $src_repo/RPMS
+mv $src_repo/rpmbuild/*/*.rpm $src_repo/RPMS/.
+
+cat 1>&2 <<EOF
+----------------------------------------------------------------------
+The Sound RPMs have been rolled
+----------------------------------------------------------------------
+EOF
+
diff --git a/scripts/ci/src_tarball.sh b/scripts/ci/src_tarball.sh
new file mode 100755 (executable)
index 0000000..c4d95ce
--- /dev/null
@@ -0,0 +1,94 @@
+#!/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/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)
+
+build="$2"
+
+dst_name="freeswitch-$major.$minor.$micro"
+dst_parent="/tmp/jenkis.$$/"
+dst_dir="/tmp/jenkins.$$/$dst_name"
+
+if [ -d "$dst_dir" ]; then
+  echo "error: destination directory $dst_dir already exists." 1>&2
+  exit 1;
+fi
+
+# save local changes
+#ret=$(git stash save "Save uncommitted changes before tagging.")
+#if echo $ret | grep "^Saved"; then
+    #stash_saved=1
+#fi
+
+sed -e "s|\(AC_SUBST(SWITCH_VERSION_MAJOR, \[\).*\(\])\)|\1$major\2|" \
+  -e "s|\(AC_SUBST(SWITCH_VERSION_MINOR, \[\).*\(\])\)|\1$minor\2|" \
+  -e "s|\(AC_SUBST(SWITCH_VERSION_MICRO, \[\).*\(\])\)|\1$micro\2|" \
+  -e "s|\(AC_INIT(\[freeswitch\], \[\).*\(\], BUG-REPORT-ADDRESS)\)|\1$major.$minor.$micro\2|" \
+  -i configure.in
+
+if [ -n "$rev" ]; then
+  sed -e "s|\(AC_SUBST(SWITCH_VERSION_REVISION, \[\).*\(\])\)|\1$rev\2|" \
+    -e "s|#\(AC_SUBST(SWITCH_VERSION_REVISION\)|\1|" \
+    -i configure.in
+fi
+
+#git add configure.in
+#git commit -m "Release freeswitch-$ver"
+#git tag -a -m "freeswitch-$ver release" v$ver
+
+#git clone $src_repo $dst_dir
+#if [ -n "$stash_saved" ]; then
+#    git stash pop
+#fi
+
+mkdir -p $dst_dir
+cp -r . $dst_dir
+
+cd $dst_dir
+
+./bootstrap.sh
+mv bootstrap.sh rebootstrap.sh
+rm -f docs/AUTHORS
+rm -f docs/COPYING
+rm -f docs/ChangeLog
+rm -rf .git
+cd ..
+
+cd $dst_parent
+
+ls
+
+tar -cvf $dst_name.tar $dst_name
+
+# gzip -9 -c $dst_name.tar > $dst_name.tar.gz || echo "gzip not available"
+bzip2 -z -k $dst_name.tar || echo "bzip2 not available"
+# xz -z -9 -k $dst_name.tar || echo "xz / xz-utils not available"
+
+rm -rf $dst_name.tar $dst_dir
+
+mkdir -p $src_repo/src_dist
+mv -f $dst_name.tar.* $src_repo/src_dist
+
+cat 1>&2 <<EOF
+----------------------------------------------------------------------
+The v$ver-$build tarballs have been rolled,
+now we just need to roll packages with them
+----------------------------------------------------------------------
+EOF
+
diff --git a/scripts/dailys.sh b/scripts/dailys.sh
new file mode 100755 (executable)
index 0000000..9d0e639
--- /dev/null
@@ -0,0 +1,109 @@
+#!/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/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)
+
+build="$2"
+
+dst_name="freeswitch-$major.$minor.$micro"
+dst_parent="/tmp/"
+dst_dir="/tmp/$dst_name"
+
+if [ -d "$dst_dir" ]; then
+  echo "error: destination directory $dst_dir already exists." 1>&2
+  exit 1;
+fi
+
+# save local changes
+#ret=$(git stash save "Save uncommitted changes before tagging.")
+#if echo $ret | grep "^Saved"; then
+    #stash_saved=1
+#fi
+
+sed -e "s|\(AC_SUBST(SWITCH_VERSION_MAJOR, \[\).*\(\])\)|\1$major\2|" \
+  -e "s|\(AC_SUBST(SWITCH_VERSION_MINOR, \[\).*\(\])\)|\1$minor\2|" \
+  -e "s|\(AC_SUBST(SWITCH_VERSION_MICRO, \[\).*\(\])\)|\1$micro\2|" \
+  -e "s|\(AC_INIT(\[freeswitch\], \[\).*\(\], BUG-REPORT-ADDRESS)\)|\1$major.$minor.$micro\2|" \
+  -i configure.in
+
+if [ -n "$rev" ]; then
+  sed -e "s|\(AC_SUBST(SWITCH_VERSION_REVISION, \[\).*\(\])\)|\1$rev\2|" \
+    -e "s|#\(AC_SUBST(SWITCH_VERSION_REVISION\)|\1|" \
+    -i configure.in
+fi
+
+#git add configure.in
+#git commit -m "Release freeswitch-$ver"
+#git tag -a -m "freeswitch-$ver release" v$ver
+
+#git clone $src_repo $dst_dir
+#if [ -n "$stash_saved" ]; then
+#    git stash pop
+#fi
+
+cp -r . $dst_dir
+
+cd $dst_dir
+
+./bootstrap.sh
+mv bootstrap.sh rebootstrap.sh
+rm -f docs/AUTHORS
+rm -f docs/COPYING
+rm -f docs/ChangeLog
+rm -rf .git
+cd ..
+cd $dst_parent
+tar -cvf $dst_name.tar $dst_name
+
+# gzip -9 -c $dst_name.tar > $dst_name.tar.gz || echo "gzip not available"
+bzip2 -z -k $dst_name.tar || echo "bzip2 not available"
+# xz -z -9 -k $dst_name.tar || echo "xz / xz-utils not available"
+rm -rf $dst_name.tar $dst_dir
+
+mkdir -p $src_repo/rpmbuild/{SOURCES,BUILD,BUILDROOT,i386,x86_64,SOURCES,SPECS}
+mv -f $dst_name.tar.* $src_repo/rpmbuild/SOURCES/.
+
+cd $src_repo/rpmbuild/SOURCES
+
+for i in `grep 'Source..\?:' $src_repo/freeswitch.spec|grep -v Source0 |awk '{print $2}'`; do wget $i; done
+
+cd $src_repo
+
+rpmbuild --define "VERSION_NUMBER $ver" \
+  --define "BUILD_NUMBER $build" \
+  --define "_topdir %(pwd)/rpmbuild" \
+  --define "_rpmdir %{_topdir}" \
+  --define "_srcrpmdir %{_topdir}" \
+  -ba freeswitch.spec
+
+# --define '_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm' \
+# --define "_sourcedir  %{_topdir}" \
+# --define "_builddir %{_topdir}" \
+
+
+mkdir $src_repo/RPMS
+mv $src_repo/rpmbuild/*/*.rpm $src_repo/RPMS/.
+
+cat 1>&2 <<EOF
+----------------------------------------------------------------------
+The v$ver-$build tarballs and RPMs have been rolled, now we
+just need to roll packages with them
+----------------------------------------------------------------------
+EOF
+