diff options
-rw-r--r-- | .gitignore | 7 | ||||
-rw-r--r-- | composer.json | 9 | ||||
l--------- | makesrc.sh | 1 | ||||
-rwxr-xr-x | php-clue-stream-filter-get-source.sh | 74 | ||||
-rw-r--r-- | php-clue-stream-filter.spec | 55 |
5 files changed, 126 insertions, 20 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1ab5c4f --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +package-*.xml +*.tgz +*.tar.gz +*.tar.xz +*.tar.xz.asc +*.src.rpm +*/*rpm diff --git a/composer.json b/composer.json index f871053..797fb53 100644 --- a/composer.json +++ b/composer.json @@ -7,17 +7,20 @@ "authors": [ { "name": "Christian Lück", - "email": "christian@lueck.tv" + "email": "christian@clue.engineering" } ], "require": { "php": ">=5.3" }, "require-dev": { - "phpunit/phpunit": "^5.0 || ^4.8" + "phpunit/phpunit": "^9.3 || ^5.7 || ^4.8.36" }, "autoload": { "psr-4": { "Clue\\StreamFilter\\": "src/" }, - "files": [ "src/functions.php" ] + "files": [ "src/functions_include.php" ] + }, + "autoload-dev": { + "psr-4": { "Clue\\Tests\\StreamFilter\\": "tests/" } } } diff --git a/makesrc.sh b/makesrc.sh new file mode 120000 index 0000000..e89ecd9 --- /dev/null +++ b/makesrc.sh @@ -0,0 +1 @@ +php-clue-stream-filter-get-source.sh
\ No newline at end of file diff --git a/php-clue-stream-filter-get-source.sh b/php-clue-stream-filter-get-source.sh new file mode 100755 index 0000000..8b02c4f --- /dev/null +++ b/php-clue-stream-filter-get-source.sh @@ -0,0 +1,74 @@ +#/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 + +SPEC_DIR=`pwd` + +print "SPEC_DIR = $SPEC_DIR" + +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 + cp composer.json ${SPEC_DIR}/ + popd + + TAR_DIR=${GIT_NAME}-${GIT_COMMIT} + print "TAR_DIR = $TAR_DIR" + + mv $GIT_DIR $TAR_DIR + + TAR_FILE=${SPEC_DIR}/${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 diff --git a/php-clue-stream-filter.spec b/php-clue-stream-filter.spec index bb6247c..087ee5a 100644 --- a/php-clue-stream-filter.spec +++ b/php-clue-stream-filter.spec @@ -2,7 +2,7 @@ # # Fedora spec file for php-clue-stream-filter # -# Copyright (c) 2017 Shawn Iwinski <shawn@iwin.ski> +# Copyright (c) 2017-2022 Shawn Iwinski <shawn@iwin.ski> # # License: MIT # http://opensource.org/licenses/MIT @@ -12,8 +12,8 @@ %global github_owner clue %global github_name php-stream-filter -%global github_version 1.4.0 -%global github_commit d80fdee9b3a7e0d16fc330a22f41f3ad0eeb09d0 +%global github_version 1.6.0 +%global github_commit d6169430c7731d8509da7aecd0af756a5747b78e %global composer_vendor clue %global composer_project stream-filter @@ -22,7 +22,7 @@ %global php_min_ver 5.3 # Build using "--without tests" to disable tests -%global with_tests 0%{!?_without_tests:1} +%bcond_without tests %{!?phpdir: %global phpdir %{_datadir}/php} @@ -31,28 +31,31 @@ Version: %{github_version} Release: 1%{?github_release}%{?dist} Summary: A simple and modern approach to stream filtering in PHP -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-clue-stream-filter-get-source.sh to create full source +Source0: %{name}-%{github_version}-%{github_commit}.tar.gz +Source1: %{name}-get-source.sh BuildArch: noarch # Tests -%if %{with_tests} +%if %{with tests} ## composer.json BuildRequires: php(language) >= %{php_min_ver} -BuildRequires: php-composer(phpunit/phpunit) -## phpcompatinfo (computed from version 1.4.0) +%global phpunit %{_bindir}/phpunit9 +BuildRequires: phpunit9 >= 9.3 +## phpcompatinfo (computed from version 1.5.0) BuildRequires: php-reflection BuildRequires: php-spl -BuildRequires: php-zlib ## Autoloader BuildRequires: php-composer(fedora/autoloader) %endif # composer.json Requires: php(language) >= %{php_min_ver} -# phpcompatinfo (computed from version 1.4.0) +# phpcompatinfo (computed from version 1.5.0) Requires: php-reflection Requires: php-spl # Autoloader @@ -84,7 +87,7 @@ require_once '%{phpdir}/Fedora/Autoloader/autoload.php'; \Fedora\Autoloader\Autoload::addPsr4('Clue\\StreamFilter\\', __DIR__); \Fedora\Autoloader\Dependencies::required(array( - __DIR__.'/functions.php', + __DIR__.'/functions_include.php', )); AUTOLOAD @@ -95,13 +98,21 @@ cp -rp src %{buildroot}%{phpdir}/Clue/StreamFilter %check -%if %{with_tests} +%if %{with tests} +: Mock Composer autoloader +mkdir vendor +cat <<'AUTOLOAD' | tee vendor/autoload.php +<?php +require_once '%{buildroot}%{phpdir}/Clue/StreamFilter/autoload.php'; +\Fedora\Autoloader\Autoload::addPsr4('Clue\\Tests\\StreamFilter\\', dirname(__DIR__).'/tests'); +AUTOLOAD + : Upstream tests RETURN_CODE=0 -for PHP_EXEC in php %{?rhel:php54 php55} php56 php70 php71 php72; do - if [ "php" == "$PHP_EXEC" ] || which $PHP_EXEC; then - $PHP_EXEC %{_bindir}/phpunit --verbose \ - --bootstrap %{buildroot}%{phpdir}/Clue/StreamFilter/autoload.php \ +for CMDARG in "php %{phpunit}" php74 php80 php81; do + if which $CMDARG; then + set $CMDARG + $1 ${2:-%{_bindir}/phpunit9} --verbose \ || RETURN_CODE=1 fi done @@ -121,6 +132,16 @@ exit $RETURN_CODE %changelog +* Tue Feb 22 2022 Remi Collet <remi@remirepo.net> - 1.6.0-1 +- update to 1.6.0 + +* Tue Nov 3 2020 Remi Collet <remi@remirepo.net> - 1.5.0-1 +- update to 1.5.0 +- switch to phpunit9 + +* Fri May 10 2019 Shawn Iwinski <shawn@iwin.ski> - 1.4.1-1 +- Update to 1.4.1 (RHBZ #1698047) + * Thu Aug 31 2017 Shawn Iwinski <shawn@iwin.ski> - 1.4.0-1 - Update to 1.4.0 (RHBZ #1482951) - Merge default and SCL tests (normailzed to what other specs use) |