[php-phpunit-phpcpd/epel7] - Update to 2.0.1 - sources from github - run test suite during build - drop dependency on php-ezc-C
Remi Collet
remi at fedoraproject.org
Tue May 6 06:30:42 UTC 2014
commit c2e8ee0923bd6a432592aa2ff6e7e124ea0418c3
Author: Remi Collet <remi at fedoraproject.org>
Date: Tue May 6 08:31:01 2014 +0200
- Update to 2.0.1
- sources from github
- run test suite during build
- drop dependency on php-ezc-ConsoleTools
- add dependency on php-symfony-console
.gitignore | 2 +
autoload.php.in | 62 ++++++++++++++++++++++++
php-phpunit-phpcpd.spec | 118 ++++++++++++++++++++++++++++-------------------
phpcpd-rpm.patch | 34 +++++++++++++
sources | 2 +-
5 files changed, 169 insertions(+), 49 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 1932a14..38e5dcc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,7 @@
+clog
phpcpd-1.3.1.tgz
/phpcpd-1.3.2.tgz
/phpcpd-1.3.3.tgz
/phpcpd-1.3.5.tgz
/phpcpd-1.4.1.tgz
+/phpcpd-2.0.1.tar.gz
diff --git a/autoload.php.in b/autoload.php.in
new file mode 100644
index 0000000..2f41bdb
--- /dev/null
+++ b/autoload.php.in
@@ -0,0 +1,62 @@
+<?php
+/**
+ * phpcpd
+ *
+ * Copyright (c) 2009-2013, Sebastian Bergmann <sebastian at phpunit.de>.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the name of Sebastian Bergmann nor the names of his
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @package phpcpd
+ * @author Sebastian Bergmann <sebastian at phpunit.de>
+ * @copyright 2009-2013 Sebastian Bergmann <sebastian at phpunit.de>
+ * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
+ * @since File available since Release 1.1.0
+ */
+
+require_once 'SebastianBergmann/FinderFacade/autoload.php';
+require_once 'SebastianBergmann/Version/autoload.php';
+require_once 'Symfony/Component/Console/autoloader.php';
+require_once 'PHP/Timer/Autoload.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-phpcpd.spec b/php-phpunit-phpcpd.spec
index f967586..8ce76d6 100644
--- a/php-phpunit-phpcpd.spec
+++ b/php-phpunit-phpcpd.spec
@@ -1,34 +1,56 @@
-%{!?__pear: %{expand: %%global __pear %{_bindir}/pear}}
-%global pear_name phpcpd
-%global channel pear.phpunit.de
+%global gh_commit a9462153f2dd90466a010179901d31fbff598365
+%global gh_short %(c=%{gh_commit}; echo ${c:0:7})
+%global gh_owner sebastianbergmann
+%global gh_project phpcpd
+%global php_home %{_datadir}/php/SebastianBergmann
+%global pear_name phpcpd
+%global pear_channel pear.phpunit.de
+%global with_tests %{?_without_tests:0}%{!?_without_tests:1}
Name: php-phpunit-phpcpd
-Version: 1.4.1
+Version: 2.0.1
Release: 1%{?dist}
Summary: Copy/Paste Detector (CPD) for PHP code
Group: Development/Libraries
License: BSD
-URL: http://github.com/sebastianbergmann/phpcpd
-Source0: http://pear.phpunit.de/get/%{pear_name}-%{version}.tgz
+URL: https://github.com/%{gh_owner}/%{gh_project}
+Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{gh_project}-%{version}.tar.gz
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
-BuildArch: noarch
-BuildRequires: php-pear >= 1:1.9.4
-BuildRequires: php-channel(%{channel})
+# Autoload template
+Source1: autoload.php.in
+
+# Fix for RPM, use autoload
+Patch0: %{gh_project}-rpm.patch
-Requires: php-common >= 5.2.7
+BuildArch: noarch
+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-Version >= 1.0.3
+BuildRequires: php-symfony-console >= 2.2.0
+BuildRequires: php-phpunit-PHP-Timer >= 1.0.4
+BuildRequires: php-theseer-fDOMDocument >= 1.4
+%endif
+
+# From composer.json
+Requires: php(language) >= 5.3.3
+Requires: php-phpunit-FinderFacade >= 1.1.0
+Requires: php-phpunit-Version >= 1.0.3
+Requires: php-symfony-console >= 2.2.0
+Requires: php-phpunit-PHP-Timer >= 1.0.4
+Requires: php-theseer-fDOMDocument >= 1.4
+# From phpcompatinfo report for version 2.0.1
+Requires: php-dom
+Requires: php-mbstring
+Requires: php-spl
Requires: php-tokenizer
Requires: php-xml
-Requires: php-channel(%{channel})
-Requires(post): %{__pear}
-Requires(postun): %{__pear}
-Requires: php-pear(pear.phpunit.de/FinderFacade) >= 1.0.4
-Requires: php-pear(pear.phpunit.de/PHP_Timer) >= 1.0.4
-Requires: php-pear(pear.phpunit.de/Version) >= 1.0.0
-Requires: php-pear(components.ez.no/ConsoleTools) >= 1.6
-Provides: php-pear(%{channel}/%{pear_name}) = %{version}
+# For compatibility with pear
+Provides: php-pear(%{pear_channel}/%{pear_name}) = %{version}
%description
@@ -40,55 +62,55 @@ need to get a quick overview of duplicated code in a project.
%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
-rm -rf %{buildroot}
-cd %{pear_name}-%{version}
-%{__pear} install --nodeps --packagingroot %{buildroot} %{name}.xml
+mkdir -p %{buildroot}%{php_home}
+cp -pr src %{buildroot}%{php_home}/PHPCPD
-# Clean up unnecessary files
-rm -rf %{buildroot}%{pear_metadir}/.??*
+install -D -p -m 755 phpcpd %{buildroot}%{_bindir}/phpcpd
-# Install XML package description
-mkdir -p %{buildroot}%{pear_xmldir}
-install -pm 644 %{name}.xml %{buildroot}%{pear_xmldir}
-
-%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
-%defattr(-,root,root,-)
-%doc %{pear_docdir}/%{pear_name}
-%{pear_xmldir}/%{name}.xml
-%{pear_phpdir}/SebastianBergmann/PHPCPD
+%doc LICENSE README.md composer.json
+%{php_home}/PHPCPD
%{_bindir}/phpcpd
%changelog
+* Sun May 4 2014 Remi Collet <remi at fedoraproject.org> - 2.0.1-1
+- Update to 2.0.1
+- sources from github
+- run test suite during build
+- drop dependency on php-ezc-ConsoleTools
+- add dependency on php-symfony-console
+
* Wed Apr 10 2013 Guillaume Kulakowski <guillaume DOT kulakowski AT fedoraproject DOT org> - 1.4.1-1
- Upstream 1.4.1
diff --git a/phpcpd-rpm.patch b/phpcpd-rpm.patch
new file mode 100644
index 0000000..d904f78
--- /dev/null
+++ b/phpcpd-rpm.patch
@@ -0,0 +1,34 @@
+diff -up ./phpcpd.rpm ./phpcpd
+--- ./phpcpd.rpm 2014-05-04 10:32:06.000000000 +0200
++++ ./phpcpd 2014-05-04 10:32:59.000000000 +0200
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env php
++#!/usr/bin/php
+ <?php
+ /**
+ * phpcpd
+@@ -46,23 +46,7 @@
+ ini_set('mbstring.func_overload', 0);
+ ini_set('mbstring.internal_encoding', NULL);
+
+-$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/PHPCPD/autoload.php';
+
+ $application = new SebastianBergmann\PHPCPD\CLI\Application;
+ $application->run();
diff --git a/sources b/sources
index 75c6512..c3c9330 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-5071c18578c77c364ab18108b7dc87b3 phpcpd-1.4.1.tgz
+4387a5b7a8235a43dfb0af2b8c5f7a04 phpcpd-2.0.1.tar.gz
More information about the scm-commits
mailing list