[php-doctrine-orm] Updated to 2.4.6 (BZ #1108129)

Shawn Iwinski siwinski at fedoraproject.org
Tue Oct 14 12:33:32 UTC 2014


commit 277cd0c25c2fd31731b3392397e57856272914c3
Author: Shawn Iwinski <shawn.iwinski at gmail.com>
Date:   Tue Oct 14 08:32:58 2014 -0400

    Updated to 2.4.6 (BZ #1108129)
    
    - Manual git clone source instead of GitHub archive URL (to include tests)
    - Removed Patch1 (php-doctrine-orm-upstream.patch)
    - Added tests

 .gitignore                      |    1 +
 php-doctrine-orm-get-source.sh  |   62 ++++++++++++++++++++
 php-doctrine-orm-upstream.patch |   31 ----------
 php-doctrine-orm.spec           |  123 ++++++++++++++++++++++++++++-----------
 sources                         |    3 +-
 5 files changed, 153 insertions(+), 67 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index e59cbcb..de10e08 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
 /php-doctrine-orm-2.4.1-84373d05a4198ec380918d535abf83c454c3867f.tar.gz
 /php-doctrine-orm-2.4.2-0363a5548d9263f979f9ca149decb9cfc66419ab.tar.gz
+/php-doctrine-orm-2.4.6-bebacf79d8d4dae9168f0f9bc6811e6c2cb6a4d9.tar.gz
diff --git a/php-doctrine-orm-get-source.sh b/php-doctrine-orm-get-source.sh
new file mode 100755
index 0000000..e283587
--- /dev/null
+++ b/php-doctrine-orm-get-source.sh
@@ -0,0 +1,62 @@
+#/bin/sh
+
+GIT=`which git`
+RPM=`which rpm`
+
+if [ -z "$GIT" ]
+then
+    echo "ERROR: 'git' command not found" 1>&2
+    exit 1
+elif [ -z "$RPM" ]
+then
+    echo "ERROR: 'rpm' command not found" 1>&2
+    exit 1
+fi
+
+function print {
+    echo -e "\e[0;33m>>>>> ${1}\e[0m"
+}
+
+SPEC=`ls *.spec`
+NAME=`echo $SPEC | sed 's#\.spec##'`
+VERSION=`egrep '%global\s*github_version' $SPEC | awk '{print $3}'`
+
+print "SPEC = $SPEC"
+print "NAME = $NAME"
+
+GIT_OWNER=`egrep '%global\s*github_owner' $SPEC | awk '{print $3}'`
+GIT_NAME=`egrep '%global\s*github_name' $SPEC | awk '{print $3}'`
+GIT_COMMIT=`egrep '%global\s*github_commit' $SPEC | awk '{print $3}'`
+GIT_REPO=https://github.com/${GIT_OWNER}/${GIT_NAME}
+GIT_DIR=`echo $GIT_REPO | sed 's#.*/##'`
+
+print "GIT_OWNER = $GIT_OWNER"
+print "GIT_NAME = $GIT_NAME"
+print "GIT_COMMIT = $GIT_COMMIT"
+print "GIT_REPO = $GIT_REPO"
+print "GIT_DIR = $GIT_DIR"
+
+TEMP_DIR=$(mktemp --dir)
+
+pushd $TEMP_DIR
+    print "Cloning git repo..."
+    $GIT clone $GIT_REPO
+
+    pushd $GIT_DIR
+        print "Checking out commit..."
+        $GIT checkout $GIT_COMMIT
+    popd
+
+    TAR_DIR=${GIT_NAME}-${GIT_COMMIT}
+    print "TAR_DIR = $TAR_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
+    tar --exclude-vcs -czf $TAR_FILE $TAR_DIR
+popd
+
+rm -rf $TEMP_DIR
diff --git a/php-doctrine-orm.spec b/php-doctrine-orm.spec
index 554b32f..6b1ed48 100644
--- a/php-doctrine-orm.spec
+++ b/php-doctrine-orm.spec
@@ -12,8 +12,8 @@
 
 %global github_owner     doctrine
 %global github_name      doctrine2
-%global github_version   2.4.2
-%global github_commit    0363a5548d9263f979f9ca149decb9cfc66419ab
+%global github_version   2.4.6
+%global github_commit    bebacf79d8d4dae9168f0f9bc6811e6c2cb6a4d9
 
 %global composer_vendor  doctrine
 %global composer_project orm
@@ -31,43 +31,73 @@
 %global symfony_min_ver     2.1
 %global symfony_max_ver     3.0
 
+%{!?__phpunit:  %global __phpunit  %{_bindir}/phpunit}
+
+# Build using "--without tests" to disable tests
+%global with_tests %{?_without_tests:0}%{!?_without_tests:1}
+
 Name:      php-%{composer_vendor}-%{composer_project}
 Version:   %{github_version}
-Release:   4%{?dist}
+Release:   1%{?dist}
 Summary:   Doctrine Object-Relational-Mapper (ORM)
 
 Group:     Development/Libraries
 License:   MIT
 URL:       http://www.doctrine-project.org/projects/orm.html
-Source0:   https://github.com/%{github_owner}/%{github_name}/archive/%{github_commit}/%{name}-%{github_version}-%{github_commit}.tar.gz
+
+# Run "php-doctrine-orm-get-source.sh" to create source
+Source0:   %{name}-%{version}-%{github_commit}.tar.gz
+Source1:   %{name}-get-source.sh
+
 # Update bin script:
 # 1) Add she-bang
 # 2) Auto-load using Doctrine\Common\ClassLoader
 Patch0:    %{name}-bin.patch
 
-# Upstream fix for latest PHP
-Patch1:    %{name}-upstream.patch
-
 BuildArch: noarch
-
-Requires:  php(language)                      >= %{php_min_ver}
-Requires:  php-composer(doctrine/collections) >= %{collections_min_ver}
-Requires:  php-composer(doctrine/collections) <  %{collections_max_ver}
-Requires:  php-composer(doctrine/dbal)        >= %{dbal_min_ver}
-Requires:  php-composer(doctrine/dbal)        <  %{dbal_max_ver}
-Requires:  php-symfony-console                >= %{symfony_min_ver}
-Requires:  php-symfony-console                <  %{symfony_max_ver}
-Requires:  php-symfony-yaml                   >= %{symfony_min_ver}
-Requires:  php-symfony-yaml                   <  %{symfony_max_ver}
-# phpcompatinfo (computed from v2.4.2)
-Requires:  php-ctype
-Requires:  php-dom
-Requires:  php-pcre
-Requires:  php-pdo
-Requires:  php-reflection
-Requires:  php-simplexml
-Requires:  php-spl
-Requires:  php-tokenizer
+%if %{with_tests}
+BuildRequires: php-phpunit-PHPUnit
+# composer.json
+BuildRequires: php(language)                      >= %{php_min_ver}
+BuildRequires: php-composer(doctrine/collections) >= %{collections_min_ver}
+BuildRequires: php-composer(doctrine/collections) <  %{collections_max_ver}
+BuildRequires: php-composer(doctrine/dbal)        >= %{dbal_min_ver}
+BuildRequires: php-composer(doctrine/dbal)        <  %{dbal_max_ver}
+BuildRequires: php-symfony-console                >= %{symfony_min_ver}
+BuildRequires: php-symfony-console                <  %{symfony_max_ver}
+BuildRequires: php-symfony-yaml                   >= %{symfony_min_ver}
+BuildRequires: php-symfony-yaml                   <  %{symfony_max_ver}
+# phpcompatinfo (computed from version 2.4.6)
+BuildRequires: php-ctype
+BuildRequires: php-date
+BuildRequires: php-dom
+BuildRequires: php-pcre
+BuildRequires: php-pdo
+BuildRequires: php-reflection
+BuildRequires: php-simplexml
+BuildRequires: php-spl
+BuildRequires: php-tokenizer
+%endif
+
+# composer.json
+Requires:      php(language)                      >= %{php_min_ver}
+Requires:      php-composer(doctrine/collections) >= %{collections_min_ver}
+Requires:      php-composer(doctrine/collections) <  %{collections_max_ver}
+Requires:      php-composer(doctrine/dbal)        >= %{dbal_min_ver}
+Requires:      php-composer(doctrine/dbal)        <  %{dbal_max_ver}
+Requires:      php-symfony-console                >= %{symfony_min_ver}
+Requires:      php-symfony-console                <  %{symfony_max_ver}
+Requires:      php-symfony-yaml                   >= %{symfony_min_ver}
+Requires:      php-symfony-yaml                   <  %{symfony_max_ver}
+# phpcompatinfo (computed from version 2.4.6)
+Requires:      php-ctype
+Requires:      php-dom
+Requires:      php-pcre
+Requires:      php-pdo
+Requires:      php-reflection
+Requires:      php-simplexml
+Requires:      php-spl
+Requires:      php-tokenizer
 
 # Composer
 Provides:  php-composer(%{composer_vendor}/%{composer_project}) = %{version}
@@ -98,16 +128,10 @@ Optional caches (see Doctrine\ORM\Tools\Setup::createConfiguration()):
 # Patch bin script
 %patch0 -p1
 
-# For PHP 5.5.13+
-%patch1 -p1
-
 # Remove empty file
 rm -f lib/Doctrine/ORM/README.markdown
 
-# Clenup backup files
-find . -name \*.orig -exec rm {} \;
-
-# Remove unnecessary executable bit
+# Remove unnecessary executable bits
 chmod a-x lib/Doctrine/ORM/Tools/Pagination/Paginator.php
 
 
@@ -124,7 +148,32 @@ install -pm 0755 bin/doctrine.php %{buildroot}/%{_bindir}/doctrine
 
 
 %check
-# No upstream tests provided in source
+%if %{with_tests}
+# Rewrite "tests/Doctrine/Tests/TestInit.php"
+mv tests/Doctrine/Tests/TestInit.php tests/Doctrine/Tests/TestInit.php.dist
+cat > tests/Doctrine/Tests/TestInit.php <<'TEST_INIT'
+<?php
+
+spl_autoload_register(function ($class) {
+    $src = str_replace('\\', '/', $class).'.php';
+    @include_once $src;
+});
+TEST_INIT
+
+# Create PHPUnit config with colors turned off
+sed 's/colors="true"/colors="false"/' phpunit.xml.dist > phpunit.xml
+
+# Weird el6 error
+# TODO: Investigate and submit upstream patch
+%if 0%{?el6}
+sed 's#$this->_em->clear();#if (isset($this->_em)) { $this->_em->clear(); }#' \
+    -i tests/Doctrine/Tests/OrmFunctionalTestCase.php
+%endif
+
+%{__phpunit} --include-path ./lib:./tests -d date.timezone="UTC"
+%else
+: Tests skipped
+%endif
 
 
 %files
@@ -134,6 +183,12 @@ install -pm 0755 bin/doctrine.php %{buildroot}/%{_bindir}/doctrine
 
 
 %changelog
+* Tue Oct 14 2014 Shawn Iwinski <shawn.iwinski at gmail.com> - 2.4.6-1
+- Updated to 2.4.6 (BZ #1108129)
+- Manual git clone source instead of GitHub archive URL (to include tests)
+- Removed Patch1 (%%{name}-upstream.patch)
+- Added tests
+
 * Sat Jun 21 2014 Shawn Iwinski <shawn.iwinski at gmail.com> - 2.4.2-4
 - Added php-composer(%%{composer_vendor}/%%{composer_project}) virtual provide
 - Updated Doctrine dependencies to use php-composer virtual provides
diff --git a/sources b/sources
index e4deeb8..cceecdd 100644
--- a/sources
+++ b/sources
@@ -1,2 +1 @@
-4126f99eec341e0e593b346151c8d4f6  php-doctrine-orm-2.4.1-84373d05a4198ec380918d535abf83c454c3867f.tar.gz
-0362554f607046ff4039bd2f38027729  php-doctrine-orm-2.4.2-0363a5548d9263f979f9ca149decb9cfc66419ab.tar.gz
+c501c7e401b80e56cdc15b72184e9f9f  php-doctrine-orm-2.4.6-bebacf79d8d4dae9168f0f9bc6811e6c2cb6a4d9.tar.gz


More information about the scm-commits mailing list