From 897dfba9e83862f88615c629702dea7aa6aebb30 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Thu, 28 Jan 2021 10:58:37 +0100 Subject: new package --- .gitignore | 9 ++ Makefile | 4 + composer.json | 60 +++++++++++ makesrc.sh | 31 ++++++ php-friendsofphp-proxy-manager-lts.spec | 172 ++++++++++++++++++++++++++++++++ 5 files changed, 276 insertions(+) create mode 100644 .gitignore create mode 100644 Makefile create mode 100644 composer.json create mode 100755 makesrc.sh create mode 100644 php-friendsofphp-proxy-manager-lts.spec diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..01f0400 --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +clog +package-*.xml +*.tgz +*.tar.bz2 +*.tar.gz +*.tar.xz +*.tar.xz.asc +*.src.rpm +*/*rpm diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..91b0fd5 --- /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..055db65 --- /dev/null +++ b/composer.json @@ -0,0 +1,60 @@ +{ + "name": "friendsofphp/proxy-manager-lts", + "description": "Adding support for a wider range of PHP versions to ocramius/proxy-manager", + "type": "library", + "license": "MIT", + "homepage": "https://github.com/FriendsOfPHP/proxy-manager-lts", + "keywords": [ + "proxy", + "proxy pattern", + "service proxies", + "lazy loading", + "aop" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "homepage": "http://ocramius.github.io/" + }, + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + } + ], + "replace": { + "ocramius/proxy-manager": "^2.1" + }, + "require": { + "php": ">=7.1", + "laminas/laminas-code": "~3.4.1|^4.0", + "symfony/filesystem": "^4.4.17|^5.0" + }, + "conflict": { + "zendframework/zend-stdlib": "<3.2.1", + "laminas/laminas-stdlib": "<3.2.1" + }, + "require-dev": { + "ext-phar": "*", + "symfony/phpunit-bridge": "^5.2" + }, + "autoload": { + "psr-4": { + "ProxyManager\\": "src/ProxyManager" + } + }, + "autoload-dev": { + "psr-4": { + "ProxyManagerTest\\": "tests/ProxyManagerTest", + "ProxyManagerTestAsset\\": "tests/ProxyManagerTestAsset", + "Laminas\\Server\\": "tests/Stubbed/Laminas/Server" + } + }, + "minimum-stability": "dev", + "extra": { + "thanks": { + "name": "ocramius/proxy-manager", + "url": "https://github.com/Ocramius/ProxyManager" + } + } +} diff --git a/makesrc.sh b/makesrc.sh new file mode 100755 index 0000000..a80dcc8 --- /dev/null +++ b/makesrc.sh @@ -0,0 +1,31 @@ +#!/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} + +if [ -f $NAME-$VERSION-$SHORT.tgz ]; then + echo "$NAME-$VERSION-$SHORT.tgz exists" +else + 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 || exit 1 + cp composer.json ../composer.json + popd + + echo "Archiving..." + tar czf $NAME-$VERSION-$SHORT.tgz --exclude-vcs $PROJECT-$COMMIT + + echo "Cleaning..." + rm -rf $PROJECT-$COMMIT +fi +echo "Done." diff --git a/php-friendsofphp-proxy-manager-lts.spec b/php-friendsofphp-proxy-manager-lts.spec new file mode 100644 index 0000000..b59b6fc --- /dev/null +++ b/php-friendsofphp-proxy-manager-lts.spec @@ -0,0 +1,172 @@ +# remirepo/fedora spec file for php-friendsofphp-proxy-manager-lts +# +# Copyright (c) 2021 Remi Collet +# License: CC-BY-SA +# http://creativecommons.org/licenses/by-sa/4.0/ +# +# Please, preserve the changelog entries +# + +%global github_owner FriendsOfPHP +%global github_name proxy-manager-lts +%global github_version 1.0.3 +%global github_commit 121af47c9aee9c03031bdeca3fac0540f59aa5c3 +%global github_short %(c=%{github_commit}; echo ${c:0:7}) +%global major %nil + +%global ns_project ProxyManager + +%global composer_vendor friendsofphp +%global composer_project proxy-manager-lts + +# Build using "--without tests" to disable tests +%bcond_without tests + +%{!?phpdir: %global phpdir %{_datadir}/php} + +Name: php-%{composer_vendor}-%{composer_project}%{major} +Version: %{github_version} +Release: 1%{?github_release}%{?dist} +Summary: A library for validating emails + +License: MIT +URL: https://github.com/%{github_owner}/%{github_name} +Source0: %{name}-%{github_version}-%{github_short}.tgz +Source1: makesrc.sh + +BuildArch: noarch +# As we use phpunit9 +BuildRequires: php(language) >= 7.3 +%if %{with tests} +BuildRequires: php-reflection +BuildRequires: php-pcre +BuildRequires: php-spl +# remirepo:1 +%if 0%{?fedora} >= 32 || 0%{?rhel} >= 9 +BuildRequires:(php-composer(laminas/laminas-code) >= 4 with php-composer(laminas/laminas-code) < 5) +BuildRequires:(php-composer(symfony/filesystem) >= 4.4.17 with php-composer(symfony/filesystem) < 6) +## composer.json (require-dev) +# "ext-phar": "*", +# "symfony/phpunit-bridge": "^5.2" +# remirepo:4 +%else +BuildRequires: php-laminas-code >= 3.4.1 +BuildRequires: php-symfony4-filesystem >= 4.4.17 +%endif +%global phpunit %{_bindir}/phpunit9 +BuildRequires: %{phpunit} +%endif +## Autoloader +BuildRequires: php-fedora-autoloader-devel + +# composer.json +# "php": ">=7.1", +# "laminas/laminas-code": "~3.4.1|^4.0", +# "symfony/filesystem": "^4.4.17|^5.0" +Requires: php(language) >= 7.1 +# remirepo:1 +%if 0%{?fedora} >= 32 || 0%{?rhel} >= 9 +# prefer v4 required for PHP 8, better with PHP 7.4 +Requires: (php-composer(laminas/laminas-code) >= 4.0 with php-composer(laminas/laminas-code) < 5) +Requires: (php-composer(symfony/filesystem) >= 4.4.17 with php-composer(symfony/filesystem) < 6) +# remirepo:4 +%else +Requires: php-laminas-code >= 3.4.1 +Requires: php-symfony4-filesystem >= 4.4.17 +%endif +# phpcompatinfo (computed from version 1.0.3) +Requires: php-reflection +Requires: php-pcre +Requires: php-spl +# Autoloader +Requires: php-composer(fedora/autoloader) + +# Composer +Provides: php-composer(%{composer_vendor}/%{composer_project}) = %{version} + +%description +%{summary}. + +Autoloader: %{phpdir}/%{github_owner}/%{ns_project}%{major}/autoload.php + + +%prep +%setup -qn %{github_name}-%{github_commit} + + +%build +: Create autoloader +phpab --template fedora \ + --output src/autoload.php \ + src + +cat <<'AUTOLOAD' | tee -a src/autoload.php + +if (PHP_VERSION_ID < 70400) { + $code = '%{phpdir}/Laminas/Code/autoload.php'; +} else if (PHP_VERSION_ID < 80000) { + $code = [ + '%{phpdir}/Laminas/Code4/autoload.php', + '%{phpdir}/Laminas/Code/autoload.php', + ]; +} else { + $code = '%{phpdir}/Laminas/Code4/autoload.php'; +} +\Fedora\Autoloader\Dependencies::required([ + $code, + [ + '%{phpdir}/Symfony5/Component/Filesystem/autoload.php', + '%{phpdir}/Symfony4/Component/Filesystem/autoload.php', + ], +]); +AUTOLOAD + + +%install +# fake "vendor" directory to avoid conflict with real ocramius library +mkdir -p %{buildroot}%{phpdir}/%{github_owner}/ +cp -rp src %{buildroot}%{phpdir}/%{github_owner}/%{ns_project}%{major} + + +%check +%if %{with tests} +mkdir vendor +cat << 'EOF' | tee vendor/autoload.php + - 1.0.3-1 +- Initial package -- cgit