summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore7
-rw-r--r--composer.json14
-rwxr-xr-xphp-doctrine-common-get-source.sh4
-rw-r--r--php-doctrine-common.spec130
4 files changed, 80 insertions, 75 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..1ab5c4f
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,7 @@
+package-*.xml
+*.tgz
+*.tar.gz
+*.tar.xz
+*.tar.xz.asc
+*.src.rpm
+*/*rpm
diff --git a/composer.json b/composer.json
index 4f4f215..7729b16 100644
--- a/composer.json
+++ b/composer.json
@@ -13,26 +13,24 @@
{"name": "Johannes Schmitt", "email": "schmittjoh@gmail.com"}
],
"require": {
- "php": ">=5.3.2",
+ "php": "~5.6|~7.0",
"doctrine/inflector": "1.*",
"doctrine/cache": "1.*",
"doctrine/collections": "1.*",
"doctrine/lexer": "1.*",
"doctrine/annotations": "1.*"
},
- "minimum-stability": "dev",
"require-dev": {
- "phpunit/phpunit": "~3.7"
+ "phpunit/phpunit": "^5.4.6"
},
"autoload": {
- "psr-0": { "Doctrine\\Common\\": "lib/" }
+ "psr-4": {
+ "Doctrine\\Common\\": "lib/Doctrine/Common"
+ }
},
"extra": {
"branch-alias": {
- "dev-master": "2.5.x-dev"
+ "dev-master": "2.7.x-dev"
}
- },
- "archive": {
- "exclude": ["!vendor", "tests", "*phpunit.xml", ".travis.yml", "build.xml", "build.properties", "composer.phar"]
}
}
diff --git a/php-doctrine-common-get-source.sh b/php-doctrine-common-get-source.sh
index ba71f5d..4ad1051 100755
--- a/php-doctrine-common-get-source.sh
+++ b/php-doctrine-common-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..."
@@ -51,6 +53,7 @@ pushd $TEMP_DIR
pushd $GIT_DIR
print "Checking out commit..."
$GIT checkout $GIT_COMMIT
+ cp composer.json $CMP_FILE
popd
TAR_DIR=${GIT_NAME}-${GIT_COMMIT}
@@ -58,7 +61,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-doctrine-common.spec b/php-doctrine-common.spec
index e9ef912..364e75f 100644
--- a/php-doctrine-common.spec
+++ b/php-doctrine-common.spec
@@ -2,7 +2,7 @@
#
# Fedora spec file for php-doctrine-common
#
-# Copyright (c) 2013-2015 Shawn Iwinski <shawn.iwinski@gmail.com>
+# Copyright (c) 2013-2017 Shawn Iwinski <shawn.iwinski@gmail.com>
#
# License: MIT
# http://opensource.org/licenses/MIT
@@ -12,14 +12,14 @@
%global github_owner doctrine
%global github_name common
-%global github_version 2.5.3
-%global github_commit 10f1f19651343f87573129ca970aef1a47a6f29e
+%global github_version 2.7.2
+%global github_commit 930297026c8009a567ac051fd545bf6124150347
%global composer_vendor doctrine
%global composer_project common
-# "php": ">=5.3.2"
-%global php_min_ver 5.3.2
+# "php": "~5.6|~7.0"
+%global php_min_ver 5.6
# "doctrine/annotations": "1.*"
# NOTE: Min version not 1.0 because autoloader required
%global doctrine_annotations_min_ver 1.2.6
@@ -54,55 +54,63 @@ Summary: Common library for Doctrine projects
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
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+# GitHub export does not include tests.
+# Run php-doctrine-common-get-source.sh to create full source.
+Source0: %{name}-%{github_version}-%{github_commit}.tar.gz
+Source1: %{name}-get-source.sh
+
BuildArch: noarch
# Library version value check
BuildRequires: php-cli
# Tests
%if %{with_tests}
## composer.json
-BuildRequires: %{_bindir}/phpunit
-BuildRequires: php(language) >= %{php_min_ver}
+BuildRequires: php(language) >= %{php_min_ver}
+BuildRequires: php-composer(doctrine/annotations) < %{doctrine_annotations_max_ver}
BuildRequires: php-composer(doctrine/annotations) >= %{doctrine_annotations_min_ver}
-BuildRequires: php-composer(doctrine/cache) >= %{doctrine_cache_min_ver}
+BuildRequires: php-composer(doctrine/cache) < %{doctrine_cache_max_ver}
+BuildRequires: php-composer(doctrine/cache) >= %{doctrine_cache_min_ver}
+BuildRequires: php-composer(doctrine/collections) < %{doctrine_collections_max_ver}
BuildRequires: php-composer(doctrine/collections) >= %{doctrine_collections_min_ver}
-#BuildRequires: php-composer(doctrine/inflector) >= %%{doctrine_inflector_min_ver}
-BuildRequires: php-doctrine-inflector >= %{doctrine_inflector_min_ver}
-#BuildRequires: php-composer(doctrine/lexer) >= %%{doctrine_lexer_min_ver}
-BuildRequires: php-doctrine-lexer >= %{doctrine_lexer_min_ver}
-## phpcompatinfo (computed from version 2.5.3)
+BuildRequires: php-composer(doctrine/inflector) < %{doctrine_inflector_max_ver}
+#BuildRequires: php-composer(doctrine/inflector) >= %%{doctrine_inflector_min_ver}
+BuildRequires: php-doctrine-inflector >= %{doctrine_inflector_min_ver}
+BuildRequires: php-composer(doctrine/lexer) < %{doctrine_lexer_max_ver}
+#BuildRequires: php-composer(doctrine/lexer) >= %%{doctrine_lexer_min_ver}
+BuildRequires: php-doctrine-lexer >= %{doctrine_lexer_min_ver}
+BuildRequires: php-composer(phpunit/phpunit)
+## phpcompatinfo (computed from version 2.7.2)
BuildRequires: php-date
BuildRequires: php-pcre
BuildRequires: php-reflection
BuildRequires: php-spl
BuildRequires: php-tokenizer
# Autoloader
-BuildRequires: php-composer(symfony/class-loader)
+BuildRequires: php-composer(fedora/autoloader)
%endif
# composer.json
-Requires: php(language) >= %{php_min_ver}
+Requires: php(language) >= %{php_min_ver}
Requires: php-composer(doctrine/annotations) >= %{doctrine_annotations_min_ver}
Requires: php-composer(doctrine/annotations) < %{doctrine_annotations_max_ver}
-Requires: php-composer(doctrine/cache) >= %{doctrine_cache_min_ver}
-Requires: php-composer(doctrine/cache) < %{doctrine_cache_max_ver}
+Requires: php-composer(doctrine/cache) >= %{doctrine_cache_min_ver}
+Requires: php-composer(doctrine/cache) < %{doctrine_cache_max_ver}
Requires: php-composer(doctrine/collections) >= %{doctrine_collections_min_ver}
Requires: php-composer(doctrine/collections) < %{doctrine_collections_max_ver}
-#Requires: php-composer(doctrine/inflector) >= %%{doctrine_inflector_min_ver}
-Requires: php-doctrine-inflector >= %{doctrine_inflector_min_ver}
-Requires: php-composer(doctrine/inflector) < %{doctrine_inflector_max_ver}
-#Requires: php-composer(doctrine/lexer) >= %%{doctrine_lexer_min_ver}
-Requires: php-doctrine-lexer >= %{doctrine_lexer_min_ver}
-Requires: php-composer(doctrine/lexer) < %{doctrine_lexer_max_ver}
-# phpcompatinfo (computed from version 2.5.0)
+#Requires: php-composer(doctrine/inflector) >= %%{doctrine_inflector_min_ver}
+Requires: php-doctrine-inflector >= %{doctrine_inflector_min_ver}
+Requires: php-composer(doctrine/inflector) < %{doctrine_inflector_max_ver}
+#Requires: php-composer(doctrine/lexer) >= %%{doctrine_lexer_min_ver}
+Requires: php-doctrine-lexer >= %{doctrine_lexer_min_ver}
+Requires: php-composer(doctrine/lexer) < %{doctrine_lexer_max_ver}
+# phpcompatinfo (computed from version 2.7.2)
Requires: php-pcre
Requires: php-reflection
Requires: php-spl
Requires: php-tokenizer
# Autoloader
-Requires: php-composer(symfony/class-loader)
+Requires: php-composer(fedora/autoloader)
# Composer
Provides: php-composer(%{composer_vendor}/%{composer_project}) = %{version}
@@ -122,6 +130,9 @@ Autoloader: %{phpdir}/Doctrine/Common/autoload.php
%prep
%setup -qn %{github_name}-%{github_commit}
+: Fix version
+sed -i 's#2.7.0-DEV#%{version}#' lib/Doctrine/Common/Version.php
+
%build
: Create autoloader
@@ -130,33 +141,22 @@ cat <<'AUTOLOAD' | tee lib/Doctrine/Common/autoload.php
/**
* Autoloader for %{name} and its' dependencies
* (created by %{name}-%{version}-%{release}).
- *
- * @return \Symfony\Component\ClassLoader\ClassLoader
*/
+require_once '%{phpdir}/Fedora/Autoloader/autoload.php';
-if (!isset($fedoraClassLoader) || !($fedoraClassLoader instanceof \Symfony\Component\ClassLoader\ClassLoader)) {
- if (!class_exists('Symfony\\Component\\ClassLoader\\ClassLoader', false)) {
- require_once '%{phpdir}/Symfony/Component/ClassLoader/ClassLoader.php';
- }
-
- $fedoraClassLoader = new \Symfony\Component\ClassLoader\ClassLoader();
- $fedoraClassLoader->register();
-}
-
-$fedoraClassLoader->addPrefix('Doctrine\\Common\\', dirname(dirname(__DIR__)));
-
-require_once '%{phpdir}/Doctrine/Common/Annotations/autoload.php';
-require_once '%{phpdir}/Doctrine/Common/Cache/autoload.php';
-require_once '%{phpdir}/Doctrine/Common/Collections/autoload.php';
-require_once '%{phpdir}/Doctrine/Common/Inflector/autoload.php';
-require_once '%{phpdir}/Doctrine/Common/Lexer/autoload.php';
+\Fedora\Autoloader\Autoload::addPsr4('Doctrine\\Common\\', __DIR__);
-return $fedoraClassLoader;
+\Fedora\Autoloader\Dependencies::required(array(
+ '%{phpdir}/Doctrine/Common/Annotations/autoload.php',
+ '%{phpdir}/Doctrine/Common/Cache/autoload.php',
+ '%{phpdir}/Doctrine/Common/Collections/autoload.php',
+ '%{phpdir}/Doctrine/Common/Inflector/autoload.php',
+ '%{phpdir}/Doctrine/Common/Lexer/autoload.php',
+));
AUTOLOAD
%install
-rm -rf %{buildroot}
mkdir -p %{buildroot}%{phpdir}
cp -rp lib/* %{buildroot}%{phpdir}/
@@ -184,31 +184,21 @@ sed -e 's/function testGetManagerForAliasedClass/function SKIP_testGetManagerFor
-i tests/Doctrine/Tests/Common/Persistence/ManagerRegistryTest.php
%endif
-run=0
-ret=0
-if which php56; then
- php56 %{_bindir}/phpunit || ret=1
- run=1
-fi
-if which php71; then
- php71 %{_bindir}/phpunit || ret=1
- run=1
-fi
-if [ $run -eq 0 ]; then
-%{_bindir}/phpunit --verbose
-fi
-exit $ret
+: Upstream tests
+RETURN_CODE=0
+PHPUNIT=$(which phpunit)
+for PHP_EXEC in "" %{?rhel:php54 php55} php56 php70 php71 php72; do
+ if [ -z "$PHP_EXEC" ] || which $PHP_EXEC; then
+ $PHP_EXEC $PHPUNIT --verbose || RETURN_CODE=1
+ fi
+done
+exit $RETURN_CODE
%else
: Tests skipped
%endif
-%clean
-rm -rf %{buildroot}
-
-
%files
-%defattr(-,root,root,-)
%{!?_licensedir:%global license %%doc}
%license LICENSE
%doc *.md
@@ -222,6 +212,14 @@ rm -rf %{buildroot}
%changelog
+* Sun Jul 09 2017 Shawn Iwinski <shawn.iwinski@gmail.com> - 2.7.2-1
+- Updated to 2.7.2 (RHBZ #1258673)
+
+* Fri May 12 2017 Shawn Iwinski <shawn.iwinski@gmail.com> - 2.5.3-3
+- Switch autoloader to php-composer(fedora/autoloader)
+- Add max versions to build dependencies
+- Test with SCLs if available
+
* Fri Jul 22 2016 Shawn Iwinski <shawn.iwinski@gmail.com> - 2.5.3-1
- Updated to 2.5.3 (RHBZ #1347924 / CVE-2015-5723)
- Added library version value check