[php-phpunit-PHP-TokenStream/epel7] - Update to 1.3.0 - enable tests during build - fix license handling

Remi Collet remi at fedoraproject.org
Sun Aug 31 09:57:26 UTC 2014


commit b83cdd5fc429216aa6fd53e69ee0edfb2b305524
Author: Remi Collet <remi at fedoraproject.org>
Date:   Sun Aug 31 11:54:03 2014 +0200

    - Update to 1.3.0
    - enable tests during build
    - fix license handling
    
    (cherry picked from commit 3d7937a269563e20e983e278d349158fefaff8da)

 .gitignore                       |   12 +-------
 Autoload.php.in                  |   24 ++++++++++++++++++
 php-phpunit-PHP-TokenStream.spec |   49 +++++++++++++++++++++++++++-----------
 sources                          |    2 +-
 4 files changed, 62 insertions(+), 25 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index f470f37..3ae5040 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,11 +1,3 @@
-/PHP_TokenStream-1.0.1.tgz
-/PHP_TokenStream-1.1.0.tgz
-/PHP_TokenStream-1.1.1.tgz
-/PHP_TokenStream-1.1.2.tgz
-/PHP_TokenStream-1.1.3.tgz
-/PHP_TokenStream-1.1.5.tgz
-/PHP_TokenStream-1.1.7.tgz
-/PHP_TokenStream-1.2.0.tgz
-/PHP_TokenStream-1.2.1.tgz
-/PHP_TokenStream-1.2.2.tgz
+clog
 /php-token-stream-1.2.2.tar.gz
+/php-token-stream-1.3.0.tar.gz
diff --git a/Autoload.php.in b/Autoload.php.in
new file mode 100644
index 0000000..c6d8bd4
--- /dev/null
+++ b/Autoload.php.in
@@ -0,0 +1,24 @@
+<?php
+/* Inspipred from Autoload from version 1.2.2 */
+
+spl_autoload_register(
+  function ($class)
+  {
+      static $classes = NULL;
+      static $path = NULL;;
+
+      if ($classes === NULL) {
+          $classes = array(
+            ___CLASSLIST___
+          );
+
+          $path = dirname(dirname(dirname(__FILE__)));
+      }
+
+      $cn = strtolower($class);
+
+      if (isset($classes[$cn])) {
+          require $path . $classes[$cn];
+      }
+  }
+);
\ No newline at end of file
diff --git a/php-phpunit-PHP-TokenStream.spec b/php-phpunit-PHP-TokenStream.spec
index 8b993ff..d94f86e 100644
--- a/php-phpunit-PHP-TokenStream.spec
+++ b/php-phpunit-PHP-TokenStream.spec
@@ -1,16 +1,20 @@
-%global gh_commit    ad4e1e23ae01b483c16f600ff1bebec184588e32
+%global bootstrap    0
+%global gh_commit    f8d5d08c56de5cfd592b3340424a81733259a876
 %global gh_short     %(c=%{gh_commit}; echo ${c:0:7})
 %global gh_owner     sebastianbergmann
 %global gh_project   php-token-stream
 %global php_home     %{_datadir}/php
 %global pear_name    PHP_TokenStream
 %global pear_channel pear.phpunit.de
-# Circular dependency with phpunit
+%if %{bootstrap}
 %global with_tests   %{?_with_tests:1}%{!?_with_tests:0}
+%else
+%global with_tests   %{?_without_tests:0}%{!?_without_tests:1}
+%endif
 
 Name:           php-phpunit-PHP-TokenStream
-Version:        1.2.2
-Release:        5%{?dist}
+Version:        1.3.0
+Release:        1%{?dist}
 Summary:        Wrapper around PHP tokenizer extension
 
 Group:          Development/Libraries
@@ -18,8 +22,12 @@ License:        BSD
 URL:            https://github.com/%{gh_owner}/%{gh_project}
 Source0:        https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{gh_project}-%{version}.tar.gz
 
+# Autoload template, from version 1.2.2
+Source1:        Autoload.php.in
+
 BuildArch:      noarch
 BuildRequires:  php(language) >= 5.3.3
+BuildRequires:  %{_bindir}/phpab
 %if %{with_tests}
 BuildRequires:  php-pear-PHPUnit >= 3.7.0
 %endif
@@ -46,17 +54,15 @@ Wrapper around PHP tokenizer extension.
 %prep
 %setup -q -n %{gh_project}-%{gh_commit}
 
-rm PHP/Token/Stream/Autoload.php.in
+# Restore PSR-0 tree to ensure current sources are used by tests
+mv src PHP
 
 
 %build
-# Empty build section, most likely nothing required.
-
-# If upstream drop Autoload.php, command to generate it.
-#phpab \
-#  --output   PHP/Token/Stream/Autoload.php \
-#  --template PHP/Token/Stream/Autoload.php.in \
-#  PHP
+phpab \
+  --output   PHP/Token/Stream/Autoload.php \
+  --template %{SOURCE1} \
+  PHP
 
 
 %install
@@ -66,7 +72,15 @@ cp -pr PHP %{buildroot}%{php_home}/PHP
 
 %if %{with_tests}
 %check
-phpunit -d date.timezone=UTC
+# Use generated autoloader
+sed -e 's:vendor/autoload.php:PHP/Token/Stream/Autoload.php:' \
+    -i tests/bootstrap.php
+
+# Run tests
+phpunit  \
+   --bootstrap tests/bootstrap.php \
+   -d date.timezone=UTC \
+   tests
 %endif
 
 
@@ -78,11 +92,18 @@ fi
 
 
 %files
-%doc LICENSE README.md
+%{!?_licensedir:%global license %%doc}
+%license LICENSE
+%doc README.md composer.json
 %{php_home}/PHP
 
 
 %changelog
+* Sun Aug 31 2014 Remi Collet <remi at fedoraproject.org> - 1.3.0-1
+- Update to 1.3.0
+- enable tests during build
+- fix license handling
+
 * Wed Jun 25 2014 Remi Collet <remi at fedoraproject.org> - 1.2.2-5
 - composer dependencies
 
diff --git a/sources b/sources
index 7097ebd..33442e6 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-d0fc1b4d7f765c36b8229167f3b09c1b  php-token-stream-1.2.2.tar.gz
+d5c19bac276ea419b1b634d2e7bd101c  php-token-stream-1.3.0.tar.gz


More information about the scm-commits mailing list