[php-phpunit-phploc] - update to 2.0.5 - sources from github - run test suite during build - add dependencies on php-symf
Remi Collet
remi at fedoraproject.org
Mon May 5 14:03:39 UTC 2014
commit ba24814eabea5f26ebccdc3b562b90f77fd70a9d
Author: Remi Collet <remi at fedoraproject.org>
Date: Mon May 5 16:03:58 2014 +0200
- update to 2.0.5
- sources from github
- run test suite during build
- add dependencies on php-symfony-console php-phpunit-git php-phpunit-Version
- drop dependency on php-ezc-Console
.gitignore | 2 +
autoload.php.in | 25 ++++++++++
php-phpunit-phploc.spec | 115 ++++++++++++++++++++++++++++-------------------
phploc-rpm.patch | 34 ++++++++++++++
sources | 2 +-
5 files changed, 130 insertions(+), 48 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index a79f824..ddf7545 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,7 @@
+clog
phploc-1.5.1.tgz
/phploc-1.6.1.tgz
/phploc-1.6.2.tgz
/phploc-1.6.4.tgz
/phploc-1.7.4.tgz
+/phploc-2.0.5.tar.gz
diff --git a/autoload.php.in b/autoload.php.in
new file mode 100644
index 0000000..52a3f0c
--- /dev/null
+++ b/autoload.php.in
@@ -0,0 +1,25 @@
+<?php
+/* Inspired from autoload from version 2.0.3 */
+
+require_once 'SebastianBergmann/FinderFacade/autoload.php';
+require_once 'SebastianBergmann/Git/autoload.php';
+require_once 'SebastianBergmann/Version/autoload.php';
+require_once 'Symfony/Component/Console/autoloader.php';
+
+spl_autoload_register(
+ function($class) {
+ static $classes = null;
+
+ if ($classes === null) {
+ $classes = array(
+ ___CLASSLIST___
+ );
+ }
+
+ $cn = strtolower($class);
+
+ if (isset($classes[$cn])) {
+ require ___BASEDIR___$classes[$cn];
+ }
+ }
+);
diff --git a/php-phpunit-phploc.spec b/php-phpunit-phploc.spec
index 4b0f6ee..3c9363a 100644
--- a/php-phpunit-phploc.spec
+++ b/php-phpunit-phploc.spec
@@ -1,31 +1,52 @@
-%{!?__pear: %{expand: %%global __pear %{_bindir}/pear}}
-%{!?pear_metadir: %global pear_metadir %{pear_phpdir}}
-%global pear_name phploc
-%global channel pear.phpunit.de
+%global gh_commit d177c22e2a08e448f7bdfa762045f7bd086834d7
+%global gh_short %(c=%{gh_commit}; echo ${c:0:7})
+%global gh_owner sebastianbergmann
+%global gh_project phploc
+%global php_home %{_datadir}/php/SebastianBergmann
+%global pear_name phploc
+%global pear_channel pear.phpunit.de
+%global with_tests %{?_without_tests:0}%{!?_without_tests:1}
Name: php-phpunit-phploc
-Version: 1.7.4
-Release: 2%{?dist}
+Version: 2.0.5
+Release: 1%{?dist}
Summary: A tool for quickly measuring the size of a PHP project
Group: Development/Libraries
License: BSD
-URL: http://sebastianbergmann.github.com/phploc/
-Source0: http://pear.phpunit.de/get/%{pear_name}-%{version}.tgz
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+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
+Source1: autoload.php.in
+
+# Fix for RPM, use autoload
+Patch0: %{gh_project}-rpm.patch
BuildArch: noarch
-BuildRequires: php-pear >= 1:1.9.4
-BuildRequires: php-channel(%{channel})
-Requires: php-common >= 5.3.3
+BuildRequires: php(language) >= 5.3.3
+BuildRequires: %{_bindir}/phpab
+%if %{with_tests}
+BuildRequires: %{_bindir}/phpunit
+BuildRequires: php-phpunit-FinderFacade >= 1.1.0
+BuildRequires: php-phpunit-git >= 1.0.0
+BuildRequires: php-phpunit-Version >= 1.0.3
+BuildRequires: php-symfony-console >= 2.2.0
+%endif
+
+# From composer.json
+Requires: php(language) >= 5.3.3
+Requires: php-phpunit-FinderFacade >= 1.1.0
+Requires: php-phpunit-git >= 1.0.0
+Requires: php-phpunit-Version >= 1.0.3
+Requires: php-symfony-console >= 2.2.0
+# From phpcompatinfo report for version 2.0.5
+Requires: php-dom
+Requires: php-spl
Requires: php-tokenizer
-Requires: php-channel(%{channel})
-Requires(post): %{__pear}
-Requires(postun): %{__pear}
-Requires: php-pear(pear.phpunit.de/FinderFacade) >= 1.0.4
-Requires: php-pear(components.ez.no/ConsoleTools) >= 1.6
-Provides: php-pear(%{channel}/%{pear_name}) = %{version}
+# For compat
+Provides: php-pear(%{pear_channel}/%{pear_name}) = %{version}
%description
@@ -37,55 +58,55 @@ need to get a quick understanding of a project's size.
%prep
-%setup -q -c
-[ -f package2.xml ] || mv package.xml package2.xml
-mv package2.xml %{pear_name}-%{version}/%{name}.xml
-cd %{pear_name}-%{version}
+%setup -q -n %{gh_project}-%{gh_commit}
+
+%patch0 -p1 -b .rpm
%build
-cd %{pear_name}-%{version}
-# Empty build section, most likely nothing required.
+phpab \
+ --output src/autoload.php \
+ --template %{SOURCE1} \
+ src
%install
-cd %{pear_name}-%{version}
-rm -rf %{buildroot} docdir
-pear install --nodeps --packagingroot %{buildroot} %{name}.xml
-
-# Clean up unnecessary files
-rm -rf %{buildroot}/%{pear_metadir}/.??*
+mkdir -p %{buildroot}%{php_home}
+cp -pr src %{buildroot}%{php_home}/PHPLOC
-# Install XML package description
-mkdir -p %{buildroot}%{pear_xmldir}
-install -pm 644 %{name}.xml %{buildroot}%{pear_xmldir}
+install -D -p -m 755 phploc %{buildroot}%{_bindir}/phploc
-%clean
-rm -rf %{buildroot}
+%if %{with_tests}
+%check
+phpunit \
+ --bootstrap src/autoload.php \
+ -d date.timezone=UTC \
+ tests
+%endif
%post
-pear install --nodeps --soft --force --register-only \
- %{pear_xmldir}/%{name}.xml >/dev/null || :
-
-
-%postun
-if [ $1 -eq 0 ] ; then
- pear uninstall --nodeps --ignore-errors --register-only \
- %{channel}/%{pear_name} >/dev/null || :
+if [ -x %{_bindir}/pear ]; then
+ %{_bindir}/pear uninstall --nodeps --ignore-errors --register-only \
+ %{pear_channel}/%{pear_name} >/dev/null || :
fi
%files
-%doc %{pear_docdir}/%{pear_name}
-%defattr(-,root,root,-)
-%{pear_xmldir}/%{name}.xml
-%{pear_phpdir}/SebastianBergmann/PHPLOC
+%doc LICENSE README.md composer.json
+%{php_home}/PHPLOC
%{_bindir}/phploc
%changelog
+* Sat May 3 2014 Remi Collet <remi at fedoraproject.org> - 2.0.5-1
+- update to 2.0.5
+- sources from github
+- run test suite during build
+- add dependencies on php-symfony-console php-phpunit-git php-phpunit-Version
+- drop dependency on php-ezc-Console
+
* Sun Aug 04 2013 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 1.7.4-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
diff --git a/phploc-rpm.patch b/phploc-rpm.patch
new file mode 100644
index 0000000..fc04bb6
--- /dev/null
+++ b/phploc-rpm.patch
@@ -0,0 +1,34 @@
+diff -up ./phploc.rpm ./phploc
+--- ./phploc.rpm 2014-05-03 18:50:56.000000000 +0200
++++ ./phploc 2014-05-03 18:51:38.000000000 +0200
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env php
++#!/usr/bin/php
+ <?php
+ /**
+ * phploc
+@@ -42,23 +42,7 @@
+ * @since File available since Release 1.0.0
+ */
+
+-$loaded = false;
+-
+-foreach (array(__DIR__ . '/../../autoload.php', __DIR__ . '/vendor/autoload.php') as $file) {
+- if (file_exists($file)) {
+- require $file;
+- $loaded = true;
+- break;
+- }
+-}
+-
+-if (!$loaded) {
+- die(
+- 'You need to set up the project dependencies using the following commands:' . PHP_EOL .
+- 'wget http://getcomposer.org/composer.phar' . PHP_EOL .
+- 'php composer.phar install' . PHP_EOL
+- );
+-}
++require 'SebastianBergmann/PHPLOC/autoload.php';
+
+ $application = new SebastianBergmann\PHPLOC\CLI\Application;
+ $application->run();
diff --git a/sources b/sources
index 15ee50c..05bb814 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-86ccf49dbb7a444556e408559bd88a1a phploc-1.7.4.tgz
+24cd7ca43f331a470783787cf62cf5bf phploc-2.0.5.tar.gz
More information about the scm-commits
mailing list