summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore8
-rw-r--r--Makefile4
-rw-r--r--composer.json51
-rwxr-xr-xmakesrc.sh28
-rw-r--r--php-nyholm-psr7.spec168
5 files changed, 259 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..fc9aa8c
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,8 @@
+clog
+package-*.xml
+*.tgz
+*.tar.gz
+*.tar.xz
+*.tar.xz.asc
+*.src.rpm
+*/*rpm
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..13af741
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,4 @@
+SRCDIR := $(shell pwd)
+NAME := $(shell basename $(SRCDIR))
+include ../../../common/Makefile
+
diff --git a/composer.json b/composer.json
new file mode 100644
index 0000000..569cf14
--- /dev/null
+++ b/composer.json
@@ -0,0 +1,51 @@
+{
+ "name": "nyholm/psr7",
+ "description": "A fast PHP7 implementation of PSR-7",
+ "license": "MIT",
+ "keywords": ["psr-7", "psr-17"],
+ "homepage": "http://tnyholm.se",
+ "authors": [
+ {
+ "name": "Tobias Nyholm",
+ "email": "tobias.nyholm@gmail.com"
+ },
+ {
+ "name": "Martijn van der Ven",
+ "email": "martijn@vanderven.se"
+ }
+ ],
+ "require": {
+ "php": "^7.1",
+ "psr/http-message": "^1.0",
+ "php-http/message-factory": "^1.0",
+ "psr/http-factory": "^1.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^7.5",
+ "php-http/psr7-integration-tests": "dev-master",
+ "http-interop/http-factory-tests": "dev-master"
+ },
+ "provide": {
+ "psr/http-message-implementation": "1.0",
+ "psr/http-factory-implementation": "1.0"
+ },
+ "autoload": {
+ "psr-4": {
+ "Nyholm\\Psr7\\": "src/"
+ }
+ },
+ "autoload-dev": {
+ "psr-4": {
+ "Tests\\Nyholm\\Psr7\\": "tests/"
+ }
+ },
+ "scripts": {
+ "test": "vendor/bin/phpunit",
+ "test-ci": "vendor/bin/phpunit --coverage-text --coverage-clover=build/coverage.xml"
+ },
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0-dev"
+ }
+ }
+}
diff --git a/makesrc.sh b/makesrc.sh
new file mode 100755
index 0000000..37cb6a2
--- /dev/null
+++ b/makesrc.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+NAME=$(basename $PWD)
+OWNER=$(sed -n '/^%global gh_owner/{s/.* //;p}' $NAME.spec)
+PROJECT=$(sed -n '/^%global gh_project/{s/.* //;p}' $NAME.spec)
+VERSION=$(sed -n '/^Version:/{s/.* //;p}' $NAME.spec)
+COMMIT=$(sed -n '/^%global gh_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-vcs $PROJECT-$COMMIT
+
+echo "Cleaning..."
+rm -rf $PROJECT-$COMMIT
+
+echo "Done."
diff --git a/php-nyholm-psr7.spec b/php-nyholm-psr7.spec
new file mode 100644
index 0000000..c2eb798
--- /dev/null
+++ b/php-nyholm-psr7.spec
@@ -0,0 +1,168 @@
+# remirepo/fedora spec file for php-nyholm-psr7
+#
+# Copyright (c) 2019 Remi Collet
+# License: CC-BY-SA
+# http://creativecommons.org/licenses/by-sa/4.0/
+#
+# Please, preserve the changelog entries
+#
+%global bootstrap 0
+# github
+%global gh_commit 701fe7ea8c12c07b985b156d589134d328160cf7
+%global gh_short %(c=%{gh_commit}; echo ${c:0:7})
+%global gh_owner Nyholm
+%global gh_project psr7
+# packagist
+%global pk_vendor nyholm
+%global pk_project %{gh_project}
+%global major %nil
+# namespace
+%global php_home %{_datadir}/php
+%global ns_vendor Nyholm
+%global ns_project Psr7
+%if %{bootstrap}
+%global with_tests 0%{?_with_tests:1}
+%else
+%global with_tests 0%{!?_without_tests:1}
+%endif
+
+# php-http/psr7-integration-tests
+%global psr7_integration_tests_commit c3bb79ca4a276df57364ff45bf2f619f769ded4a
+%global psr7_integration_tests_short %(c=%{psr7_integration_tests_commit}; echo ${c:0:7})
+# http-interop/http-factory-tests
+%global http_factory_tests_commit 92d8b91e7236957d7512ef93e8a237d241671ce7
+%global http_factory_tests_short %(c=%{http_factory_tests_commit}; echo ${c:0:7})
+
+Name: php-%{pk_vendor}-%{pk_project}%{major}
+Version: 1.1.0
+Release: 1%{?dist}
+Summary: A fast PHP7 implementation of PSR-7
+
+License: BSD
+URL: https://github.com/%{gh_owner}/%{gh_project}
+# git snapshot for skip .gitattributes
+Source0: %{name}-%{version}-%{gh_short}.tgz
+Source1: makesrc.sh
+# Only used for tests and no version released (dev-master required)
+Source2: https://github.com/php-http/psr7-integration-tests/archive/%{psr7_integration_tests_commit}/%{name}-integration-tests-%{psr7_integration_tests_short}.tar.gz
+Source3: https://github.com/http-interop/http-factory-tests/archive/%{http_factory_tests_commit}/%{name}-factory-tests-%{http_factory_tests_short}.tar.gz
+
+BuildArch: noarch
+BuildRequires: php(language) >= 7.1
+BuildRequires: php-pcre
+BuildRequires: php-spl
+%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8
+BuildRequires: (php-composer(psr/http-message) >= 1.0 with php-composer(psr/http-message) < 2)
+BuildRequires: (php-composer(php-http/message-factory) >= 1.0 with php-composer(php-http/message-factory) < 2)
+BuildRequires: (php-composer(psr/http-factory) >= 1.0 with php-composer(psr/http-factory) < 2)
+%else
+BuildRequires: php-psr-http-message
+BuildRequires: php-http-message-factory
+BuildRequires: php-psr-http-factory
+%endif
+# Autoloader
+BuildRequires: php-fedora-autoloader-devel >= 1.0.0
+%if %{with_tests}
+# from composer.json, "require-dev": {
+# "phpunit/phpunit": "^7.5",
+# "php-http/psr7-integration-tests": "dev-master",
+# "http-interop/http-factory-tests": "dev-master"
+BuildRequires: phpunit7 > 7.5
+%endif
+
+# from composer.json, "require": {
+# "php": "^7.1",
+# "psr/http-message": "^1.0",
+# "php-http/message-factory": "^1.0",
+# "psr/http-factory": "^1.0"
+Requires: php(language) >= 7.1
+%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8
+Requires: (php-composer(psr/http-message) >= 1.0 with php-composer(psr/http-message) < 2)
+Requires: (php-composer(php-http/message-factory) >= 1.0 with php-composer(php-http/message-factory) < 2)
+Requires: (php-composer(psr/http-factory) >= 1.0 with php-composer(psr/http-factory) < 2)
+%else
+Requires: php-psr-http-message
+Requires: php-http-message-factory
+Requires: php-psr-http-factory/usr/share/php/Psr/Http/Message/http-factory-autoload.php
+%endif
+# from phpcompatinfo report for version 1.1.0
+Requires: php-pcre
+Requires: php-spl
+# Autoloader
+Requires: php-composer(fedora/autoloader)
+
+Provides: php-composer(%{pk_vendor}/%{pk_project}) = %{version}
+Provides: php-composer(psr/http-message-implementation) = 1.0
+Provides: php-composer(psr/http-factory-implementation) = 1.0
+
+
+%description
+A super lightweight PSR-7 implementation. Very strict and very fast..
+
+Autoloader: %{php_home}/%{ns_vendor}/%{ns_project}%{major}/autoload.php
+
+
+%prep
+%setup -q -n %{gh_project}-%{gh_commit} -a2 -a3
+
+
+%build
+# Generate the Autoloader
+phpab --template fedora --output src/autoload.php src
+
+cat << 'EOF' | tee -a src/autoload.php
+\Fedora\Autoloader\Dependencies::required([
+ '%{_datadir}/php/Psr/Http/Message/autoload.php',
+ '%{_datadir}/php/Http/Message/autoload.php',
+ '%{_datadir}/php/Psr/Http/Message/http-factory-autoload.php',
+]);
+EOF
+
+# Generate test Autoloader
+phpab --template fedora --output test-autoload.php \
+ psr7-integration-tests-%{psr7_integration_tests_commit} \
+ http-factory-tests-%{http_factory_tests_commit}
+
+
+%install
+mkdir -p %{buildroot}%{php_home}/%{ns_vendor}
+cp -pr src %{buildroot}%{php_home}/%{ns_vendor}/%{ns_project}%{major}
+
+
+%check
+%if %{with_tests}
+mkdir vendor
+cat <<EOF | tee vendor/autoload.php
+<?php
+require_once '%{buildroot}%{php_home}/%{ns_vendor}/%{ns_project}%{major}/autoload.php';
+require_once dirname(__DIR__) . '/test-autoload.php';
+EOF
+
+: Run upstream test suite
+: Ignore online tests
+# TODO testCanDetachStream may fail on local build (extension conflicts ?)
+ret=0
+for cmd in php php71 php72 php73 php74; do
+ if which $cmd; then
+ $cmd %{_bindir}/phpunit7 \
+ --filter '^((?!(testIsNotSeekable|testIsNotWritable|testIsNotReadable|testRewindNotSeekable)).)*$' \
+ --verbose || ret=1
+ fi
+done
+exit $ret
+%else
+: bootstrap build with test suite disabled
+%endif
+
+
+%files
+%{!?_licensedir:%global license %%doc}
+%license LICENSE
+%doc *.md
+%doc composer.json
+%{php_home}/%{ns_vendor}
+
+
+%changelog
+* Fri Jun 28 2019 Remi Collet <remi@remirepo.net> - 1.1.0-1
+- initial package, version 1.1.0