File gnuradio-next_update.sh of Package gnuradio

#!/bin/bash
REPO=git://gnuradio.org/gnuradio
WORK_TREE=$(mktemp -d)
NAME=gnuradio-next
SPECFILE=gnuradio-next.spec
VERSION=1
RELEASE=1

echo "============================="
echo "Checking out gnuradio repository..."
echo "============================="
git clone ${REPO} ${WORK_TREE}
git --git-dir=${WORK_TREE}/.git --work-tree=${WORK_TREE} checkout --track -b next origin/next

VERSION=$(git --git-dir=${WORK_TREE}/.git --work-tree=${WORK_TREE} show --pretty=format:"%ai" | head -n1 | cut -s -d' ' -f1 | sed -e 's/-//g')

#VERSION=$(git --git-dir=${WORK_TREE}/.git --work-tree=${WORK_TREE} describe | sed -r 's/^v?(.*)-([0-9]+)-g.*$/\1/')
#RELEASE=$(git --git-dir=${WORK_TREE}/.git --work-tree=${WORK_TREE} describe | sed -r 's/^v?(.*)-([0-9]+)-g.*$/\2/')

echo ""
echo "============================="
echo "Archiving local repository..."
echo "============================="
git --git-dir=${WORK_TREE}/.git --work-tree=${WORK_TREE} archive --prefix=${NAME}-${VERSION}/ --format=tar HEAD | bzip2 -c > ${NAME}-${VERSION}.tar.bz2
echo ""
echo "============================="
echo "Updateing specfile to"
echo -e "\tName: ${NAME}"
echo -e "\tVersion: ${VERSION}"
echo -e "\tRelease: ${RELEASE}"
echo -e "\tSource: ${NAME}-${VERSION}.tar.gz"
echo "============================="
sed -i \
	-e "s,^%define _name .*$,%define _name ${NAME}," \
	-e "s,^%define _version .*$,%define _version ${VERSION}," \
	-e "s,^%define _release .*$,%define _release ${RELEASE}," \
	-e "s,^%define _src .*$,%define _src ${NAME}-${VERSION}.tar.bz2," \
	${SPECFILE}
echo "setBadness('permissions-unauthorized-file', 0)" > ${NAME}-${VERSION}-rpmlintrc

rm -rf ${WORK_TREE}
openSUSE Build Service is sponsored by