adamwill pushed to php-doctrine-dbal (f21). "Updated to latest snapshot (..more)"

notifications at fedoraproject.org notifications at fedoraproject.org
Fri May 1 22:28:33 UTC 2015


>From 9725d71a361aaeea811f66dc8da9c48844a94320 Mon Sep 17 00:00:00 2001
From: Shawn Iwinski <shawn.iwinski at gmail.com>
Date: Fri, 2 Jan 2015 14:17:53 -0500
Subject: Updated to latest snapshot

- Fixed bin script
- Added tests

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 at 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 at 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-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 fd5608f..8f4a006 100644
--- a/php-doctrine-dbal.spec
+++ b/php-doctrine-dbal.spec
@@ -1,7 +1,7 @@
 #
 # RPM spec file for php-doctrine-dbal
 #
-# Copyright (c) 2013-2014 Shawn Iwinski <shawn.iwinski at gmail.com>
+# Copyright (c) 2013-2015 Shawn Iwinski <shawn.iwinski at gmail.com>
 #                         Adam Williamson <awilliam at redhat.com>
 #
 # License: MIT
@@ -12,12 +12,11 @@
 
 %global github_owner     doctrine
 %global github_name      dbal
-# yes, upstream messed up their commit: the commit tagged with the 2.5.0
-# release tag is the one that bumps the version to 2.5.1.
+# Additional commits after v2.5.0 tag. Using version 2.5.1 pre-release because
+#   lib/Doctrine/DBAL/Version.php::VERSION = 2.5.1-DEV
 %global github_version   2.5.1
-%global github_date      20141230
-%global github_commit    dd4d1062ccd5018ee7f2bb05a54258dc839d7b1e
-%global shortcommit %(c=%{github_commit}; echo ${c:0:7})
+%global github_commit    185b886e57e9557c4fad7a39d118000f652b72de
+%global github_release   .20150101git%(c=%{github_commit}; echo ${c:0:7})
 
 %global composer_vendor  doctrine
 %global composer_project dbal
@@ -31,37 +30,71 @@
 %global symfony_console_min_ver 2.0
 %global symfony_console_max_ver 3.0
 
-Name:      php-%{composer_vendor}-%{composer_project}
-Version:   %{github_version}
-Release:   0.1.%{github_date}git%{shortcommit}%{?dist}
-Summary:   Doctrine Database Abstraction Layer (DBAL)
+%{!?phpdir:     %global phpdir     %{_datadir}/php}
+%{!?__phpunit:  %global __phpunit  %{_bindir}/phpunit}
 
-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
+# Build using "--without tests" to disable tests
+%global with_tests %{?_without_tests:0}%{!?_without_tests:1}
 
-BuildArch: noarch
+Name:          php-%{composer_vendor}-%{composer_project}
+Version:       %{github_version}
+Release:       0.2%{?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
 
-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
+# Update bin script:
+# 1) Add she-bang
+# 2) Auto-load using Doctrine\Common\ClassLoader
+Patch0:        %{name}-bin.patch
+
+BuildArch: noarch
+%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 commit 185b886e57e9557c4fad7a39d118000f652b72de)
+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 commit 185b886e57e9557c4fad7a39d118000f652b72de)
+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
@@ -78,48 +111,60 @@ extension under the hood.
 %prep
 %setup -qn %{github_name}-%{github_commit}
 
-# 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
 
 
 %install
-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
-# Upstream drops tests from distribution tarballs:
-# https://github.com/doctrine/doctrine2/pull/543
+%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
 
 
 %files
 %{!?_licensedir:%global license %%doc}
 %license LICENSE
 %doc *.md composer.json
-%{_datadir}/php/Doctrine/DBAL
+%{phpdir}/Doctrine/DBAL
 %{_bindir}/doctrine-dbal
 
 
 %changelog
+* Fri Jan 02 2015 Shawn Iwinski <shawn.iwinski at gmail.com> - 2.5.1-0.2.20150101git185b886
+- Updated to latest snapshot
+- Fixed bin script
+- Added tests
+
 * Tue Dec 30 2014 Adam Williamson <awilliam at redhat.com> - 2.5.1-0.1.20141230gitdd4d106
-- bump to 2.5 branch (with latest fixes, some of which look big)
+- bump to 2.5 branch (with latest fixes, some of which look big; BZ #1153987)
 
 * Tue Jul 29 2014 Adam Williamson <awilliam at redhat.com> - 2.4.2-6
 - really apply the patch
-- 
cgit v0.10.2


	http://pkgs.fedoraproject.org/cgit/php-doctrine-dbal.git/commit/?h=f21&id=9725d71a361aaeea811f66dc8da9c48844a94320


More information about the scm-commits mailing list