diff options
-rw-r--r-- | .gitignore | 8 | ||||
-rw-r--r-- | Makefile | 4 | ||||
-rw-r--r-- | composer.json | 44 | ||||
-rw-r--r-- | php-symfony-contracts.spec | 154 |
4 files changed, 210 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..2f198a0 --- /dev/null +++ b/composer.json @@ -0,0 +1,44 @@ +{ + "name": "symfony/contracts", + "type": "library", + "description": "A set of abstractions extracted out of the Symfony components", + "keywords": ["abstractions", "contracts", "decoupling", "interfaces", "interoperability", "standards"], + "homepage": "https://symfony.com", + "license": "MIT", + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "require": { + "php": "^7.1.3" + }, + "require-dev": { + "psr/cache": "^1.0", + "psr/container": "^1.0" + }, + "suggest": { + "psr/cache": "When using the Cache contracts", + "psr/container": "When using the Service contracts", + "symfony/cache-contracts-implementation": "", + "symfony/service-contracts-implementation": "", + "symfony/translation-contracts-implementation": "" + }, + "autoload": { + "psr-4": { "Symfony\\Contracts\\": "" }, + "exclude-from-classmap": [ + "**/Tests/" + ] + }, + "minimum-stability": "dev", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + } +} diff --git a/php-symfony-contracts.spec b/php-symfony-contracts.spec new file mode 100644 index 0000000..1dcd78e --- /dev/null +++ b/php-symfony-contracts.spec @@ -0,0 +1,154 @@ +# remirepo/fedora spec file for php-symfony-contracts +# +# Copyright (c) 2019 Remi Collet +# License: CC-BY-SA +# http://creativecommons.org/licenses/by-sa/4.0/ +# +# Please, preserve the changelog entries +# +%global gh_commit 1aa7ab2429c3d594dd70689604b5cf7421254cdf +%global gh_short %(c=%{gh_commit}; echo ${c:0:7}) +%global gh_owner symfony +%global gh_project contracts +# Packagist +%global pk_vendor %{gh_owner} +%global pk_project %{gh_project} +# Namespace +%global ns_vendor Symfony +%global ns_project Contracts +%global php_home %{_datadir}/php +# Test +%global with_tests 0%{!?_without_tests:1} + +Name: php-%{pk_vendor}-%{pk_project} +Version: 1.0.2 +Release: 1%{?gh_date:.%{gh_date}git%{gh_short}}%{?dist} +Summary: A set of abstractions extracted out of the Symfony + +License: MIT +URL: https://github.com/%{gh_owner}/%{gh_project} +Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{name}-%{version}-%{?gh_short}.tar.gz + +BuildArch: noarch +%if %{with_tests} +# For tests +BuildRequires: php(language) >= 7.1.3 +BuildRequires: php-reflection +BuildRequires: php-pcre +BuildRequires: php-spl +BuildRequires: php-intl +# From composer.json, "require-dev": { +# "psr/cache": "^1.0", +# "psr/container": "^1.0" +# remirepo:1 +%if 0%{?fedora} >= 27 || 0%{?rhel} >=8 +BuildRequires: (php-composer(psr/cache) >= 1.0 with php-composer(psr/cache) < 2) +BuildRequires: (php-composer(psr/container) >= 1.0 with php-composer(psr/container) < 2) +# remirepo:4 +%else +BuildRequires: php-psr-cache +BuildRequires: php-psr-container +%endif +%global phpunit %{_bindir}/phpunit7 +BuildRequires: %{phpunit} +# Autoloader +BuildRequires: php-composer(fedora/autoloader) +%endif + +# From composer.json, "require": { +# "php": "^7.1.3" +Requires: php(language) >= 7.1.3 +# From composer.json, "suggest": { +# "psr/cache": "When using the Cache contracts", +# "psr/container": "When using the Service contracts", +# "symfony/cache-contracts-implementation": "", +# "symfony/service-contracts-implementation": "", +# "symfony/translation-contracts-implementation": "" +# remirepo:1 +%if 0%{?fedora} >= 27 || 0%{?rhel} >=8 +Recommends: (php-composer(psr/cache) >= 1.0 with php-composer(psr/cache) < 2) +Recommends: (php-composer(psr/container) >= 1.0 with php-composer(psr/container) < 2) +# remirepo:1 +%endif +# From phpcompatinfo report for version 1.0.2 +Requires: php-reflection +Requires: php-pcre +Requires: php-spl +Requires: php-intl +# Autoloader +Requires: php-composer(fedora/autoloader) + +Provides: php-composer(%{pk_vendor}/%{pk_project}) = %{version} + + +%description +A set of abstractions extracted out of the Symfony components. + +Can be used to build on semantics that the Symfony components +proved useful - and that already have battle tested implementations. + +Autoloader: %{php_home}/%{ns_vendor}/%{ns_project}/autoload.php + + +%prep +%setup -q -n %{gh_project}-%{gh_commit} + + +%build +: Create autoloader +cat <<'AUTOLOAD' | tee autoload.php +<?php +/* Autoloader for %{name} and its dependencies */ +require_once '%{php_home}/Fedora/Autoloader/autoload.php'; + +\Fedora\Autoloader\Autoload::addPsr4('%{ns_vendor}\\%{ns_project}\\', __DIR__); +\Fedora\Autoloader\Dependencies::optional([ + '%{php_home}/Psr/Cache/autoload.php', + '%{php_home}/Psr/Container/autoload.php', +]); +AUTOLOAD + + +%install +mkdir -p %{buildroot}%{php_home}/%{ns_vendor}/%{ns_project} +for i in autoload.php Cache Service Translation +do + cp -pr $i %{buildroot}%{php_home}/%{ns_vendor}/%{ns_project}/$i +done + + +%check +%if %{with_tests} +mkdir vendor +cat << 'EOF' | tee vendor/autoload.php +<?php +require_once '%{buildroot}%{php_home}/%{ns_vendor}/%{ns_project}/autoload.php'; +EOF + +ret=0 +for cmd in php php71 php72 php73; do + if which $cmd; then + $cmd %{phpunit} \ + --no-coverage \ + --verbose + fi +done +exit $ret +%else +: Test suite disabled +%endif + + +%files +# remirepo:1 +%{!?_licensedir:%global license %%doc} +%license LICENSE +%doc composer.json +%doc *.md +%dir %{php_home}/%{ns_vendor}/ + %{php_home}/%{ns_vendor}/%{ns_project} + + +%changelog +* Mon Jan 7 2019 Remi Collet <remi@remirepo.net> - 1.0.2-1 +- initial package, version 1.0.2 |