From 2e4961b1e9735252ea690849ca8af50b5b26c21e Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Thu, 1 Aug 2019 08:20:30 +0200 Subject: - update to 1.1.0 - raise dependency on PHP 7.2 - sources from git snapshot - run upstream test suite during build - use classmap autoloader --- composer.json | 41 ++++++++++++++++++++++++ makesrc.sh | 28 ++++++++++++++++ php-doctrine-lexer.spec | 85 ++++++++++++++++++++++++++++++++++++------------- 3 files changed, 132 insertions(+), 22 deletions(-) create mode 100644 composer.json create mode 100755 makesrc.sh diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..4e82741 --- /dev/null +++ b/composer.json @@ -0,0 +1,41 @@ +{ + "name": "doctrine/lexer", + "type": "library", + "description": "PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.", + "keywords": [ + "php", + "parser", + "lexer", + "annotations", + "docblock" + ], + "homepage": "https://www.doctrine-project.org/projects/lexer.html", + "license": "MIT", + "authors": [ + {"name": "Guilherme Blanco", "email": "guilhermeblanco@gmail.com"}, + {"name": "Roman Borschel", "email": "roman@code-factory.org"}, + {"name": "Johannes Schmitt", "email": "schmittjoh@gmail.com"} + ], + "require": { + "php": "^7.2" + }, + "require-dev": { + "doctrine/coding-standard": "^6.0", + "phpstan/phpstan": "^0.11.8", + "phpunit/phpunit": "^8.2" + }, + "autoload": { + "psr-4": { "Doctrine\\Common\\Lexer\\": "lib/Doctrine/Common/Lexer" } + }, + "autoload-dev": { + "psr-4": { "Doctrine\\Tests\\": "tests/Doctrine" } + }, + "extra": { + "branch-alias": { + "dev-master": "1.1.x-dev" + } + }, + "config": { + "sort-packages": true + } +} diff --git a/makesrc.sh b/makesrc.sh new file mode 100755 index 0000000..97be9f6 --- /dev/null +++ b/makesrc.sh @@ -0,0 +1,28 @@ +#!/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} + +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-vcs $PROJECT-$COMMIT + +echo "Cleaning..." +rm -rf $PROJECT-$COMMIT + +echo "Done." diff --git a/php-doctrine-lexer.spec b/php-doctrine-lexer.spec index 23f0cb8..1bc482f 100644 --- a/php-doctrine-lexer.spec +++ b/php-doctrine-lexer.spec @@ -9,35 +9,49 @@ # # Please preserve changelog entries # - +# Github %global github_owner doctrine %global github_name lexer -%global github_version 1.0.2 -%global github_commit 1febd6c3ef84253d7c815bed85fc622ad207a9f8 - +%global github_version 1.1.0 +%global github_commit e17f069ede36f7534b95adec71910ed1b49c74ea +%global github_short %(c=%{github_commit}; echo ${c:0:7}) +# Namespace +%global ns_vendor Doctrine +%global ns_project Common +%global ns_subproj Lexer +# Packagist %global composer_vendor doctrine %global composer_project lexer -# "php": ">=5.3.2" -%global php_min_ver 5.3.2 +# "php": ">=7.2" +%global php_min_ver 7.2 %{!?phpdir: %global phpdir %{_datadir}/php} +%global with_tests 0%{!?_without_tests:1} Name: php-%{composer_vendor}-%{composer_project} Version: %{github_version} Release: 1%{?github_release}%{?dist} Summary: Base library for a lexer that can be used in top-down, recursive descent parsers -Group: Development/Libraries License: MIT URL: https://github.com/%{github_owner}/%{github_name} -Source0: %{url}/archive/%{github_commit}/%{name}-%{github_version}-%{github_commit}.tar.gz +# git snapshot with tests +Source0: %{name}-%{github_version}-%{github_short}.tgz +Source1: makesrc.sh BuildArch: noarch +BuildRequires: php-fedora-autoloader-devel +%if %{with_tests} +BuildRequires: php(language) >= %{php_min_ver} +BuildRequires: php-pcre +BuildRequires: php-reflection +BuildRequires: phpunit8 +%endif # composer.json Requires: php(language) >= %{php_min_ver} -# phpcompatinfo (computed from version 1.0.1) +# phpcompatinfo (computed from version 1.1.0) Requires: php-pcre Requires: php-reflection # Autoloader @@ -52,7 +66,7 @@ parsers. This lexer is used in Doctrine Annotations and in Doctrine ORM (DQL). -Autoloader: %{phpdir}/Doctrine/Common/Lexer/autoload.php +Autoloader: %{phpdir}/%{ns_vendor}/%{ns_project}/%{ns_subproj}/autoload.php %prep @@ -60,17 +74,11 @@ Autoloader: %{phpdir}/Doctrine/Common/Lexer/autoload.php %build -: Create autoloader -cat <<'AUTOLOAD' | tee lib/Doctrine/Common/Lexer/autoload.php - - 1.1.0-1 +- update to 1.1.0 +- raise dependency on PHP 7.2 +- sources from git snapshot +- run upstream test suite during build +- use classmap autoloader + * Tue Jun 11 2019 Remi Collet - 1.0.2-1 - update to 1.0.2 -- cgit