diff options
author | Remi Collet <fedora@famillecollet.com> | 2015-07-05 08:35:04 +0200 |
---|---|---|
committer | Remi Collet <fedora@famillecollet.com> | 2015-07-05 08:35:04 +0200 |
commit | 62f7eeb67cd702c99e91ee19c8364adfd2f579c7 (patch) | |
tree | 250749df4f974593065183574d10376934607683 | |
parent | 1eeeb359948aa4ef2360195b00f0a5177e848e68 (diff) |
php-doctrine-dbal: 2.5.1, backpot from fedora
-rw-r--r-- | f8c1d77efa988974026189bf8214ef0fecaf1522.patch | 27 | ||||
-rw-r--r-- | php-doctrine-dbal-2.4.2-primary_index.patch | 32 | ||||
-rw-r--r-- | php-doctrine-dbal-bin.patch | 45 | ||||
-rwxr-xr-x | php-doctrine-dbal-get-source.sh | 62 | ||||
-rw-r--r-- | php-doctrine-dbal.spec | 160 |
5 files changed, 210 insertions, 116 deletions
diff --git a/f8c1d77efa988974026189bf8214ef0fecaf1522.patch b/f8c1d77efa988974026189bf8214ef0fecaf1522.patch deleted file mode 100644 index c6dfc27..0000000 --- a/f8c1d77efa988974026189bf8214ef0fecaf1522.patch +++ /dev/null @@ -1,27 +0,0 @@ -From f8c1d77efa988974026189bf8214ef0fecaf1522 Mon Sep 17 00:00:00 2001 -From: Vincent Petry <PVince81@yahoo.fr> -Date: Tue, 1 Jul 2014 13:14:38 +0200 -Subject: [PATCH] Fix escaping of column name for specific alter table case - -When changing the length of a field, the column name needs to be escaped -properly. ---- - lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php b/lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php -index 916e857..c3015b5 100644 ---- a/lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php -+++ b/lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php -@@ -467,7 +467,7 @@ - } - - if ($columnDiff->hasChanged('length')) { -- $query = 'ALTER ' . $column->getName() . ' TYPE ' . $column->getType()->getSqlDeclaration($column->toArray(), $this); -+ $query = 'ALTER ' . $oldColumnName . ' TYPE ' . $column->getType()->getSqlDeclaration($column->toArray(), $this); - $sql[] = 'ALTER TABLE ' . $diff->name . ' ' . $query; - } - } --- -2.0.3 - diff --git a/php-doctrine-dbal-2.4.2-primary_index.patch b/php-doctrine-dbal-2.4.2-primary_index.patch deleted file mode 100644 index 49d46a0..0000000 --- a/php-doctrine-dbal-2.4.2-primary_index.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 1d729298ee9464e03a4695f2df0e63b15d10874c Mon Sep 17 00:00:00 2001 -From: Bart Visscher <bartv@thisnet.nl> -Date: Thu, 18 Jul 2013 20:19:32 +0200 -Subject: [PATCH] When changing from a non-primary index to a primary index, - the dropped index isnt named PRIMARY - ---- - doctrine/dbal/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php | 9 +++++++++ - 1 file changed, 9 insertions(+) - -diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php b/doctrine/dbal/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php -index 8050e1f..d77b974 100644 ---- a/doctrine/dbal/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php -+++ b/doctrine/dbal/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php -@@ -512,6 +512,15 @@ protected function getPreAlterTableIndexForeignKeySQL(TableDiff $diff) - } - } - } -+ foreach ($diff->changedIndexes as $changedKey => $changedIndex) { -+ if ($changedIndex->isPrimary() && $changedKey != 'PRIMARY') { -+ $index = $diff->changedIndexes[$changedKey]; -+ $index = new index($changedKey, $index->getColumns(), $index->isUnique(), false); -+ $diff->removedIndexes[$changedKey] = $index; -+ $diff->addedIndexes['PRIMARY'] = $diff->changedIndexes[$changedKey]; -+ unset($diff->changedIndexes[$changedKey]); -+ } -+ } - - $sql = array_merge($sql, parent::getPreAlterTableIndexForeignKeySQL($diff)); - --- -1.8.5.1 diff --git a/php-doctrine-dbal-bin.patch b/php-doctrine-dbal-bin.patch new file mode 100644 index 0000000..993e20e --- /dev/null +++ b/php-doctrine-dbal-bin.patch @@ -0,0 +1,45 @@ +diff --git a/bin/doctrine-dbal.php b/bin/doctrine-dbal.php +index 3d1131f..f99b2da 100644 +--- a/bin/doctrine-dbal.php ++++ b/bin/doctrine-dbal.php +@@ -1,3 +1,4 @@ ++#!/usr/bin/php + <?php + /* + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +@@ -17,27 +18,21 @@ + * <http://www.doctrine-project.org>. + */ + ++require_once '/usr/share/php/Doctrine/Common/ClassLoader.php'; ++ ++$classLoaderDoctrine = new \Doctrine\Common\ClassLoader('Doctrine'); ++$classLoaderDoctrine->register(); ++ ++$classLoaderSymfony = new \Doctrine\Common\ClassLoader('Symfony'); ++$classLoaderSymfony->register(); ++ + use Symfony\Component\Console\Helper\HelperSet; + use Doctrine\DBAL\Tools\Console\ConsoleRunner; + +-$files = array(__DIR__ . '/../vendor/autoload.php', __DIR__ . '/../../../autoload.php'); +-$loader = null; + $cwd = getcwd(); + $directories = array($cwd, $cwd . DIRECTORY_SEPARATOR . 'config'); + $configFile = null; + +-foreach ($files as $file) { +- if (file_exists($file)) { +- $loader = require $file; +- +- break; +- } +-} +- +-if ( ! $loader) { +- throw new RuntimeException('vendor/autoload.php could not be found. Did you run `php composer.phar install`?'); +-} +- + foreach ($directories as $directory) { + $configFile = $directory . DIRECTORY_SEPARATOR . 'cli-config.php'; + diff --git a/php-doctrine-dbal-get-source.sh b/php-doctrine-dbal-get-source.sh new file mode 100755 index 0000000..e283587 --- /dev/null +++ b/php-doctrine-dbal-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-dbal.spec b/php-doctrine-dbal.spec index d338c1c..a3246e2 100644 --- a/php-doctrine-dbal.spec +++ b/php-doctrine-dbal.spec @@ -1,7 +1,8 @@ +# remirepo spec file for php-doctrine-dbal, from Fedora: # # RPM spec file for php-doctrine-dbal # -# Copyright (c) 2013-2014 Shawn Iwinski <shawn.iwinski@gmail.com> +# Copyright (c) 2013-2015 Shawn Iwinski <shawn.iwinski@gmail.com> # Adam Williamson <awilliam@redhat.com> # # License: MIT @@ -12,62 +13,92 @@ %global github_owner doctrine %global github_name dbal -%global github_version 2.4.2 -%global github_commit fec965d330c958e175c39e61c3f6751955af32d0 +%global github_version 2.5.1 +%global github_commit 628c2256b646ae2417d44e063bce8aec5199d48d %global composer_vendor doctrine %global composer_project dbal # "php": ">=5.3.2" %global php_min_ver 5.3.2 -# "doctrine/common": "~2.4" +# "doctrine/common": ">=2.4,<2.6-dev" %global doctrine_common_min_ver 2.4 -%global doctrine_common_max_ver 3.0 -# "symfony/console": "~2.0" +%global doctrine_common_max_ver 2.6 +# "symfony/console": "2.*" %global symfony_console_min_ver 2.0 %global symfony_console_max_ver 3.0 -Name: php-%{composer_vendor}-%{composer_project} -Version: %{github_version} -Release: 6%{?github_release}%{?dist} -Summary: Doctrine Database Abstraction Layer (DBAL) - -Group: Development/Libraries -License: MIT -URL: http://www.doctrine-project.org/projects/dbal.html -Source0: https://github.com/%{github_owner}/%{github_name}/archive/%{github_commit}/%{name}-%{github_version}-%{github_commit}.tar.gz -# From OwnCloud. Committed upstream as -# https://github.com/doctrine/dbal/commit/075c68b7518e27d46d7f700a1d42ebf43f6ebdfd -# but immediately reverted in -# https://github.com/doctrine/dbal/commit/894493b285c71a33e6ed29994ba415bad5e0a457 -Patch0: %{name}-2.4.2-primary_index.patch -# From upstream master (2.5), not yet backported to 2.4 upstream. Required for -# OwnCloud (pgsql-backed OC 6.x upgrades to 7.x fail without it.) Rediffed -# https://github.com/doctrine/dbal/commit/f8c1d77efa988974026189bf8214ef0fecaf1522 -Patch1: f8c1d77efa988974026189bf8214ef0fecaf1522.patch +%{!?phpdir: %global phpdir %{_datadir}/php} +%{!?__phpunit: %global __phpunit %{_bindir}/phpunit} + +%if 0%{?rhel} == 5 +# No test as no SQlite3 ext +%global with_tests 0 +%else +# Build using "--without tests" to disable tests +%global with_tests %{?_without_tests:0}%{!?_without_tests:1} +%endif + +Name: php-%{composer_vendor}-%{composer_project} +Version: %{github_version} +Release: 1%{?github_release}%{?dist} +Summary: Doctrine Database Abstraction Layer (DBAL) + +Group: Development/Libraries +License: MIT +URL: http://www.doctrine-project.org/projects/dbal.html + +# Run "php-doctrine-dbal-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 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch - -Requires: php(language) >= %{php_min_ver} -Requires: php-composer(doctrine/common) >= %{doctrine_common_min_ver} -Requires: php-composer(doctrine/common) < %{doctrine_common_max_ver} -Requires: php-symfony-console >= %{symfony_console_min_ver} -Requires: php-symfony-console < %{symfony_console_max_ver} -# phpcompatinfo (computed from v2.4.2) -Requires: php-date -Requires: php-json -Requires: php-pcre -Requires: php-pdo -Requires: php-spl +%if %{with_tests} +BuildRequires: php-phpunit-PHPUnit +# composer.json +BuildRequires: php(language) >= %{php_min_ver} +BuildRequires: php-composer(doctrine/common) >= %{doctrine_common_min_ver} +BuildRequires: php-composer(doctrine/common) < %{doctrine_common_max_ver} +# composer.json (optional) +BuildRequires: php-symfony-console >= %{symfony_console_min_ver} +BuildRequires: php-symfony-console < %{symfony_console_max_ver} +# phpcompatinfo (computed from version 2.5.1) +BuildRequires: php-date +BuildRequires: php-json +BuildRequires: php-pcre +BuildRequires: php-pdo +BuildRequires: php-reflection +BuildRequires: php-spl +%endif + +# composer.json +Requires: php(language) >= %{php_min_ver} +Requires: php-composer(doctrine/common) >= %{doctrine_common_min_ver} +Requires: php-composer(doctrine/common) < %{doctrine_common_max_ver} +# composer.json (optional) +Requires: php-symfony-console >= %{symfony_console_min_ver} +Requires: php-symfony-console < %{symfony_console_max_ver} +# phpcompatinfo (computed from version 2.5.1) +Requires: php-date +Requires: php-json +Requires: php-pcre +Requires: php-pdo +Requires: php-reflection +Requires: php-spl # Composer -Provides: php-composer(%{composer_vendor}/%{composer_project}) = %{version} +Provides: php-composer(%{composer_vendor}/%{composer_project}) = %{version} # PEAR -Provides: php-pear(pear.doctrine-project.org/DoctrineDBAL) = %{version} +Provides: php-pear(pear.doctrine-project.org/DoctrineDBAL) = %{version} # Rename -Obsoletes: php-doctrine-DoctrineDBAL < %{version} -Provides: php-doctrine-DoctrineDBAL = %{version} +Obsoletes: php-doctrine-DoctrineDBAL < %{version} +Provides: php-doctrine-DoctrineDBAL = %{version} %description The Doctrine database abstraction & access layer (DBAL) offers a lightweight @@ -83,22 +114,13 @@ extension under the hood. %prep %setup -qn %{github_name}-%{github_commit} -%patch0 -p3 -b .primary_index -%patch1 -p1 -b .escape_column -# Make a single executable -echo '#!%{_bindir}/php' > bin/doctrine-dbal -sed 's#Doctrine/Common/ClassLoader.php#%{_datadir}/php/Doctrine/Common/ClassLoader.php#' \ - bin/doctrine-dbal.php >> bin/doctrine-dbal +# Patch bin script +%patch0 -p1 # Remove empty file rm -f lib/Doctrine/DBAL/README.markdown -# Remove executable bits -chmod a-x \ - lib/Doctrine/DBAL/Types/JsonArrayType.php \ - lib/Doctrine/DBAL/Types/SimpleArrayType.php - %build # Empty build section, nothing required @@ -106,15 +128,31 @@ chmod a-x \ %install rm -rf %{buildroot} -mkdir -p %{buildroot}/%{_datadir}/php -cp -rp lib/Doctrine %{buildroot}/%{_datadir}/php/ + +mkdir -p %{buildroot}/%{phpdir} +cp -rp lib/Doctrine %{buildroot}/%{phpdir}/ mkdir -p %{buildroot}/%{_bindir} -install -pm 0755 bin/doctrine-dbal %{buildroot}/%{_bindir}/ +install -pm 0755 bin/doctrine-dbal.php %{buildroot}/%{_bindir}/doctrine-dbal %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 + +%{__phpunit} --include-path %{buildroot}%{phpdir}:./tests +%else +: Tests skipped +%endif %clean @@ -125,12 +163,20 @@ rm -rf %{buildroot} %defattr(-,root,root,-) %{!?_licensedir:%global license %%doc} %license LICENSE -%doc *.md UPGRADE composer.json -%{_datadir}/php/Doctrine/DBAL +%doc *.md composer.json +%{phpdir}/Doctrine/DBAL %{_bindir}/doctrine-dbal %changelog +* Wed Jan 14 2015 Shawn Iwinski <shawn.iwinski@gmail.com> - 2.5.1-1 +- Updated to 2.5.1 (BZ #1153987) + +* Fri Jan 02 2015 Shawn Iwinski <shawn.iwinski@gmail.com> - 2.5.1-0.2.20150101git185b886 +- Updated to latest snapshot +- Fixed bin script +- Added tests + * Thu Jul 31 2014 Remi Collet <rpms@famillecollet.com> 2.4.2-6 - backport for remi repo - fix license handling |