From fe02d1bc0dde123e6be55f5c7808251a32ff3669 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Tue, 14 Jul 2015 08:02:11 +0200 Subject: php-gitter: backport fedora changes --- php-gitter-pr47.patch | 65 ++++++++++++++++++++++++++++ php-gitter.spec | 114 ++++++++++++++++++++++++++++++++++---------------- 2 files changed, 144 insertions(+), 35 deletions(-) create mode 100644 php-gitter-pr47.patch diff --git a/php-gitter-pr47.patch b/php-gitter-pr47.patch new file mode 100644 index 0000000..007d598 --- /dev/null +++ b/php-gitter-pr47.patch @@ -0,0 +1,65 @@ +From c02d283c43151120b93e96141df1a8e465b25d8c Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Sun, 24 May 2015 08:31:28 +0200 +Subject: [PATCH] fix for git 2.4.x + +--- + lib/Gitter/Repository.php | 8 ++++++-- + tests/Gitter/Tests/RepositoryTest.php | 6 +++--- + 2 files changed, 9 insertions(+), 5 deletions(-) + +diff --git a/lib/Gitter/Repository.php b/lib/Gitter/Repository.php +index 7391125..a40733c 100644 +--- a/lib/Gitter/Repository.php ++++ b/lib/Gitter/Repository.php +@@ -244,7 +244,9 @@ public function getBranches() + // Since we've stripped whitespace, the result "* (detached from " + // and "* (no branch)" that is displayed in detached HEAD state + // becomes "(detachedfrom" and "(nobranch)" respectively. +- if ((strpos($branches[0], '(detachedfrom') === 0) || ($branches[0] === '(nobranch)')) { ++ if ((strpos($branches[0], '(detachedfrom') === 0) ++ || (strpos($branches[0], '(HEADdetachedat') === 0) ++ || ($branches[0] === '(nobranch)')) { + $branches = array_slice($branches, 1); + } + +@@ -264,7 +266,9 @@ public function getCurrentBranch() + + foreach ($branches as $branch) { + if ($branch[0] === '*') { +- if ((strpos($branch, '* (detached from ') === 0) || ($branch === '* (no branch)')) { ++ if ((strpos($branch, '* (detached from ') === 0) ++ || (strpos($branch, '* (HEAD detached at ') === 0) ++ || ($branch === '* (no branch)')) { + return NULL; + } + +diff --git a/tests/Gitter/Tests/RepositoryTest.php b/tests/Gitter/Tests/RepositoryTest.php +index cc6e7ef..312d041 100755 +--- a/tests/Gitter/Tests/RepositoryTest.php ++++ b/tests/Gitter/Tests/RepositoryTest.php +@@ -176,13 +176,13 @@ public function testIsGettingCurrentBranch() + { + $repository = $this->client->getRepository(self::$tmpdir . '/testrepo'); + $branch = $repository->getCurrentBranch(); +- $this->assertTrue($branch === 'master'); ++ $this->assertEquals('master', $branch); + + $commits = $repository->getCommits(); + $hash = $commits[0]->getHash(); + $repository->checkout($hash); + $new_branch = $repository->getCurrentBranch(); +- $this->assertTrue($new_branch === NULL); ++ $this->assertNull($new_branch); + + $repository->checkout($branch); + } +@@ -195,7 +195,7 @@ public function testIsGettingBranchesWhenHeadIsDetached() + $hash = $commits[0]->getHash(); + $repository->checkout($hash); + $branches = $repository->getBranches(); +- $this->assertTrue(count($branches) === 3); ++ $this->assertEquals(3, count($branches), print_r($branches, true)); + + $branch = $repository->getHead('develop'); + $repository->checkout($current_branch); diff --git a/php-gitter.spec b/php-gitter.spec index fcbb962..604087e 100644 --- a/php-gitter.spec +++ b/php-gitter.spec @@ -1,7 +1,8 @@ +# remirepo spec file for php-gitter, from Fedora: # # RPM spec file for php-gitter # -# Copyright (c) 2014 Shawn Iwinski +# Copyright (c) 2014-2015 Shawn Iwinski # # License: MIT # http://opensource.org/licenses/MIT @@ -17,23 +18,19 @@ %global composer_vendor klaussilveira %global composer_project gitter -%global lib_name Gitter - # "php": ">=5.3.0" %global php_min_ver 5.3.0 -# "phpunit/phpunit": ">=3.7.1" -%global phpunit_min_ver 3.7.1 # "symfony/*": ">=2.2" %global symfony_min_ver 2.2 # Build using "--without tests" to disable tests -%global with_tests %{?_without_tests:0}%{!?_without_tests:1} +%global with_tests 0%{!?_without_tests:1} -%{!?__phpunit: %global __phpunit %{_bindir}/phpunit} +%{!?phpdir: %global phpdir %{_datadir}/php} Name: php-%{composer_project} Version: %{github_version} -Release: 1%{?github_release}%{?dist} +Release: 5%{?github_release}%{?dist} Summary: Object oriented interaction with Git repositories Group: Development/Libraries @@ -41,34 +38,44 @@ License: BSD URL: https://github.com/%{github_owner}/%{github_name} Source0: %{url}/archive/%{github_commit}/%{name}-%{github_version}-%{github_commit}.tar.gz +# fix for git 2.4.x +# https://github.com/klaussilveira/gitter/pull/47 +Patch0: %{name}-pr47.patch + BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch +# Tests %if %{with_tests} -# For tests BuildRequires: git -# For tests: composer.json -BuildRequires: php(language) >= %{php_min_ver} +## composer.json +BuildRequires: %{_bindir}/phpunit +BuildRequires: php(language) >= %{php_min_ver} +BuildRequires: php-composer(symfony/filesystem) >= %{symfony_min_ver} +BuildRequires: php-composer(symfony/process) >= %{symfony_min_ver} BuildRequires: php-deepend-Mockery -BuildRequires: php-phpunit-PHPUnit >= %{phpunit_min_ver} -BuildRequires: php-symfony-process >= %{symfony_min_ver} -BuildRequires: php-symfony-filesystem >= %{symfony_min_ver} -# For tests: phpcompatinfo (computed from version 0.3.0) +## phpcompatinfo (computed from version 0.3.0) BuildRequires: php-date BuildRequires: php-pcre BuildRequires: php-reflection BuildRequires: php-spl +## Autoloader +BuildRequires: php-composer(symfony/class-loader) %endif Requires: git # composer.json -Requires: php(language) >= %{php_min_ver} -Requires: php-symfony-process >= %{symfony_min_ver} +Requires: php(language) >= %{php_min_ver} +Requires: php-composer(symfony/process) >= %{symfony_min_ver} # phpcompatinfo (computed from version 0.3.0) Requires: php-date Requires: php-pcre Requires: php-reflection Requires: php-spl +# Autoloader +Requires: php-composer(symfony/class-loader) +# Standard "php-{COMPOSER_VENDOR}-{COMPOSER_PROJECT}" naming +Provides: php-%{composer_vendor}-%{composer_project} = %{version}-%{release} # Composer Provides: php-composer(%{composer_vendor}/%{composer_project}) = %{version} @@ -85,6 +92,39 @@ thing. %prep %setup -qn %{github_name}-%{github_commit} +: fix for git 2.4.x +: https://github.com/klaussilveira/gitter/pull/47 +%patch0 -p1 + +: Create autoloader +cat <<'AUTOLOAD' | tee lib/Gitter/autoload.php +register(); +} + +$fedoraClassLoader->addPrefix('Gitter\\', dirname(__DIR__)); + +// Not all dependency autoloaders exist or are in every dist yet so fallback +// to using include path for dependencies for now +$fedoraClassLoader->setUseIncludePath(true); + +return $fedoraClassLoader; +AUTOLOAD + %build # Empty build section, nothing required @@ -92,43 +132,47 @@ thing. %install rm -rf %{buildroot} -mkdir -p %{buildroot}/%{_datadir}/php -cp -rp lib/%{lib_name} %{buildroot}/%{_datadir}/php/ +mkdir -p %{buildroot}/%{phpdir} +cp -rp lib/* %{buildroot}/%{phpdir}/ %check %if %{with_tests} -# Create autoloader -mkdir vendor -cat > vendor/autoload.php <<'AUTOLOAD' - phpunit.xml -# Create PHPUnit config w/ colors turned off -sed 's/colors="true"/colors="false"/' phpunit.xml.dist > phpunit.xml - -%{__phpunit} --include-path="./lib:./tests" -d date.timezone="UTC" +: Run tests +%{_bindir}/phpunit --verbose \ + --bootstrap %{buildroot}/%{phpdir}/Gitter/autoload.php %else : Tests skipped %endif + %clean rm -rf %{buildroot} -%{!?_licensedir:%global license %%doc} %files %defattr(-,root,root,-) +%{!?_licensedir:%global license %%doc} %license LICENSE -%doc README.md composer.json -%{_datadir}/php/%{lib_name} +%doc *.md +%doc composer.json +%{phpdir}/Gitter %changelog +* Sat Jul 11 2015 Shawn Iwinski - 0.3.0-5 +- Use full require paths in autoloader + +* Sat Jul 11 2015 Shawn Iwinski - 0.3.0-4 +- Added autoloader +- Added standard "php-{COMPOSER_VENDOR}-{COMPOSER_PROJECT}" naming provides + +* Sun May 24 2015 Remi Collet - 0.3.0-2 +- add patch for git 2.4 (FTBFS detected by Koschei) + * Sat Jul 19 2014 Shawn Iwinski - 0.3.0-1 - Updated to 0.3.0 (BZ #1101229) - Added "php-composer(klaussilveira/gitter)" virtual provide -- cgit