summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile4
-rw-r--r--composer.json44
-rw-r--r--phpcpd-rpm.patch28
-rw-r--r--phpcpd.spec270
4 files changed, 346 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..13af741
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,4 @@
+SRCDIR := $(shell pwd)
+NAME := $(shell basename $(SRCDIR))
+include ../../../common/Makefile
+
diff --git a/composer.json b/composer.json
new file mode 100644
index 0000000..658e187
--- /dev/null
+++ b/composer.json
@@ -0,0 +1,44 @@
+{
+ "name": "sebastian/phpcpd",
+ "description": "Copy/Paste Detector (CPD) for PHP code.",
+ "homepage": "https://github.com/sebastianbergmann/phpcpd",
+ "license": "BSD-3-Clause",
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de",
+ "role": "lead"
+ }
+ ],
+ "support": {
+ "issues": "https://github.com/sebastianbergmann/phpcpd/issues"
+ },
+ "config": {
+ "platform": {
+ "php": "5.6.0"
+ },
+ "optimize-autoloader": true,
+ "sort-packages": true
+ },
+ "prefer-stable": true,
+ "require": {
+ "php": "^5.6|^7.0",
+ "sebastian/finder-facade": "^1.1",
+ "sebastian/version": "^1.0|^2.0",
+ "symfony/console": "^2.7|^3.0|^4.0",
+ "phpunit/php-timer": "^1.0.6"
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "bin": [
+ "phpcpd"
+ ],
+ "extra": {
+ "branch-alias": {
+ "dev-master": "3.0-dev"
+ }
+ }
+}
diff --git a/phpcpd-rpm.patch b/phpcpd-rpm.patch
new file mode 100644
index 0000000..0370cfe
--- /dev/null
+++ b/phpcpd-rpm.patch
@@ -0,0 +1,28 @@
+diff -up ./phpcpd.rpm ./phpcpd
+--- ./phpcpd.rpm 2015-03-26 19:04:39.896182549 +0100
++++ ./phpcpd 2015-03-26 19:05:35.300399520 +0100
+@@ -15,23 +15,7 @@ if (ini_get('mbstring.internal_encoding'
+ 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 '/usr/share/php/SebastianBergmann/PHPCPD/autoload.php';
+
+ $application = new SebastianBergmann\PHPCPD\CLI\Application;
+ $application->run();
diff --git a/phpcpd.spec b/phpcpd.spec
new file mode 100644
index 0000000..59929ad
--- /dev/null
+++ b/phpcpd.spec
@@ -0,0 +1,270 @@
+# remirepo/fedora spec file for php-phpunit-phpcpd
+#
+# License: MIT
+# http://opensource.org/licenses/MIT
+#
+# Please, preserve the changelog entries
+#
+%global gh_commit dfed51c1288790fc957c9433e2f49ab152e8a564
+%global gh_short %(c=%{gh_commit}; echo ${c:0:7})
+%global gh_owner sebastianbergmann
+%global gh_project phpcpd
+%global php_home %{_datadir}/php
+%global with_tests %{?_without_tests:0}%{!?_without_tests:1}
+# Packagist
+%global pk_vendor sebastian
+%global pk_project phpcpd
+# Namespace
+%global ns_vendor SebastianBergmann
+%global ns_project PHPCPD
+
+Name: php-phpunit-%{pk_project}
+Version: 3.0.1
+Release: 2%{?dist}
+Summary: Copy/Paste Detector (CPD) for PHP code
+
+Group: Development/Libraries
+License: BSD
+URL: https://github.com/%{gh_owner}/%{gh_project}
+Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{name}-%{version}-%{gh_short}.tar.gz
+
+# Fix for RPM, use autoload
+Patch0: %{gh_project}-rpm.patch
+
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+BuildArch: noarch
+BuildRequires: php(language) >= 5.6
+BuildRequires: php-fedora-autoloader-devel
+%if %{with_tests}
+BuildRequires: %{_bindir}/phpunit
+%if 0%{?fedora} >= 27
+BuildRequires: (php-composer(sebastian/finder-facade) >= 1.1 with php-composer(sebastian/finder-facade) < 2)
+BuildRequires: (php-composer(sebastian/version) >= 1.0 with php-composer(sebastian/version) < 3)
+BuildRequires: (php-composer(symfony/console) >= 2.7 with php-composer(symfony/console) < 5)
+BuildRequires: (php-composer(phpunit/php-timer) >= 1.0.6 with php-composer(phpunit/php-timer) < 2)
+%else
+BuildRequires: php-phpunit-FinderFacade
+BuildRequires: php-phpunit-Version
+BuildRequires: php-symfony3-console
+BuildRequires: php-phpunit-PHP-Timer
+%endif
+%endif
+
+# From composer.json, requires
+# "php": "^5.6|^7.0",
+# "sebastian/finder-facade": "^1.1",
+# "sebastian/version": "^1.0|^2.0",
+# "symfony/console": "^2.7|^3.0|^4.0",
+# "phpunit/php-timer": "^1.0.6"
+Requires: php(language) >= 5.6
+%if 0%{?fedora} >= 27
+Requires: (php-composer(sebastian/finder-facade) >= 1.1 with php-composer(sebastian/finder-facade) < 2)
+Requires: (php-composer(sebastian/version) >= 1.0 with php-composer(sebastian/version) < 3)
+Requires: (php-composer(symfony/console) >= 2.7 with php-composer(symfony/console) < 5)
+Requires: (php-composer(phpunit/php-timer) >= 1.0.6 with php-composer(phpunit/php-timer) < 2)
+%else
+Requires: php-phpunit-FinderFacade
+Requires: php-phpunit-Version
+Requires: php-symfony3-console
+Requires: php-phpunit-PHP-Timer
+%endif
+# From phpcompatinfo report for version 3.0.0
+Requires: php-cli
+Requires: php-dom
+Requires: php-mbstring
+Requires: php-pcre
+Requires: php-spl
+Requires: php-tokenizer
+Requires: php-xml
+
+Provides: %{pk_project} = %{version}
+Provides: php-composer(%{pk_vendor}/%{pk_project}) = %{version}
+
+
+%description
+phpcpd is a Copy/Paste Detector (CPD) for PHP code.
+
+The goal of phpcpd is not not to replace more sophisticated tools such as phpcs,
+pdepend, or phpmd, but rather to provide an alternative to them when you just
+need to get a quick overview of duplicated code in a project.
+
+
+%prep
+%setup -q -n %{gh_project}-%{gh_commit}
+
+%patch0 -p1 -b .rpm
+
+
+%build
+phpab \
+ --output src/autoload.php \
+ --template fedora \
+ src
+
+cat << 'EOF' | tee -a src/autoload.php
+// Dependencies
+\Fedora\Autoloader\Dependencies::required([
+ '%{php_home}/%{ns_vendor}/FinderFacade/autoload.php',
+ '%{php_home}/%{ns_vendor}/Version/autoload.php',
+ [
+ '%{php_home}/Symfony4/Component/Console/autoload.php',
+ '%{php_home}/Symfony3/Component/Console/autoload.php',
+ '%{php_home}/Symfony/Component/Console/autoload.php',
+ ],
+ '%{php_home}/PHP/Timer/Autoload.php',
+]);
+EOF
+
+
+%install
+mkdir -p %{buildroot}%{php_home}/%{ns_vendor}
+cp -pr src %{buildroot}%{php_home}/%{ns_vendor}/%{ns_project}
+
+install -D -p -m 755 phpcpd %{buildroot}%{_bindir}/phpcpd
+
+
+%check
+%if %{with_tests}
+mkdir vendor
+ln -s %{buildroot}%{php_home}/%{ns_vendor}/%{ns_project}/autoload.php vendor/autoload.php
+
+ret=0;
+for cmd in php php56 php70 php71 php72; do
+ if which $cmd; then
+ $cmd %{_bindir}/phpunit --verbose || ret=1
+ fi
+done
+exit $ret
+%else
+: Test suite skipped
+%endif
+
+
+%clean
+rm -rf %{buildroot}
+
+
+%files
+%defattr(-,root,root,-)
+%{!?_licensedir:%global license %%doc}
+%license LICENSE
+%doc README.md composer.json
+%{php_home}/%{ns_vendor}/%{ns_project}
+%{_bindir}/%{pk_project}
+
+
+%changelog
+* Tue Feb 6 2018 Remi Collet <remi@remirepo.net> - 3.0.1-2
+- use range dependencies on F27+
+
+* Thu Nov 16 2017 Remi Collet <remi@remirepo.net> - 3.0.1-1
+- Update to 3.0.1
+- allow Symfony 4
+
+* Wed Feb 8 2017 Remi Collet <remi@fedoraproject.org> - 3.0.0-1
+- Update to 3.0.0
+- raise dependency on PHP 5.6
+- drop dependency on theseer/fdomdocument
+- raise dependency on sebastian/version 2.0
+- cleanup update from pear
+- switch to fedora/autoloader
+
+* Mon Apr 18 2016 Remi Collet <remi@fedoraproject.org> - 2.0.4-1
+- Update to 2.0.4 (no change)
+- allow sebastian/version 2.0
+
+* Sun Apr 17 2016 Remi Collet <remi@fedoraproject.org> - 2.0.3-1
+- Update to 2.0.3
+- raise dependency on Symfony >= 2.7
+- run test suite with both PHP 5 and 7 when available
+- allow to run with PHP from SCL
+- provide php-composer(sebastian/phpcpd)
+
+* Thu Mar 26 2015 Remi Collet <remi@fedoraproject.org> - 2.0.2-1
+- Update to 2.0.2
+- use composer dependencies
+- fix license handling
+
+* Sun May 4 2014 Remi Collet <remi@fedoraproject.org> - 2.0.1-1
+- Update to 2.0.1
+- sources from github
+- run test suite during build
+
+* Fri Nov 08 2013 Remi Collet <remi@fedoraproject.org> - 2.0.0-1
+- Update to 2.0.0
+- drop dependency on components.ez.no/ConsoleTools
+- add dependency on pear.symfony.com/Console >= 2.2.0
+- raise dependency on pear.phpunit.de/FinderFacade >= 1.1.0
+
+* Tue Jul 30 2013 Remi Collet <remi@fedoraproject.org> - 1.4.3-1
+- Update to 1.4.3
+
+* Thu Jul 25 2013 Remi Collet <remi@fedoraproject.org> - 1.4.2-1
+- Update to 1.4.2
+
+* Thu Apr 04 2013 Remi Collet <remi@fedoraproject.org> - 1.4.1-1
+- Update to 1.4.1
+- new dependency on pear.phpunit.de/Version
+
+* Thu Oct 11 2012 Remi Collet <RPMS@FamilleCollet.com> - 1.4.0-1
+- Update to 1.4.0
+- use FinderFacade instead of File_Iterator
+- raise dependecies: php >= 5.3.3, PHP_Timer >= 1.0.4
+
+* Sat Nov 26 2011 Remi Collet <RPMS@FamilleCollet.com> - 1.3.5-1
+- Update to 1.3.5
+
+* Tue Nov 22 2011 Remi Collet <RPMS@FamilleCollet.com> - 1.3.4-1
+- upstream 1.3.4, rebuild for remi repository
+
+* Sun Nov 20 2011 Guillaume Kulakowski <guillaume DOT kulakowski AT fedoraproject DOT org> - 1.3.4-1
+- upstream 1.3.4
+
+* Mon Nov 07 2011 Remi Collet <RPMS@FamilleCollet.com> - 1.3.3-1
+- upstream 1.3.3, rebuild for remi repository
+
+* Sat Nov 05 2011 Guillaume Kulakowski <guillaume DOT kulakowski AT fedoraproject DOT org> - 1.3.3-1
+- upstream 1.3.3
+
+* Sun Oct 17 2010 Remi Collet <RPMS@FamilleCollet.com> - 1.3.2-1
+- rebuild for remi repository
+
+* Sun Oct 17 2010 Christof Damian <christof@damian.net> - 1.3.2-1
+- upstream 1.3.2
+- new requirement phpunit/PHP_Timer
+- increased requirement phpunit/File_Iterator to 1.2.2
+
+* Fri Feb 12 2010 Remi Collet <RPMS@FamilleCollet.com> - 1.3.1-1
+- rebuild for remi repository
+
+* Wed Feb 10 2010 Christof Damian <christof@damian.net> 1.3.1-1
+- upstream 1.3.1
+- change define macros to global
+- use channel macro in postun
+- raise requirements
+
+* Sat Jan 16 2010 Remi Collet <RPMS@FamilleCollet.com> - 1.3.0-2
+- rebuild for remi repository
+
+* Thu Jan 14 2010 Christof Damian <christof@damian.net> - 1.3.0-2
+- forgot tgz file
+
+* Thu Jan 14 2010 Christof Damian <christof@damian.net> - 1.3.0-1
+- upstream 1.3.0
+- add php 5.2.0 dependency
+- raise pear require
+
+* Fri Dec 18 2009 Guillaume Kulakowski <guillaume DOT kulakowski AT fedoraproject DOT org> - 1.2.2-2
+- /usr/share/pear/PHPCPD wasn't owned
+
+* Fri Dec 18 2009 Remi Collet <RPMS@FamilleCollet.com> - 1.2.2-1
+- rebuild for remi repository
+
+* Sat Dec 12 2009 Christof Damian <christof@damian.net> - 1.2.2-1
+- upstream 1.2.2
+
+* Wed Nov 18 2009 Remi Collet <RPMS@FamilleCollet.com> - 1.2.0-1
+- rebuild for remi repository
+
+* Thu Oct 15 2009 Guillaume Kulakowski <guillaume DOT kulakowski AT fedoraproject DOT org> - 1.2.0-1
+- Initial packaging