diff options
-rw-r--r-- | composer.json | 9 | ||||
-rwxr-xr-x | php-guzzlehttp-promises-get-source.sh | 71 | ||||
-rw-r--r-- | php-guzzlehttp-promises.spec | 43 |
3 files changed, 100 insertions, 23 deletions
diff --git a/composer.json b/composer.json index f13844b..ec41a61 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,5 @@ { "name": "guzzlehttp/promises", - "type": "library", "description": "Guzzle promises library", "keywords": ["promise"], "license": "MIT", @@ -15,7 +14,7 @@ "php": ">=5.5.0" }, "require-dev": { - "phpunit/phpunit": "~4.0" + "phpunit/phpunit": "^4.0" }, "autoload": { "psr-4": { @@ -23,9 +22,13 @@ }, "files": ["src/functions_include.php"] }, + "scripts": { + "test": "vendor/bin/phpunit", + "test-ci": "vendor/bin/phpunit --coverage-text" + }, "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-master": "1.4-dev" } } } diff --git a/php-guzzlehttp-promises-get-source.sh b/php-guzzlehttp-promises-get-source.sh new file mode 100755 index 0000000..4ad1051 --- /dev/null +++ b/php-guzzlehttp-promises-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-guzzlehttp-promises.spec b/php-guzzlehttp-promises.spec index b6fd2ea..bbb6f3f 100644 --- a/php-guzzlehttp-promises.spec +++ b/php-guzzlehttp-promises.spec @@ -12,8 +12,8 @@ %global github_owner guzzle %global github_name promises -%global github_version 1.3.0 -%global github_commit 2693c101803ca78b27972d84081d027fca790a1e +%global github_version 1.3.1 +%global github_commit a59da6cf61d80060647ff4d3eb2c03a2bc694646 %global composer_vendor guzzlehttp %global composer_project promises @@ -34,7 +34,11 @@ Summary: Guzzle promises library 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-guzzlehttp-promises.sh to create full source. +Source0: %{name}-%{github_version}-%{github_commit}.tar.gz +Source1: %{name}-get-source.sh BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch @@ -43,7 +47,7 @@ BuildArch: noarch ## composer.json BuildRequires: php(language) >= %{php_min_ver} BuildRequires: php-composer(phpunit/phpunit) -## phpcompatinfo (computed from version 1.3.0) +## phpcompatinfo (computed from version 1.3.1) BuildRequires: php-json BuildRequires: php-reflection BuildRequires: php-spl @@ -53,7 +57,7 @@ BuildRequires: php-composer(fedora/autoloader) # composer.json Requires: php(language) >= %{php_min_ver} -# phpcompatinfo (computed from version 1.3.0) +# phpcompatinfo (computed from version 1.3.1) Requires: php-json Requires: php-spl # Autoloader @@ -106,22 +110,17 @@ cp -rp src/* %{buildroot}%{phpdir}/GuzzleHttp/Promise/ sed "s#require.*autoload.*#require '%{buildroot}%{phpdir}/GuzzleHttp/Promise/autoload.php';#" \ -i tests/bootstrap.php -# remirepo:11 -run=0 -ret=0 -if which php56; then - php56 %{_bindir}/phpunit || ret=1 - run=1 -fi -if which php71; then - php71 %{_bindir}/phpunit || ret=1 - run=1 -fi -if [ $run -eq 0 ]; then +: Upstream tests %{_bindir}/phpunit --verbose -# remirepo:2 -fi -exit $ret + +: Upstream tests with SCLs if available +SCL_RETURN_CODE=0 +for SCL in php56 php70 php71; do + if which $SCL; then + $SCL %{_bindir}/phpunit || SCL_RETURN_CODE=1 + fi +done +exit $SCL_RETURN_CODE %else : Tests skipped %endif @@ -142,6 +141,10 @@ rm -rf %{buildroot} %changelog +* Wed Dec 07 2016 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.3.1-1 +- Updated to 1.3.1 (RHBZ #1406764) +- Run upstream tests with SCLs if they are available + * Wed Dec 07 2016 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.3.0-1 - Updated to 1.3.0 (RHBZ #1396687) - Change autoloader from php-composer(symfony/class-loader) to |