diff options
author | Remi Collet <remi@remirepo.net> | 2019-11-06 16:26:21 +0100 |
---|---|---|
committer | Remi Collet <remi@remirepo.net> | 2019-11-06 16:26:21 +0100 |
commit | 76df5518cbad29d6a87b2615753800689e27a7f7 (patch) | |
tree | d855000e8d6615868b90fd944a7b109cd00febc3 |
New package
-rw-r--r-- | .gitignore | 8 | ||||
-rw-r--r-- | Makefile | 4 | ||||
-rw-r--r-- | composer.json | 27 | ||||
-rw-r--r-- | php-psr-http-client.spec | 116 |
4 files changed, 155 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..78cb39b --- /dev/null +++ b/composer.json @@ -0,0 +1,27 @@ +{ + "name": "psr/http-client", + "description": "Common interface for HTTP clients", + "keywords": ["psr", "psr-18", "http", "http-client"], + "homepage": "https://github.com/php-fig/http-client", + "license": "MIT", + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "require": { + "php": "^7.0", + "psr/http-message": "^1.0" + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Client\\": "src/" + } + }, + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + } +} diff --git a/php-psr-http-client.spec b/php-psr-http-client.spec new file mode 100644 index 0000000..e7cc2e0 --- /dev/null +++ b/php-psr-http-client.spec @@ -0,0 +1,116 @@ +# remirepo/fedora spec file for php-psr-http-client +# +# Copyright (c) 2019 Remi Collet +# License: CC-BY-SA +# http://creativecommons.org/licenses/by-sa/4.0/ +# +# Please, preserve the changelog entries +# + +# Github +%global gh_commit 496a823ef742b632934724bf769560c2a5c7c44e +%global gh_short %(c=%{gh_commit}; echo ${c:0:7}) +%global gh_owner php-fig +%global gh_project http-client +# Packagist +%global pk_vendor psr +%global pk_project %{gh_project} +# Namespace +%global ns_vendor Psr +%global ns_project Http +%global ns_sub Client + +Name: php-%{pk_vendor}-%{pk_project} +Version: 1.0.0 +Release: 1%{?dist} +Summary: Common interface for HTTP clients + +License: MIT +URL: https://github.com/%{gh_owner}/%{gh_project} +Source0: %{url}/archive/%{gh_commit}/%{name}-%{version}-%{gh_commit}.tar.gz + +BuildArch: noarch +# For tests +BuildRequires: php(language) >= 7.0 +BuildRequires: php-cli +# remirepo:1 +%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8 +BuildRequires: (php-composer(%{pk_vendor}/http-message) >= 1.0 with php-composer(%{pk_vendor}/http-message) < 2) +# remirepo:4 +%else +BuildRequires: php-composer(%{pk_vendor}/http-message) < 2 +BuildRequires: php-composer(%{pk_vendor}/http-message) >= 1.0 +%endif +# Autoloader +BuildRequires: php-fedora-autoloader-devel + +# From composer.json, "require": { +# "php": "^7.0", +# "psr/http-message": "^1.0" +Requires: php(language) >= 7.0 +# remirepo:1 +%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8 +Requires: (php-composer(%{pk_vendor}/http-message) >= 1.0 with php-composer(%{pk_vendor}/http-message) < 2) +# remirepo:4 +%else +Requires: php-composer(%{pk_vendor}/http-message) < 2 +Requires: php-composer(%{pk_vendor}/http-message) >= 1.0 +%endif +# phpcompatinfo (computed from version 1.0.0) +# only core +# Autoloader +Requires: php-composer(fedora/autoloader) + +# Composer +Provides: php-composer(%{pk_vendor}/%{pk_project}) = %{version} + + +%description +This repository holds all the common code related to PSR-18 (HTTP Client). + +Please refer to the specification for a description: +https://www.php-fig.org/psr/psr-18/ + + +Autoloader: %{_datadir}/php/%{ns_vendor}/%{ns_project}/%{ns_sub}/autoload.php + + +%prep +%setup -qn %{gh_project}-%{gh_commit} + + +%build +: Generate autoloader +%{_bindir}/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', +]); +EOF + + +%install +mkdir -p %{buildroot}%{_datadir}/php/%{ns_vendor}/%{ns_project} +cp -rp src %{buildroot}%{_datadir}/php/%{ns_vendor}/%{ns_project}/%{ns_sub} + + +%check +: Test autoloader +php -nr ' +require "%{buildroot}%{_datadir}/php/%{ns_vendor}/%{ns_project}/%{ns_sub}/autoload.php"; +exit (interface_exists("%{ns_vendor}\\%{ns_project}\\%{ns_sub}\\ClientInterface") ? 0 : 1); +' + + +%files +# remirepo:1 +%{!?_licensedir:%global license %%doc} +%license LICENSE +%doc *.md +%doc composer.json +%{_datadir}/php/%{ns_vendor}/%{ns_project}/%{ns_sub} + + +%changelog +* Wed Nov 6 2019 Remi Collet <remi@remirepo.net> - 1.0.0-1 +- Initial package, version 1.0.0 |