From a33673e63e7e85740df0b340eafb96c8682a084a Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Mon, 25 Sep 2017 07:35:18 +0200 Subject: backport stuff --- .gitignore | 8 +++++ Makefile | 4 +++ composer.json | 66 ++++++++++++++++++++++++++++++++++++++++ php-jms-serializer-get-source.sh | 4 ++- php-jms-serializer.spec | 20 +++++++++--- 5 files changed, 97 insertions(+), 5 deletions(-) create mode 100644 .gitignore create mode 100644 Makefile create mode 100644 composer.json 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..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..46cee1c --- /dev/null +++ b/composer.json @@ -0,0 +1,66 @@ +{ + "name": "jms/serializer", + "type": "library", + "description": "Library for (de-)serializing data of any complexity; supports XML, JSON, and YAML.", + "keywords": ["serialization", "deserialization", "json", "jaxb", "xml"], + "homepage": "http://jmsyst.com/libs/serializer", + "license": "Apache-2.0", + "authors": [ + { + "name": "Johannes M. Schmitt", + "email": "schmittjoh@gmail.com" + }, + { + "name": "Asmir Mustafic", + "email": "goetas@gmail.com" + } + ], + "require": { + "php": ">=5.5.0", + "jms/metadata": "~1.1", + "jms/parser-lib": "1.*", + "phpoption/phpoption": "^1.1", + "phpcollection/phpcollection": "~0.1", + "doctrine/annotations": "^1.0", + "doctrine/instantiator": "^1.0.3" + }, + "conflict": { + "jms/serializer-bundle": "<1.2.1", + "twig/twig": "<1.12" + }, + "suggest": { + "symfony/yaml": "Required if you'd like to serialize data to YAML format.", + "doctrine/collections": "Required if you like to use doctrine collection types as ArrayCollection.", + "doctrine/cache": "Required if you like to use cache functionality." + }, + "require-dev": { + "ext-pdo_sqlite": "*", + "twig/twig": "~1.12|~2.0", + "doctrine/orm": "~2.1", + "jackalope/jackalope-doctrine-dbal": "^1.1.5", + "doctrine/phpcr-odm": "^1.3|^2.0", + "propel/propel1": "~1.7", + "symfony/yaml": "^2.1|^3.0", + "symfony/translation": "^2.1|^3.0", + "symfony/validator": "^2.2|^3.0", + "symfony/form": "~2.1|^3.0", + "symfony/filesystem": "^2.1", + "symfony/expression-language": "^2.6|^3.0", + "phpunit/phpunit": "^4.8|^5.0" + }, + "autoload": { + "psr-0": { + "JMS\\Serializer": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "JMS\\Serializer\\Tests\\": "tests/" + } + }, + "extra": { + "branch-alias": { + "dev-master": "1.8-dev" + } + } +} diff --git a/php-jms-serializer-get-source.sh b/php-jms-serializer-get-source.sh index dcaf2d9..be03311 100755 --- a/php-jms-serializer-get-source.sh +++ b/php-jms-serializer-get-source.sh @@ -43,6 +43,8 @@ print "GIT_REPO = $GIT_REPO" print "GIT_DIR = $GIT_DIR" TEMP_DIR=$(mktemp --dir) +TAR_FILE=$PWD/${NAME}-${VERSION}-${GIT_COMMIT}.tar.gz +CMP_FILE=$PWD/composer.json pushd $TEMP_DIR print "Cloning git repo..." @@ -54,6 +56,7 @@ pushd $TEMP_DIR print "Removing non-allowable licened content..." rm -rf doc + cp composer.json $CMP_FILE popd TAR_DIR=${GIT_NAME}-${GIT_COMMIT} @@ -61,7 +64,6 @@ pushd $TEMP_DIR mv $GIT_DIR $TAR_DIR - TAR_FILE=`$RPM --eval='%{_sourcedir}'`/${NAME}-${VERSION}-${GIT_COMMIT}.tar.gz print "TAR_FILE = $TAR_FILE" [ -e $TAR_FILE ] && rm -f $TAR_FILE diff --git a/php-jms-serializer.spec b/php-jms-serializer.spec index 79eb595..3923771 100644 --- a/php-jms-serializer.spec +++ b/php-jms-serializer.spec @@ -1,3 +1,4 @@ +# remirepo spec file for php-jms-serializer, from # # Fedora spec file for php-jms-serializer # @@ -58,7 +59,11 @@ # "twig/twig": "~1.12|~2.0" # NOTE: Min version not 1.12 because autoloader required %global twig_min_ver 1.18.2 +%if 0%{?fedora} >= 25 %global twig_max_ver 3.0 +%else +%global twig_max_ver 2.0 +%endif # Build using "--without tests" to disable tests %global with_tests 0%{!?_without_tests:1} @@ -153,10 +158,12 @@ Requires: php-spl # Autoloader Requires: php-composer(fedora/autoloader) +%if 0%{?fedora} # Weak dependencies Suggests: php-composer(symfony/yaml) Suggests: php-composer(doctrine/collections) Suggests: php-composer(cache) +%endif # Composer Provides: php-composer(%{composer_vendor}/%{composer_project}) = %{version} @@ -233,6 +240,14 @@ require '%{buildroot}%{phpdir}/JMS/Serializer/autoload.php'; \Fedora\Autoloader\Autoload::addPsr4('JMS\\Serializer\\Tests\\', __DIR__.'/tests'); +if (PHP_VERSION_ID < 70000) { + $twig = '%{phpdir}/Twig/autoload.php'; +} else { + $twig = [ + '%{phpdir}/Twig2/autoload.php', + '%{phpdir}/Twig/autoload.php', + ]; +} \Fedora\Autoloader\Dependencies::required([ '%{phpdir}/Doctrine/ORM/autoload.php', '%{phpdir}/Symfony/Component/ExpressionLanguage/autoload.php', @@ -240,10 +255,7 @@ require '%{buildroot}%{phpdir}/JMS/Serializer/autoload.php'; '%{phpdir}/Symfony/Component/Form/autoload.php', '%{phpdir}/Symfony/Component/Translation/autoload.php', '%{phpdir}/Symfony/Component/Validator/autoload.php', - [ - '%{phpdir}/Twig2/autoload.php', - '%{phpdir}/Twig/autoload.php', - ], + $twig, ]); use Doctrine\Common\Annotations\AnnotationRegistry; -- cgit