3 %bcond_without tests # build with tests
5 %define php_min_version 5.3.4
6 %include /usr/lib/rpm/macros.php
7 Summary: Dependency Manager for PHP
12 Group: Development/Languages/PHP
13 Source0: https://github.com/composer/composer/archive/%{version}/%{name}-%{version}.tar.gz
14 # Source0-md5: 1c336fab95612c2c888bd61bbacccac5
15 Source2: https://raw.githubusercontent.com/iArren/%{name}-bash-completion/86a8129/composer
16 # Source2-md5: cdeebf0a0da1fd07d0fd886d0461642e
18 Patch0: autoload.patch
19 Patch1: update-memory-limit.patch
20 Patch2: svn-ignore-externals.patch
21 URL: http://www.getcomposer.org/
22 BuildRequires: php-devel
23 BuildRequires: rpm-php-pearprov >= 4.4.2-11
24 BuildRequires: rpmbuild(macros) >= 1.673
26 # instead of filling duplicate deps for running tests,
27 # update composer version that have neccessary runtime dependencies
28 BuildRequires: composer >= 1.4.0
29 BuildRequires: git-core
31 BuildRequires: phpunit
33 Requires: php(core) >= %{php_min_version}
39 Requires: php(openssl)
44 Requires: php(simplexml)
48 Requires: php-composer-ca-bundle >= 1.0.2
49 Requires: php-composer-semver >= 1.0.0
50 Requires: php-composer-spdx-licenses >= 1.0.0
51 Requires: php-justinrainbow-json-schema >= 3.0
52 Requires: php-psr-Log >= 1.0
53 Requires: php-seld-cli-prompt >= 1.0.0
54 Requires: php-seld-jsonlint >= 1.4
55 Requires: php-seld-phar-utils >= 1.0.0
56 Requires: php-symfony2-ClassLoader >= 2.7.7
57 Requires: php-symfony2-Console >= 2.7.7
58 Requires: php-symfony2-Finder >= 2.7.7
59 Requires: php-symfony2-Process >= 2.7.7
60 Suggests: bash-completion-%{name}
64 Conflicts: satis < 1.0.0-1.alpha1.193
66 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
69 Composer is a tool for dependency management in PHP.
71 Composer helps you declare, manage and install dependencies of PHP
72 projects, ensuring you have the right stack everywhere.
74 %package -n bash-completion-%{name}
75 Summary: Bash completion for Composer
76 Summary(pl.UTF-8): bashowe uzupełnianie nazw dla Composera
77 Group: Applications/Shells
79 Requires: bash-completion >= 2.0
81 %description -n bash-completion-%{name}
82 Bash completion for Composer package and dependency manager.
84 %description -n bash-completion-%{name} -l pl.UTF-8
85 Pakiet ten dostarcza bashowe uzupełnianie nazw dla Composera.
93 mv composer.lock{,.disabled}
94 # NOTE: do not use %{__php} macro here, need unversioned php binary
95 %{__sed} -i -e '1s,^#!.*env php,#!/usr/bin/php,' bin/*
97 cp -p %{SOURCE3} src/Composer/autoload.php
99 # AutoloadGenerator needs this runtime
102 # move to Composer dir, this will simplify testing
104 ln -s src/Composer/res
106 # cleanup backups after patching
107 find '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 rm -f
109 # needs newer phpunit:
110 # missing method PHPUnit_Framework_MockObject_Builder_InvocationMocker::willReturn()
111 rm tests/Composer/Test/ApplicationTest.php
112 rm tests/Composer/Test/EventDispatcher/EventDispatcherTest.php
113 rm tests/Composer/Test/IO/ConsoleIOTest.php
114 rm tests/Composer/Test/Package/Loader/RootPackageLoaderTest.php
115 rm tests/Composer/Test/Package/RootAliasPackageTest.php
116 rm tests/Composer/Test/Package/Version/VersionGuesserTest.php
117 rm tests/Composer/Test/Repository/ComposerRepositoryTest.php
118 rm tests/Composer/Test/Repository/Vcs/GitBitbucketDriverTest.php
119 rm tests/Composer/Test/Util/GitHubTest.php
120 rm tests/Composer/Test/Util/GitLabTest.php
121 # method PHPUnit_Framework_MockObject_Builder_InvocationMocker::withConsecutive()
122 rm tests/Composer/Test/Util/BitbucketTest.php
123 # Call to undefined method Composer\Test\Repository\Vcs\GitLabDriverTest::prophesize()
124 rm tests/Composer/Test/Repository/Vcs/GitLabDriverTest.php
125 # Mocked method does not exist.
126 rm tests/Composer/Test/Installer/LibraryInstallerTest.php
127 # Uncaught Error: Call to undefined method Mock_InputInterface_0ced1568::method()
128 rm tests/Composer/Test/Command/RunScriptCommandTest.php
129 # PHP Fatal error: Call to undefined method Mock_Config_0d97cb71::method()
130 rm tests/Composer/Test/Util/RemoteFilesystemTest.php
134 phpab -n -o src/bootstrap.php -e '*/Fixtures/*' src/ tests/
135 echo "require 'src/Composer/autoload.php';" >> src/bootstrap.php
140 rm -rf $RPM_BUILD_ROOT
141 install -d $RPM_BUILD_ROOT{%{_bindir},%{php_data_dir}/Composer,/var/cache/composer}
142 cp -a src/Composer $RPM_BUILD_ROOT%{php_data_dir}
143 install -p bin/composer $RPM_BUILD_ROOT%{_bindir}/%{name}
145 install -d $RPM_BUILD_ROOT%{bash_compdir}
146 cp -p %{SOURCE2} $RPM_BUILD_ROOT%{bash_compdir}/composer
149 rm -rf $RPM_BUILD_ROOT
152 %defattr(644,root,root,755)
153 %doc README.md CHANGELOG.md PORTING_INFO
154 %doc src/Composer/res/LICENSE
155 %attr(755,root,root) %{_bindir}/composer
156 %{php_data_dir}/Composer
158 # top level cachedir, create user cache dirs here manually
159 %dir %attr(711,root,http) /var/cache/composer
161 %files -n bash-completion-%{name}
162 %defattr(644,root,root,755)
163 %{bash_compdir}/composer