From d10917c0c6dac56a275eb0edccbe5962157c9d4b Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Fri, 28 Jun 2019 11:12:00 +0200 Subject: new package --- .gitignore | 8 +++ Makefile | 4 ++ composer.json | 27 ++++++++++ makesrc.sh | 28 +++++++++++ php-http-message-factory.spec | 111 ++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 178 insertions(+) create mode 100644 .gitignore create mode 100644 Makefile create mode 100644 composer.json create mode 100755 makesrc.sh create mode 100644 php-http-message-factory.spec 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..7c72feb --- /dev/null +++ b/composer.json @@ -0,0 +1,27 @@ +{ + "name": "php-http/message-factory", + "description": "Factory interfaces for PSR-7 HTTP Message", + "license": "MIT", + "keywords": ["http", "factory", "message", "stream", "uri"], + "homepage": "http://php-http.org", + "authors": [ + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com" + } + ], + "require": { + "php": ">=5.4", + "psr/http-message": "^1.0" + }, + "autoload": { + "psr-4": { + "Http\\Message\\": "src/" + } + }, + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + } +} diff --git a/makesrc.sh b/makesrc.sh new file mode 100755 index 0000000..87d223d --- /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 .git $PROJECT-$COMMIT + +echo "Cleaning..." +rm -rf $PROJECT-$COMMIT + +echo "Done." diff --git a/php-http-message-factory.spec b/php-http-message-factory.spec new file mode 100644 index 0000000..ee82917 --- /dev/null +++ b/php-http-message-factory.spec @@ -0,0 +1,111 @@ +# remirepo/fedora spec file for php-http-message-factory +# +# 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 a478cb11f66a6ac48d8954216cfed9aa06a501a1 +%global gh_short %(c=%{gh_commit}; echo ${c:0:7}) +%global gh_owner php-http +%global gh_project message-factory +# Packagist +%global pk_vendor %{gh_owner} +%global pk_project %{gh_project} +# Namespace +%global ns_vendor Http +%global ns_project Message + +# skip duplicated php prefix +Name: %{pk_vendor}-%{pk_project} +Version: 1.0.2 +Release: 1%{?dist} +Summary: Factory interfaces for PSR-7 HTTP Message + +License: MIT +URL: https://github.com/%{gh_owner}/%{gh_project} +# git snapshot for skip .gitattributes +Source0: %{name}-%{version}-%{gh_short}.tgz +Source1: makesrc.sh + +BuildArch: noarch +# For tests +BuildRequires: php(language) >= 5.4 +%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8 +BuildRequires: (php-composer(psr/http-message) >= 1.0 with php-composer(psr/http-message) < 2) +%else +BuildRequires: php-psr-http-message +%endif +BuildRequires: php-cli +BuildRequires: php-fedora-autoloader-devel + +# From composer.json, "require": { +# "php": ">=5.4", +# "psr/http-message": "^1.0" +Requires: php(language) >= 5.4 +%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8 +Requires: (php-composer(psr/http-message) >= 1.0 with php-composer(psr/http-message) < 2) +%else +Requires: php-psr-http-message +%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 +Factory interfaces for PSR-7 HTTP Message. + +Please refer to the specification for a description: +https://www.php-fig.org/psr/psr-7/ + + +Autoloader: %{_datadir}/php/%{ns_vendor}/%{ns_project}/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/%{pk_project}-autoload.php +\Fedora\Autoloader\Dependencies::required([ + '%{_datadir}/php/Psr/Http/Message/autoload.php', +]); +EOF + + +%install +mkdir -p %{buildroot}%{_datadir}/php/%{ns_vendor} +cp -rp src %{buildroot}%{_datadir}/php/%{ns_vendor}/%{ns_project} + + +%check +: Test autoloader +php -nr ' +require "%{buildroot}%{_datadir}/php/%{ns_vendor}/%{ns_project}/autoload.php"; +exit (interface_exists("%{ns_vendor}\\%{ns_project}\\RequestFactory") ? 0 : 1); +' + + +%files +%{!?_licensedir:%global license %%doc} +%license LICENSE +%doc *.md +%doc composer.json +%{_datadir}/php/%{ns_vendor} + + +%changelog +* Fri Jun 28 2019 Remi Collet - 1.0.2-1 +- Initial package, version 1.0.2 -- cgit