%undefine __brp_mangle_shebangs %global gh_commit 623e5e1de055e65bc6c3c61b8348dc4662d75e2b %global gh_short %(c=%{gh_commit}; echo ${c:0:7}) %global gh_branch 2.0-dev %global gh_owner composer %global gh_project composer %global api_version 2.6.0 %global run_version 2.2.2 %global upstream_version 2.6.2 %global _phpunit %{_bindir}/phpunit9 %global bashcompdir %(pkg-config --variable=completionsdir bash-completion 2>/dev/null) %global bashcomproot %(dirname %{bashcompdir} 2>/dev/null) Name: composer Version: %{upstream_version} Release: 1 Summary: Dependency Manager for PHP # SPDX: composer and all dependencies are MIT License: MIT URL: https://getcomposer.org/ Source0: %{gh_project}-%{upstream_version}-%{gh_short}.tgz # Profile scripts Source1: %{name}-bash-completion Source3: %{name}.sh Source4: %{name}.csh # Get a git snapshot to retrieve the test suite Source5: makesrc.sh # Use our autoloader, resources path, fix for tests Patch0: %{name}-rpm.patch # Disable XDG support as only partially implemented Patch1: %{name}-noxdg.patch # Use Huaweicloud mirror by default Patch10: composer-add-huaweicloud-repository.patch BuildArch: noarch # platform set in makesrc.sh BuildRequires: php(language) >= 7.2.5 BuildRequires: php-cli BuildRequires: pkgconfig(bash-completion) Requires: php(language) >= 7.2.5 Requires: php-cli Supplements: php-cli # System certificates Requires: ca-certificates # Bundled libraries # License MIT Provides: bundled(php-composer-ca-bundle) = 1.3.7 Provides: bundled(php-composer-class-map-generator) = 1.1.0 Provides: bundled(php-composer-metadata-minifier) = 1.0.0 Provides: bundled(php-composer-pcre) = 2.1.0 Provides: bundled(php-composer-semver) = 3.4.0 Provides: bundled(php-composer-spdx-licenses) = 1.5.7 Provides: bundled(php-composer-xdebug-handler) = 3.0.3 Provides: bundled(php-justinrainbow-json-schema) = 5.2.12 Provides: bundled(php-psr-container) = 1.1.1 Provides: bundled(php-psr-log) = 1.1.4 Provides: bundled(php-react-promise) = v3.0.0 Provides: bundled(php-seld-jsonlint) = 1.10.0 Provides: bundled(php-seld-phar-utils) = 1.2.1 Provides: bundled(php-seld-signal-handler) = 2.0.2 Provides: bundled(php-symfony-console) = v5.4.28 Provides: bundled(php-symfony-deprecation-contracts) = v2.5.2 Provides: bundled(php-symfony-filesystem) = v5.4.25 Provides: bundled(php-symfony-finder) = v5.4.27 Provides: bundled(php-symfony-polyfill-ctype) = v1.28.0 Provides: bundled(php-symfony-polyfill-intl-grapheme) = v1.28.0 Provides: bundled(php-symfony-polyfill-intl-normalizer) = v1.28.0 Provides: bundled(php-symfony-polyfill-mbstring) = v1.28.0 Provides: bundled(php-symfony-polyfill-php73) = v1.28.0 Provides: bundled(php-symfony-polyfill-php80) = v1.28.0 Provides: bundled(php-symfony-polyfill-php81) = v1.28.0 Provides: bundled(php-symfony-process) = v5.4.28 Provides: bundled(php-symfony-service-contracts) = v2.5.2 Provides: bundled(php-symfony-string) = v5.4.26 Requires: php-openssl Requires: php-zip Requires: php-zlib # From phpcompatinfo for version 2.2.5 Requires: php-ctype Requires: php-curl Requires: php-date Requires: php-dom Requires: php-filter Requires: php-hash Requires: php-iconv Requires: php-intl Requires: php-libxml Requires: php-mbstring Requires: php-pcntl Requires: php-pcre Requires: php-phar Requires: php-posix Requires: php-reflection Requires: php-spl Requires: php-tokenizer Requires: php-xsl Requires: php-zlib # Composer library Provides: php-composer(composer/composer) = %{version} # Special internal for Plugin API Provides: php-composer(composer-plugin-api) = %{api_version} Provides: php-composer(composer-runtime-api) = %{run_version} %description Composer helps you declare, manage and install dependencies of PHP projects, ensuring you have the right stack everywhere. Documentation: https://getcomposer.org/doc/ %prep %autosetup -p1 -n %{gh_project}-%{gh_commit} find . \( -name \*.rpm -o -name \*noxdg \) -delete -print if grep -r '\.\./res'; then : Patch need to fixed exit 1 fi rm src/bootstrap.php rm src/Composer/vendor/composer/ca-bundle/res/cacert.pem : symlink autoloader for library ln -s vendor/autoload.php src/Composer/autoload.php : fix layout sed -e "s:/../..' . '/src/Composer::" -i src/Composer/vendor/composer/autoload_static.php : List bundled libraries and Licenses php -r ' $pkgs = file_get_contents("src/Composer/vendor/composer/installed.json"); $pkgs = json_decode($pkgs, true); if (!is_array($pkgs) || !isset($pkgs["packages"])) { echo "cant decode json file\n"; exit(3); } $res = []; foreach($pkgs["packages"] as $pkg) { $lic = implode(" and ", $pkg["license"]); if (!isset($res[$lic])) $res[$lic] = []; $res[$lic][] = sprintf("Provides: bundled(php-%s) = %s", str_replace(["/", "_"], ["-", "-"], $pkg["name"]), $pkg["version"]); } foreach($res as $lic => $lib) { sort($lib); printf("# License %s\n%s\n", $lic, implode("\n", $lib)); } ' : fix reported version sed -e '/BRANCH_ALIAS_VERSION/s/@package_branch_alias_version@//' \ -i src/Composer/Composer.php : check Plugin API version php -r ' namespace Composer; include "src/Composer/autoload.php"; if (version_compare(Plugin\PluginInterface::PLUGIN_API_VERSION, "%{api_version}")) { printf("Plugin API version is %s, expected %s\n", Plugin\PluginInterface::PLUGIN_API_VERSION, "%{api_version}"); exit(1); } if (version_compare(Composer::RUNTIME_API_VERSION, "%{run_version}")) { printf("Runtime API version is %s, expected %s\n", Composer::RUNTIME_API_VERSION, "%{run_version}"); exit(1); }' %build # Nothing %install install -Dpm 644 %{SOURCE1} %{buildroot}%{bashcompdir}/%{name} mkdir -p %{buildroot}%{_sysconfdir}/profile.d install -m 644 %{SOURCE3} %{SOURCE4} %{buildroot}%{_sysconfdir}/profile.d/ mkdir -p %{buildroot}%{_datadir}/php cp -pr src/* %{buildroot}%{_datadir}/php mkdir -p %{buildroot}%{_datadir}/%{name} cp -pr res %{buildroot}%{_datadir}/%{name}/res cp -p LICENSE %{buildroot}%{_datadir}/%{name}/LICENSE ln -sf %{_datadir}/%{name}/LICENSE LICENSE install -Dpm 755 bin/%{name} %{buildroot}%{_bindir}/%{name} %files %license LICENSE %doc *.md doc %doc composer.json %config(noreplace) %{_sysconfdir}/profile.d/%{name}.* %{_bindir}/%{name} %{_datadir}/php/Composer %{_datadir}/%{name} %{bashcomproot} %changelog * Mon Sep 04 2023 Funda Wang - 2.6.2-1 - New version 2.6.2 * Mon Jul 10 2023 Funda Wang - 2.5.8-1 - Import package from Remi