From d6815ecbc230d89f728717b102e67008e9dd15fd Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Sun, 5 Mar 2017 18:57:19 +0100 Subject: php-zendframework-zend-diactoros: sync (some) changes from Fedora --- makesrc.sh | 28 ---------- php-zendframework-zend-diactoros-get-source.sh | 71 ++++++++++++++++++++++++++ php-zendframework-zend-diactoros.spec | 47 +++++++++-------- 3 files changed, 94 insertions(+), 52 deletions(-) delete mode 100755 makesrc.sh create mode 100755 php-zendframework-zend-diactoros-get-source.sh diff --git a/makesrc.sh b/makesrc.sh deleted file mode 100755 index ab1375c..0000000 --- a/makesrc.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash - -NAME=$(basename $PWD) -OWNER=$(sed -n '/^%global github_owner/{s/.* //;p}' $NAME.spec) -PROJECT=$(sed -n '/^%global github_name/{s/.* //;p}' $NAME.spec) -VERSION=$(sed -n '/^%global github_version/{s/.* //;p}' $NAME.spec) -COMMIT=$(sed -n '/^%global github_commit/{s/.* //;p}' $NAME.spec) -SHORT=${COMMIT:0:7} - -echo -e "\nCreate git snapshot\nName=$NAME, Owner=$OWNER, Project=$PROJECT, Version=$VERSION\n" - -echo "Cloning..." -rm -rf $PROJECT-$COMMIT -git clone https://github.com/$OWNER/$PROJECT.git $PROJECT-$COMMIT - -echo "Getting commit..." -pushd $PROJECT-$COMMIT -git checkout $COMMIT -cp composer.json ../composer.json -popd - -echo "Archiving..." -tar czf $NAME-$VERSION-$SHORT.tgz --exclude .git $PROJECT-$COMMIT - -echo "Cleaning..." -rm -rf $PROJECT-$COMMIT - -echo "Done." diff --git a/php-zendframework-zend-diactoros-get-source.sh b/php-zendframework-zend-diactoros-get-source.sh new file mode 100755 index 0000000..4ad1051 --- /dev/null +++ b/php-zendframework-zend-diactoros-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-zendframework-zend-diactoros.spec b/php-zendframework-zend-diactoros.spec index 4c25ba6..8c38ad9 100644 --- a/php-zendframework-zend-diactoros.spec +++ b/php-zendframework-zend-diactoros.spec @@ -14,7 +14,6 @@ %global github_name zend-diactoros %global github_version 1.3.10 %global github_commit 83e8d98b9915de76c659ce27d683c02a0f99fa90 -%global github_short %(c=%{github_commit}; echo ${c:0:7}) %global composer_vendor zendframework %global composer_project zend-diactoros @@ -41,8 +40,8 @@ URL: https://zendframework.github.io/%{gh_project}/ # GitHub export does not include tests. # Run php-zendframework-zend-diactoros-get-source.sh to create full source. -Source0: %{name}-%{github_version}-%{github_short}.tgz -Source1: makesrc.sh +Source0: %{name}-%{github_version}-%{github_commit}.tar.gz +Source1: %{name}-get-source.sh BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch @@ -51,8 +50,9 @@ BuildArch: noarch ## composer.json BuildRequires: php(language) >= %{php_min_ver} BuildRequires: php-composer(phpunit/phpunit) +BuildRequires: php-composer(psr/http-message) < %{psr_http_message_max_ver} BuildRequires: php-composer(psr/http-message) >= %{psr_http_message_min_ver} -## phpcompatinfo (computed from version 1.3.7) +## phpcompatinfo (computed from version 1.3.10) ### NOTE: curl, gd, gmp, and shmop are all optional for ### ZendTest\Diactoros\StreamTest::getResourceFor67() ### (test/StreamTest.php) but the first one found wins @@ -67,10 +67,10 @@ BuildRequires: php-composer(fedora/autoloader) %endif # composer.json -Requires: php(language) >= %{php_min_ver} -Requires: php-composer(psr/http-message) >= %{psr_http_message_min_ver} +Requires: php(language) >= %{php_min_ver} Requires: php-composer(psr/http-message) < %{psr_http_message_max_ver} -# phpcompatinfo (computed from version 1.3.7) +Requires: php-composer(psr/http-message) >= %{psr_http_message_min_ver} +# phpcompatinfo (computed from version 1.3.10) Requires: php-json Requires: php-pcre Requires: php-spl @@ -79,7 +79,7 @@ Requires: php-composer(fedora/autoloader) # Composer Provides: php-composer(%{composer_vendor}/%{composer_project}) = %{version} -Provides: php-composer(psr/http-message-implementation) = 1.0.0 +Provides: php-composer(psr/http-message-implementation) = 1.0.0 %description A PHP package containing implementations of the accepted PSR-7 HTTP message @@ -139,22 +139,17 @@ require_once '%{buildroot}%{phpdir}/Zend/Diactoros/autoload.php'; )); BOOTSTRAP -# remirepo:11 -run=0 -ret=0 -if which php56; then - php56 %{_bindir}/phpunit --bootstrap ./bootstrap.php || ret=1 - run=1 -fi -if which php71; then - php71 %{_bindir}/phpunit --bootstrap ./bootstrap.php || ret=1 - run=1 -fi -if [ $run -eq 0 ]; then -%{_bindir}/phpunit --verbose --bootstrap ./bootstrap.php -# remirepo:2 -fi -exit $ret +: Upstream tests +%{_bindir}/phpunit --verbose --bootstrap bootstrap.php + +: Upstream tests with SCLs if available +SCL_RETURN_CODE=0 +for SCL in %{?rhel:php55} php56 php70 php71; do + if which $SCL; then + $SCL %{_bindir}/phpunit --verbose --bootstrap bootstrap.php || SCL_RETURN_CODE=1 + fi +done +exit $SCL_RETURN_CODE %else : Tests skipped %endif @@ -175,6 +170,10 @@ rm -rf %{buildroot} %changelog +* Sun Mar 05 2017 Shawn Iwinski - 1.3.10-1 +- Updated to 1.3.10 (RHBZ #1411062) +- Test with SCLs if available + * Mon Jan 23 2017 Remi Collet - 1.3.10-1 - update to 1.3.10 -- cgit