diff options
author | Remi Collet <fedora@famillecollet.com> | 2015-07-05 08:35:04 +0200 |
---|---|---|
committer | Remi Collet <fedora@famillecollet.com> | 2015-07-05 08:35:04 +0200 |
commit | 62f7eeb67cd702c99e91ee19c8364adfd2f579c7 (patch) | |
tree | 250749df4f974593065183574d10376934607683 /php-doctrine-dbal-get-source.sh | |
parent | 1eeeb359948aa4ef2360195b00f0a5177e848e68 (diff) |
php-doctrine-dbal: 2.5.1, backpot from fedora
Diffstat (limited to 'php-doctrine-dbal-get-source.sh')
-rwxr-xr-x | php-doctrine-dbal-get-source.sh | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/php-doctrine-dbal-get-source.sh b/php-doctrine-dbal-get-source.sh new file mode 100755 index 0000000..e283587 --- /dev/null +++ b/php-doctrine-dbal-get-source.sh @@ -0,0 +1,62 @@ +#/bin/sh + +GIT=`which git` +RPM=`which rpm` + +if [ -z "$GIT" ] +then + echo "ERROR: 'git' command not found" 1>&2 + exit 1 +elif [ -z "$RPM" ] +then + echo "ERROR: 'rpm' command not found" 1>&2 + exit 1 +fi + +function print { + echo -e "\e[0;33m>>>>> ${1}\e[0m" +} + +SPEC=`ls *.spec` +NAME=`echo $SPEC | sed 's#\.spec##'` +VERSION=`egrep '%global\s*github_version' $SPEC | awk '{print $3}'` + +print "SPEC = $SPEC" +print "NAME = $NAME" + +GIT_OWNER=`egrep '%global\s*github_owner' $SPEC | awk '{print $3}'` +GIT_NAME=`egrep '%global\s*github_name' $SPEC | awk '{print $3}'` +GIT_COMMIT=`egrep '%global\s*github_commit' $SPEC | awk '{print $3}'` +GIT_REPO=https://github.com/${GIT_OWNER}/${GIT_NAME} +GIT_DIR=`echo $GIT_REPO | sed 's#.*/##'` + +print "GIT_OWNER = $GIT_OWNER" +print "GIT_NAME = $GIT_NAME" +print "GIT_COMMIT = $GIT_COMMIT" +print "GIT_REPO = $GIT_REPO" +print "GIT_DIR = $GIT_DIR" + +TEMP_DIR=$(mktemp --dir) + +pushd $TEMP_DIR + print "Cloning git repo..." + $GIT clone $GIT_REPO + + pushd $GIT_DIR + print "Checking out commit..." + $GIT checkout $GIT_COMMIT + popd + + TAR_DIR=${GIT_NAME}-${GIT_COMMIT} + print "TAR_DIR = $TAR_DIR" + + mv $GIT_DIR $TAR_DIR + + TAR_FILE=`$RPM --eval='%{_sourcedir}'`/${NAME}-${VERSION}-${GIT_COMMIT}.tar.gz + print "TAR_FILE = $TAR_FILE" + + [ -e $TAR_FILE ] && rm -f $TAR_FILE + tar --exclude-vcs -czf $TAR_FILE $TAR_DIR +popd + +rm -rf $TEMP_DIR |