diff options
Diffstat (limited to 'composer.spec')
-rw-r--r-- | composer.spec | 225 |
1 files changed, 225 insertions, 0 deletions
diff --git a/composer.spec b/composer.spec new file mode 100644 index 0000000..c446f15 --- /dev/null +++ b/composer.spec @@ -0,0 +1,225 @@ +%undefine __brp_mangle_shebangs + +%global gh_commit 2a7c71266b2545a3bed9f4860734081963f6e688 +%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.8.3 + +%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 + +BuildArch: noarch +# platform set in makesrc.sh +BuildRequires: php(language) >= 7.2.5 +BuildRequires: php-cli +BuildRequires: php-json +BuildRequires: pkgconfig(bash-completion) + +Requires: php(language) >= 7.2.5 +Requires: php-cli +Supplements: php-cli +# System certificates +Requires: ca-certificates + +# From composer.json, suggest +# "ext-openssl": "Enabling the openssl extension allows you to access https URLs for repositories and packages", +# "ext-zip": "Enabling the zip extension allows you to unzip archives", +# "ext-zlib": "Allow gzip compression of HTTP requests" +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-json +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 + +# Bundled libraries +# License MIT +Provides: bundled(php-composer(composer/ca-bundle)) = 1.5.3 +Provides: bundled(php-composer(composer/class-map-generator)) = 1.4.0 +Provides: bundled(php-composer(composer/metadata-minifier)) = 1.0.0 +Provides: bundled(php-composer(composer/pcre)) = 2.3.2 +Provides: bundled(php-composer(composer/semver)) = 3.4.3 +Provides: bundled(php-composer(composer/spdx-licenses)) = 1.5.8 +Provides: bundled(php-composer(composer/xdebug-handler)) = 3.0.5 +Provides: bundled(php-composer(justinrainbow/json-schema)) = 5.3.0 +Provides: bundled(php-composer(psr/container)) = 1.1.1 +Provides: bundled(php-composer(psr/log)) = 1.1.4 +Provides: bundled(php-composer(react/promise)) = v3.2.0 +Provides: bundled(php-composer(seld/jsonlint)) = 1.11.0 +Provides: bundled(php-composer(seld/phar-utils)) = 1.2.1 +Provides: bundled(php-composer(seld/signal-handler)) = 2.0.2 +Provides: bundled(php-composer(symfony/console)) = v5.4.47 +Provides: bundled(php-composer(symfony/deprecation-contracts)) = v2.5.3 +Provides: bundled(php-composer(symfony/filesystem)) = v5.4.45 +Provides: bundled(php-composer(symfony/finder)) = v5.4.45 +Provides: bundled(php-composer(symfony/polyfill-ctype)) = v1.31.0 +Provides: bundled(php-composer(symfony/polyfill-intl-grapheme)) = v1.31.0 +Provides: bundled(php-composer(symfony/polyfill-intl-normalizer)) = v1.31.0 +Provides: bundled(php-composer(symfony/polyfill-mbstring)) = v1.31.0 +Provides: bundled(php-composer(symfony/polyfill-php73)) = v1.31.0 +Provides: bundled(php-composer(symfony/polyfill-php80)) = v1.31.0 +Provides: bundled(php-composer(symfony/polyfill-php81)) = v1.31.0 +Provides: bundled(php-composer(symfony/process)) = v5.4.47 +Provides: bundled(php-composer(symfony/service-contracts)) = v2.5.3 +Provides: bundled(php-composer(symfony/string)) = v5.4.47 +# 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 + +rm vendor/composer/ca-bundle/res/cacert.pem + +: List bundled libraries and Licenses +php -r ' + $pkgs = file_get_contents("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-composer(%s)) = %s", $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/bootstrap.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 to build + + +%install +: Profile scripts +install -Dpm 644 %{SOURCE1} %{buildroot}%{bashcompdir}/%{name} +mkdir -p %{buildroot}%{_sysconfdir}/profile.d +install -m 644 %{SOURCE3} %{SOURCE4} %{buildroot}%{_sysconfdir}/profile.d/ + +: Library autoloader for compatibility +mkdir -p %{buildroot}%{_datadir}/php/Composer +ln -s ../../composer/vendor/autoload.php %{buildroot}%{_datadir}/php/Composer/autoload.php + +: Sources +mkdir -p %{buildroot}%{_datadir}/%{name} +cp -pr src res vendor LICENSE\ + %{buildroot}%{_datadir}/%{name}/ + +: Command +install -Dpm 755 bin/%{name} %{buildroot}%{_bindir}/%{name} + +: Licenses +ln -sf ../../%{name}/LICENSE LICENSE +cd vendor +for lic in */*/LICENSE +do dir=$(dirname $lic) + own=$(dirname $dir) + prj=$(basename $dir) + ln -sf ../../composer/vendor/$own/$prj/LICENSE ../$own-$prj-LICENSE +done + +%check +: Check autoloader +php -r ' + include "%{buildroot}%{_datadir}/%{name}/src/bootstrap.php"; + exit (class_exists("Composer\\Composer") ? 0 : 1); +' +: Check compatibility autoloader +php -r ' + include "%{buildroot}%{_datadir}/php/Composer/autoload.php"; + exit (class_exists("Composer\\Composer") ? 0 : 2); +' + +%files +%license LICENSE +%doc *.md doc +%doc composer.json +%config(noreplace) %{_sysconfdir}/profile.d/%{name}.* +%{_bindir}/%{name} +%{_datadir}/php/Composer +%{_datadir}/%{name} +%{bashcomproot} + +%changelog +* Wed Nov 27 2024 Funda Wang <fundawang@yeah.net> - 2.8.3-1 +- Import package from Remi |