diff options
author | Remi Collet <remi@remirepo.net> | 2017-11-18 07:18:49 +0100 |
---|---|---|
committer | Remi Collet <remi@remirepo.net> | 2017-11-18 07:18:49 +0100 |
commit | 4ab88e2202d83bd3313a064a80656832fce4965b (patch) | |
tree | 27bd5a582a8fa1e0d0a0a7745e715992233378be | |
parent | 42c791f78efe0ab0a56c50ff9cde9b4a5a435e22 (diff) |
ensure current version is used during the test
use git snapshot as sources for tests
-rwxr-xr-x | php-phpdocumentor-reflection-common-get-source.sh | 71 | ||||
-rw-r--r-- | php-phpdocumentor-reflection-common.spec | 17 |
2 files changed, 84 insertions, 4 deletions
diff --git a/php-phpdocumentor-reflection-common-get-source.sh b/php-phpdocumentor-reflection-common-get-source.sh new file mode 100755 index 0000000..4ad1051 --- /dev/null +++ b/php-phpdocumentor-reflection-common-get-source.sh @@ -0,0 +1,71 @@ +#/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 '%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) +TAR_FILE=$PWD/${NAME}-${VERSION}-${GIT_COMMIT}.tar.gz +CMP_FILE=$PWD/composer.json + +pushd $TEMP_DIR + print "Cloning git repo..." + $GIT clone $GIT_REPO + + pushd $GIT_DIR + print "Checking out commit..." + $GIT checkout $GIT_COMMIT + cp composer.json $CMP_FILE + popd + + TAR_DIR=${GIT_NAME}-${GIT_COMMIT} + print "TAR_DIR = $TAR_DIR" + + mv $GIT_DIR $TAR_DIR + + 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 diff --git a/php-phpdocumentor-reflection-common.spec b/php-phpdocumentor-reflection-common.spec index 1ff5ee3..4264e4f 100644 --- a/php-phpdocumentor-reflection-common.spec +++ b/php-phpdocumentor-reflection-common.spec @@ -12,8 +12,8 @@ %global github_owner phpDocumentor %global github_name ReflectionCommon -%global github_version 1.0 -%global github_commit 144c307535e82c8fdcaacbcfc1d6d8eeb896687c +%global github_version 1.0.1 +%global github_commit 21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6 %global composer_vendor phpdocumentor %global composer_project reflection-common @@ -34,7 +34,10 @@ Summary: Common reflection classes used by phpdocumentor Group: Development/Libraries License: MIT URL: https://github.com/%{github_owner}/%{github_name} -Source0: %{url}/archive/%{github_commit}/%{name}-%{github_version}-%{github_commit}.tar.gz +# GitHub export does not include tests. +# Run php-phpdocumentor-type-resolver-get-source.sh to create full source. +Source0: %{name}-%{github_version}-%{github_commit}.tar.gz +Source1: %{name}-get-source.sh BuildArch: noarch # Tests @@ -88,7 +91,8 @@ BOOTSTRAP=%{buildroot}%{phpdir}/phpDocumentor/Reflection/autoload-common.php RETURN_CODE=0 for PHP_EXEC in php php56 php70 php71 php72; do if which $PHP_EXEC; then - $PHP_EXEC %{_bindir}/phpunit --verbose --bootstrap $BOOTSTRAP || RETURN_CODE=1 + $PHP_EXEC -d auto_prepend_file=$BOOTSTRAP \ + %{_bindir}/phpunit --verbose || RETURN_CODE=1 fi done exit $RETURN_CODE @@ -114,5 +118,10 @@ exit $RETURN_CODE %changelog +* Sat Nov 18 2017 Remi Collet <remi@remirepo.net> - 1.0.1-1 +- Update to 1.0.1 +- ensure current version is used during the test +- use git snapshot as sources for tests + * Sat Mar 11 2017 Shawn Iwinski <shawn@iwin.ski> - 1.0-1 - Initial package |