From 5a134e3ab2460b827e86ebce9233754af7efd31a Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@remirepo.net>
Date: Mon, 6 Nov 2017 08:04:33 +0100
Subject: cleanup

---
 .gitignore              |  7 +++++++
 composer.json           | 41 +++++++++++++++++++++++++++++++++++++++++
 php-phpunit-phpdcd.spec | 24 ++++++++++++------------
 3 files changed, 60 insertions(+), 12 deletions(-)
 create mode 100644 .gitignore
 create mode 100644 composer.json

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..1ab5c4f
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,7 @@
+package-*.xml
+*.tgz
+*.tar.gz
+*.tar.xz
+*.tar.xz.asc
+*.src.rpm
+*/*rpm
diff --git a/composer.json b/composer.json
new file mode 100644
index 0000000..09803e0
--- /dev/null
+++ b/composer.json
@@ -0,0 +1,41 @@
+{
+    "name": "sebastian/phpdcd",
+    "description": "Dead Code Detector (DCD) for PHP code.",
+    "homepage": "https://github.com/sebastianbergmann/phpdcd",
+    "license": "BSD-3-Clause",
+    "authors": [
+        {
+            "name": "Sebastian Bergmann",
+            "email": "sebastian@phpunit.de",
+            "role": "lead"
+        }
+    ],
+    "support": {
+        "issues": "https://github.com/sebastianbergmann/phpdcd/issues"
+    },
+    "require": {
+        "php": ">=5.3.3",
+        "sebastian/finder-facade": ">=1.1.0",
+        "sebastian/version": ">=1.0.3",
+        "symfony/console": ">=2.2.0",
+        "phpunit/php-timer": ">=1.0.4",
+        "phpunit/php-token-stream": ">=1.1.3"
+    },
+    "require-dev": {
+        "phpunit/phpunit": "~3.7"
+    },
+    "autoload": {
+        "classmap": [
+            "src/"
+        ]
+    },
+    "bin": [
+        "phpdcd"
+    ],
+    "extra": {
+        "branch-alias": {
+            "dev-master": "1.0-dev"
+        }
+    }
+}
+
diff --git a/php-phpunit-phpdcd.spec b/php-phpunit-phpdcd.spec
index 0817434..73c86fd 100644
--- a/php-phpunit-phpdcd.spec
+++ b/php-phpunit-phpdcd.spec
@@ -9,7 +9,7 @@
 
 Name:           php-phpunit-phpdcd
 Version:        1.0.2
-Release:        1%{?dist}
+Release:        7%{?dist}
 Summary:        Dead Code Detector (DCD) for PHP code
 
 Group:          Development/Libraries
@@ -23,7 +23,6 @@ Source1:        Autoload.php.in
 # 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.3.3
 BuildRequires:  %{_bindir}/phpab
@@ -37,6 +36,7 @@ BuildRequires:  php-phpunit-PHP-TokenStream >= 1.1.3
 %endif
 
 # From composer.json
+# Use package names so ensure major version
 Requires:       php(language) >= 5.3.3
 Requires:       php-phpunit-FinderFacade >= 1.1.0
 Requires:       php-phpunit-Version >= 1.0.3
@@ -68,7 +68,6 @@ phpab \
 
 
 %install
-rm -rf     %{buildroot}
 mkdir -p   %{buildroot}%{php_home}
 cp -pr src %{buildroot}%{php_home}/PHPDCD
 
@@ -77,17 +76,16 @@ install -D -p -m 755 phpdcd %{buildroot}%{_bindir}/phpdcd
 
 %if %{with_tests}
 %check
-phpunit \
-   --bootstrap src/Autoload.php \
-   -d date.timezone=UTC \
-   tests
+ret=0
+for cmd in php php56 php70 php71 php72; do
+  if which $cmd; then
+    $cmd %{_bindir}/phpunit --bootstrap src/Autoload.php tests || ret=1
+  fi
+done
+exit $ret
 %endif
 
 
-%clean
-rm -rf %{buildroot}
-
-
 %post
 if [ -x %{_bindir}/pear ]; then
    %{_bindir}/pear uninstall --nodeps --ignore-errors --register-only \
@@ -96,13 +94,15 @@ fi
 
 
 %files
-%defattr(-,root,root,-)
 %doc LICENSE README.md composer.json
 %{php_home}/PHPDCD
 %{_bindir}/phpdcd
 
 
 %changelog
+* Mon Nov  6 2017 Remi Collet <remi@remirepo.net> - 1.0.2-7
+- cleanup
+
 * Sun May  4 2014 Remi Collet <remi@fedoraproject.org> - 1.0.2-1
 - update to 1.0.2
 - sources from github
-- 
cgit