release: add a script for creating bootstrapped tarballs from a specific commit
authorCory Fields <theuni-nospam-@xbmc.org>
Sat, 15 Dec 2012 05:27:40 +0000 (00:27 -0500)
committerCory Fields <theuni-nospam-@xbmc.org>
Sat, 15 Dec 2012 06:40:20 +0000 (01:40 -0500)
example: 'mk-release-source 10.0-Dharma' will create xbmc-10.0-Dharma.tar.gz,
ready to be uploaded and deployed. It works in a subdir and does not affect the
current working dir or git repo.

tools/mk-release-source [new file with mode: 0644]

diff --git a/tools/mk-release-source b/tools/mk-release-source
new file mode 100644 (file)
index 0000000..7964665
--- /dev/null
@@ -0,0 +1,31 @@
+#!/bin/sh
+REVISION="${1}"
+COMPRESS="gzip"
+WORKDIR="xbmc-${REVISION}"
+
+if [[ -z "${REVISION}" ]]; then echo "Usage: ${0} tag|branch|commit [gzip|xz|...]" && exit 1; fi
+if [[ -d "${WORKDIR}" ]]; then echo "${WORKDIR} dir exists, refusing to overwrite" && exit 1; fi
+if [[ -n "${2}" ]]; then COMPRESS="${2}"; fi
+
+which git >/dev/null || exit 1
+git rev-list -1 ${REVISION} >/dev/null || exit 1
+
+mkdir -p "${WORKDIR}"
+GIT_WORK_TREE="${WORKDIR}" git checkout "${REVISION}" -- . || exit 1
+
+pushd "${WORKDIR}" >/dev/null
+./bootstrap || ( rm -rf "${WORKDIR}" && exit 1 )
+popd >/dev/null
+
+pushd "${WORKDIR}/tools/android/depends" >/dev/null
+./bootstrap || ( rm -rf "${WORKDIR}" && exit 1 )
+popd >/dev/null
+
+echo "${REVISION}" > "${WORKDIR}"/VERSION
+echo "`git rev-list -1 ${REVISION}`" >> "${WORKDIR}"/VERSION
+
+tar cf "${WORKDIR}.tar" "${WORKDIR}" || ( rm -f "${WORKDIR}.tar" && rm -rf "${WORKDIR}" exit 1 )
+${COMPRESS} ${WORKDIR}.tar || ( rm -f "${WORKDIR}.tar" && rm -rf "${WORKDIR}" && exit 1 )
+
+rm -rf ${WORKDIR}
+exit 0