summaryrefslogtreecommitdiffstats
path: root/php-phpdocumentor-reflection-docblock-get-source.sh
diff options
context:
space:
mode:
authorShawn Iwinski <siwinski@redhat.com>2017-07-18 12:13:40 -0400
committerRemi Collet <remi@remirepo.net>2017-08-01 15:48:36 +0200
commit291a6398edd2f43a8ff38529e582baa9d0cab7d2 (patch)
tree714cfcfc233c87051abedce1eb22669827bf8049 /php-phpdocumentor-reflection-docblock-get-source.sh
parent096a009cb6be9e7757684bda6a77efad188b64db (diff)
Update to 3.2.0 (RHBZ #1471379)
Diffstat (limited to 'php-phpdocumentor-reflection-docblock-get-source.sh')
-rwxr-xr-xphp-phpdocumentor-reflection-docblock-get-source.sh69
1 files changed, 69 insertions, 0 deletions
diff --git a/php-phpdocumentor-reflection-docblock-get-source.sh b/php-phpdocumentor-reflection-docblock-get-source.sh
new file mode 100755
index 0000000..5f9241e
--- /dev/null
+++ b/php-phpdocumentor-reflection-docblock-get-source.sh
@@ -0,0 +1,69 @@
+#/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"
+}
+
+if [ -x "$1" ]
+then
+ SPEC=$1
+else
+ SPEC=`ls *.spec | head -1`
+fi
+
+NAME=`echo $SPEC | sed 's#\.spec##'`
+VERSION=`egrep '^Version:' $SPEC | awk '{print $2}'`
+
+print "SPEC = $SPEC"
+print "NAME = $NAME"
+
+GIT_OWNER=`egrep '%global\s*gh_owner' $SPEC | awk '{print $3}'`
+GIT_NAME=`egrep '%global\s*gh_project' $SPEC | awk '{print $3}'`
+GIT_COMMIT=`egrep '%global\s*gh_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
+ chmod 0644 $TAR_FILE
+popd
+
+rm -rf $TEMP_DIR