#!/bin/bash # vim: set sw=4 sts=4 et : set -e W="${1}" RDIR='/home/nirbheek/projects/AutotuA/releases' REPO='/home/nirbheek/projects/AutotuA/autotua.git' TMPDIR='/tmp/autotua-release' DESTDIR="${RDIR}/" test -z ${W} && echo "Specify what to release" && exit 1 rm -rf "${TMPDIR}" mkdir -p "${TMPDIR}" mkdir -p "${DESTDIR}" confirm_overwrite() { if test -e "${DESTDIR}/${FILE}"; then echo -n "A tarball for that release already exists. Overwrite? [y/N] " read ans if test "${ans}" != "y"; then echo "Cancelled." exit 0 fi fi } release_master() { cd "${REPO}/master" V="$(grep '^PV[[:space:]]*\:=' Makefile)" V=${V##*:= } P="autotua-master-${V}" FILE="${P}.tar.bz2" mkdir -p "${DESTDIR}/${V}" make dist mv "${FILE}" "${DESTDIR}/${V}" } release_slave() { cd "${REPO}/slave" V=$(grep '^[[:space:]]*version=' setup.py) V=${V##*version=\'} V=${V%%\',*} P="autotua-slave-${V}" FILE="${P}.tar.gz" mkdir -p "${DESTDIR}/${V}" confirm_overwrite git archive --prefix=${P}/ HEAD * | tar x -C "${TMPDIR}" cd "${TMPDIR}/${P}" ./setup.py --quiet sdist cp "dist/${FILE}" "${DESTDIR}/${V}" rm -rf "${TMPDIR}/${P}" } bumb_ebuild() { CATEG='dev-util' PN='autotua-slave' P="${PN}-${V}" cd "${REPO}/overlay/${CATEG}/${PN}" test -f ${P}.ebuild || cp $(echo ${PN}-*.ebuild | tr ' ' '\n' | line ) ${P}.ebuild sed -i -e "/${P}/d" Manifest rm -f "/usr/portage/distfiles/${P}.tar.bz2" ebuild ${P}.ebuild digest } if test "${W}" = "slave"; then release_slave bumb_ebuild elif test "${W}" = "master"; then release_master elif test "${W}" = "both"; then release_slave release_master bumb_ebuild else echo "Please specify which to release (slave|master|both)" exit 1 fi