diff options
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | composer.json | 6 | ||||
-rwxr-xr-x | makesrc.sh | 28 | ||||
-rw-r--r-- | php-phpunit-phploc.spec | 75 | ||||
-rw-r--r-- | phploc-rpm.patch | 13 |
5 files changed, 82 insertions, 42 deletions
@@ -1,5 +1,7 @@ +clog package-*.xml *.tgz +*.tar.bz2 *.tar.gz *.tar.xz *.tar.xz.asc diff --git a/composer.json b/composer.json index a1f581d..50c49b9 100644 --- a/composer.json +++ b/composer.json @@ -24,9 +24,9 @@ "php": "^7.3", "ext-dom": "*", "ext-json": "*", - "sebastian/finder-facade": "^2.0", + "sebastian/cli-parser": "^1.0", "sebastian/version": "^3.0", - "symfony/console": "^4.0 || ^5.0" + "phpunit/php-file-iterator": "^3.0" }, "autoload": { "classmap": [ @@ -38,7 +38,7 @@ ], "extra": { "branch-alias": { - "dev-master": "6.0-dev" + "dev-master": "7.0-dev" } } } diff --git a/makesrc.sh b/makesrc.sh new file mode 100755 index 0000000..3d8028d --- /dev/null +++ b/makesrc.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +NAME=$(basename $PWD) +OWNER=$(sed -n '/^%global gh_owner/{s/.* //;p}' $NAME.spec) +PROJECT=$(sed -n '/^%global gh_project/{s/.* //;p}' $NAME.spec) +VERSION=$(sed -n '/^Version:/{s/.* //;p}' $NAME.spec) +COMMIT=$(sed -n '/^%global gh_commit/{s/.* //;p}' $NAME.spec) +SHORT=${COMMIT:0:7} + +echo -e "\nCreate git snapshot\nName=$NAME, Owner=$OWNER, Project=$PROJECT, Version=$VERSION\n" + +echo "Cloning..." +rm -rf $PROJECT-$COMMIT +git clone https://github.com/$OWNER/$PROJECT.git $PROJECT-$COMMIT + +echo "Getting commit..." +pushd $PROJECT-$COMMIT +git checkout $COMMIT +cp composer.json ../composer.json +popd + +echo "Archiving..." +tar czf $NAME-$VERSION-$SHORT.tgz --exclude-vcs --exclude tools $PROJECT-$COMMIT + +echo "Cleaning..." +rm -rf $PROJECT-$COMMIT + +echo "Done." diff --git a/php-phpunit-phploc.spec b/php-phpunit-phploc.spec index e99aa56..f13ebb0 100644 --- a/php-phpunit-phploc.spec +++ b/php-phpunit-phploc.spec @@ -8,26 +8,31 @@ # Please, preserve the changelog entries # +%bcond_without tests + # For compatibility with SCL %undefine __brp_mangle_shebangs -%global gh_commit 00e3bade7b22a6f23b17c3bf2fa4dba24ead8a29 +%global gh_commit 9f307141df2d7698fc6d42999411e2dd147ca817 %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 php_home %{_datadir}/php %global pear_name phploc %global pear_channel pear.phpunit.de -%global with_tests %{?_without_tests:0}%{!?_without_tests:1} +# Namespace +%global ns_vendor SebastianBergmann +%global ns_project PHPLOC Name: php-phpunit-phploc -Version: 6.0.2 +Version: 7.0.0 Release: 1%{?dist} Summary: A tool for quickly measuring the size of a PHP project 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 +Source0: %{name}-%{version}-%{gh_short}.tgz +Source1: makesrc.sh # Fix for RPM, use autoload Patch0: %{gh_project}-rpm.patch @@ -35,23 +40,23 @@ Patch0: %{gh_project}-rpm.patch BuildArch: noarch BuildRequires: php(language) >= 7.3 BuildRequires: php-fedora-autoloader-devel -%if %{with_tests} +%if %{with tests} BuildRequires: php-dom BuildRequires: php-json BuildRequires: php-spl BuildRequires: php-tokenizer # remirepo:1 %if 0%{?fedora} >= 27 || 0%{?rhel} >= 8 -BuildRequires: (php-composer(sebastian/finder-facade) >= 2.0 with php-composer(sebastian/finder-facade) < 3) -BuildRequires: (php-composer(sebastian/version) >= 3.0 with php-composer(sebastian/version) < 4) -BuildRequires: (php-composer(symfony/console) >= 4.0 with php-composer(symfony/console) < 6) +BuildRequires: (php-composer(sebastian/cli-parser) >= 1.0 with php-composer(sebastian/cli-parser) < 2) +BuildRequires: (php-composer(sebastian/version) >= 3.0 with php-composer(sebastian/version) < 4) +BuildRequires: (php-composer(phpunit/php-file-iterator) >= 3.0 with php-composer(phpunit/php-file-iterator) < 4) # remirepo:5 %else -BuildRequires: php-sebastian-finder-facade2 +BuildRequires: php-sebastian-cli-parser BuildRequires: php-sebastian-version3 -BuildRequires: php-symfony4-console +BuildRequires: php-phpunit-php-file-iterator3 %endif -%global phpunit %{_bindir}/phpunit8 +%global phpunit %{_bindir}/phpunit9 BuildRequires: %{phpunit} %endif @@ -68,16 +73,16 @@ Requires: php-dom Requires: php-json # remirepo:1 %if 0%{?fedora} >= 27 || 0%{?rhel} >= 8 -Requires: (php-composer(sebastian/finder-facade) >= 2.0 with php-composer(sebastian/finder-facade) < 3) -Requires: (php-composer(sebastian/version) >= 3.0 with php-composer(sebastian/version) < 4) -Requires: (php-composer(symfony/console) >= 4.0 with php-composer(symfony/console) < 6) +Requires: (php-composer(sebastian/cli-parser) >= 1.0 with php-composer(sebastian/cli-parser) < 2) +Requires: (php-composer(sebastian/version) >= 3.0 with php-composer(sebastian/version) < 4) +Requires: (php-composer(phpunit/php-file-iterator) >= 3.0 with php-composer(phpunit/php-file-iterator) < 4) # remirepo:5 %else -Requires: php-sebastian-finder-facade2 +Requires: php-sebastian-cli-parser Requires: php-sebastian-version3 -Requires: php-symfony4-console +Requires: php-phpunit-php-file-iterator3 %endif -# From phpcompatinfo report for version 6.0.2 +# From phpcompatinfo report for version 7.0.0 Requires: php-spl Requires: php-tokenizer # For our autoloader @@ -112,33 +117,31 @@ need to get a quick understanding of a project's size. cat << 'EOF' | tee -a src/autoload.php \Fedora\Autoloader\Dependencies::required([ - '%{_datadir}/php/SebastianBergmann/FinderFacade2/autoload.php', - '%{_datadir}/php/SebastianBergmann/Version3/autoload.php', - '%{_datadir}/php/TheSeer/fDOMDocument/autoload.php', - [ - '%{_datadir}/php/Symfony5/Component/Console/autoload.php', - '%{_datadir}/php/Symfony4/Component/Console/autoload.php', - ], + '%{php_home}/%{ns_vendor}/CliParser/autoload.php', + '%{php_home}/%{ns_vendor}/FileIterator3/autoload.php', + '%{php_home}/%{ns_vendor}/Version3/autoload.php', ]); EOF %install -mkdir -p %{buildroot}%{php_home} -cp -pr src %{buildroot}%{php_home}/PHPLOC +mkdir -p %{buildroot}%{php_home}/%{ns_vendor} +cp -pr src %{buildroot}%{php_home}/%{ns_vendor}/%{ns_project} install -D -p -m 755 phploc %{buildroot}%{_bindir}/phploc -%if %{with_tests} +%if %{with tests} %check +mkdir vendor +ln -s %{buildroot}%{php_home}/%{ns_vendor}/%{ns_project}/autoload.php vendor/autoload.php + ret=0 -for cmd in "php %{phpunit}" php73 php74; do +for cmd in "php %{phpunit}" php73 php74 php80; do if which $cmd; then set $cmd $1 ${2:-%{_bindir}/phpunit9} \ - --bootstrap %{buildroot}%{php_home}/PHPLOC/autoload.php \ - --verbose tests || ret=1 + --verbose || ret=1 fi done exit $ret @@ -158,11 +161,19 @@ fi %license LICENSE %doc README.md %doc composer.json -%{php_home}/PHPLOC +%{php_home}/%{ns_vendor}/%{ns_project} %{_bindir}/phploc %changelog +* Thu Aug 13 2020 Remi Collet <remi@remirepo.net> - 7.0.0-1 +- update to 7.0.0 +- sources from git snapshot +- add dependency on sebastian/cli-parser +- add dependency on phpunit/php-file-iterator +- drop depency on sebastian/finder-facade +- drop depency on symfony/console + * Fri Feb 28 2020 Remi Collet <remi@remirepo.net> - 6.0.2-1 - update to 6.0.2 diff --git a/phploc-rpm.patch b/phploc-rpm.patch index 671c679..6fba185 100644 --- a/phploc-rpm.patch +++ b/phploc-rpm.patch @@ -1,10 +1,10 @@ diff -up ./phploc.rpm ./phploc ---- ./phploc.rpm 2015-06-04 15:18:14.000000000 +0200 -+++ ./phploc 2015-06-04 17:19:24.277906076 +0200 -@@ -9,23 +9,7 @@ +--- ./phploc.rpm 2020-08-13 13:59:16.515178218 +0200 ++++ ./phploc 2020-08-13 13:59:43.163139614 +0200 +@@ -9,22 +9,6 @@ * file that was distributed with this source code. */ - + -$loaded = false; - -foreach (array(__DIR__ . '/../../autoload.php', __DIR__ . '/vendor/autoload.php') as $file) { @@ -23,6 +23,5 @@ diff -up ./phploc.rpm ./phploc - ); -} +require '/usr/share/php/SebastianBergmann/PHPLOC/autoload.php'; - - $application = new SebastianBergmann\PHPLOC\CLI\Application; - $application->run(); + + exit((new \SebastianBergmann\PHPLOC\Application)->run($_SERVER['argv'])); |