summaryrefslogtreecommitdiffstats
path: root/composer.spec
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2022-01-25 11:02:30 +0100
committerRemi Collet <remi@php.net>2022-01-25 11:02:30 +0100
commit8832a066e80b1d4bcc29b8416eb8e8ea62353fea (patch)
tree7dbd0a193e3a1e77fdcf91abb9b2a9d82fbc2285 /composer.spec
parent7bea14415f5dce48e237625e191386403a888298 (diff)
use system libraries on Fedora, bundled libraries on EL
Diffstat (limited to 'composer.spec')
-rw-r--r--composer.spec104
1 files changed, 86 insertions, 18 deletions
diff --git a/composer.spec b/composer.spec
index 5d564bf..cd94aff 100644
--- a/composer.spec
+++ b/composer.spec
@@ -10,7 +10,13 @@
# For compatibility with SCL
%undefine __brp_mangle_shebangs
+%if 0%{?fedora}
%bcond_without tests
+%bcond_without syslib
+%else
+%bcond_with tests
+%bcond_with syslib
+%endif
%global gh_commit 22c41ef275c7bb64fa28fb2c0871a39666832cb9
%global gh_short %(c=%{gh_commit}; echo ${c:0:7})
@@ -32,9 +38,10 @@
Name: composer
Version: %{upstream_version}%{?upstream_prever:~%{upstream_lower}}
-Release: 1%{?dist}
+Release: 2%{?dist}
Summary: Dependency Manager for PHP
+# composer and all dependencies are MIT
License: MIT
URL: https://getcomposer.org/
Source0: %{gh_project}-%{upstream_version}%{?upstream_prever}-%{gh_short}.tgz
@@ -50,7 +57,10 @@ Patch0: %{name}-rpm.patch
Patch1: %{name}-noxdg.patch
BuildArch: noarch
+# platform set in makesrc.sh
+BuildRequires: php(language) >= 7.4
BuildRequires: php-cli
+BuildRequires: php-json
%if %{with tests}
# remirepo:1
%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8
@@ -60,8 +70,8 @@ BuildRequires: (php-composer(composer/semver) >= 3.0 with php-com
BuildRequires: (php-composer(composer/spdx-licenses) >= 1.2 with php-composer(composer/spdx-licenses) < 2)
BuildRequires: (php-composer(composer/xdebug-handler) >= 2.0 with php-composer(composer/xdebug-handler) < 3)
BuildRequires: (php-composer(seld/jsonlint) >= 1.4 with php-composer(seld/jsonlint) < 2)
-BuildRequires: (php-composer(seld/phar-utils) >= 1.0 with php-composer(seld/phar-utils) < 2)
-BuildRequires: (php-composer(psr/log) >= 1.0 with php-composer(psr/log) < 3)
+BuildRequires: (php-composer(seld/phar-utils) >= 1.1 with php-composer(seld/phar-utils) < 2)
+BuildRequires: (php-composer(psr/log) >= 1.1 with php-composer(psr/log) < 3)
BuildRequires: (php-composer(justinrainbow/json-schema) >= 5.2.11 with php-composer(justinrainbow/json-schema) < 6)
BuildRequires: (php-composer(react/promise) >= 2.7 with php-composer(react/promise) < 3)
BuildRequires: (php-composer(composer/pcre) >= 1.0 with php-composer(composer/pcre) < 2)
@@ -73,8 +83,8 @@ BuildRequires: php-composer-semver3
BuildRequires: php-composer-spdx-licenses >= 1.2
BuildRequires: php-composer-xdebug-handler2
BuildRequires: php-jsonlint >= 1.4
-BuildRequires: php-seld-phar-utils
-BuildRequires: php-PsrLog
+BuildRequires: php-seld-phar-utils >= 1.1
+BuildRequires: php-PsrLog >= 1.1
BuildRequires: php-justinrainbow-json-schema5 >= 5.2.11
BuildRequires: php-react-promise >= 2.7
BuildRequires: php-composer-pcre
@@ -90,8 +100,6 @@ BuildRequires: php-zip
BuildRequires: %{_phpunit}
# For autoloader
BuildRequires: php-fedora-autoloader-devel
-BuildRequires: php-seld-phar-utils >= 1.1
-BuildRequires: php-PsrLog >= 1.1
%endif
# From composer.json, "require": {
@@ -111,8 +119,9 @@ BuildRequires: php-PsrLog >= 1.1
# "symfony/process": "^^2.8.52 || ^3.4.35 || ^4.4 || ^5.0 || ^6.0",
# "react/promise": "^1.2 || ^2.7",
# "composer/pcre": "^1.0"
-Requires: php(language) >= 5.3.2
+Requires: php(language) >= 7.4
Requires: php-cli
+%if %{with syslib}
# remirepo:1
%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8
Requires: (php-composer(composer/ca-bundle) >= 1.0 with php-composer(composer/ca-bundle) < 2)
@@ -121,8 +130,8 @@ Requires: (php-composer(composer/semver) >= 3.0 with php-com
Requires: (php-composer(composer/spdx-licenses) >= 1.2 with php-composer(composer/spdx-licenses) < 2)
Requires: (php-composer(composer/xdebug-handler) >= 2.0 with php-composer(composer/xdebug-handler) < 3)
Requires: (php-composer(seld/jsonlint) >= 1.4 with php-composer(seld/jsonlint) < 2)
-Requires: (php-composer(seld/phar-utils) >= 1.0 with php-composer(seld/phar-utils) < 2)
-Requires: (php-composer(psr/log) >= 1.0 with php-composer(psr/log) < 3)
+Requires: (php-composer(seld/phar-utils) >= 1.1 with php-composer(seld/phar-utils) < 2)
+Requires: (php-composer(psr/log) >= 1.1 with php-composer(psr/log) < 3)
Requires: (php-composer(justinrainbow/json-schema) >= 5.2.11 with php-composer(justinrainbow/json-schema) < 6)
Requires: (php-composer(react/promise) >= 2.7 with php-composer(react/promise) < 3)
Requires: (php-composer(composer/pcre) >= 1.0 with php-composer(composer/pcre) < 2)
@@ -134,8 +143,8 @@ Requires: php-composer-semver3
Requires: php-composer-spdx-licenses >= 1.2
Requires: php-composer-xdebug-handler2
Requires: php-jsonlint >= 1.4
-Requires: php-seld-phar-utils
-Requires: php-PsrLog
+Requires: php-seld-phar-utils >= 1.1
+Requires: php-PsrLog >= 1.1
Requires: php-justinrainbow-json-schema5 >= 5.2.11
Requires: php-react-promise >= 2.7
Requires: php-composer-pcre
@@ -144,6 +153,38 @@ Requires: %{symfony_prefix}-console >= %{symfony_min}
Requires: %{symfony_prefix}-finder >= %{symfony_min}
Requires: %{symfony_prefix}-process >= %{symfony_min}
Requires: %{symfony_prefix}-filesystem >= %{symfony_min}
+# For our autoloader
+Requires: php-composer(fedora/autoloader)
+%else
+# System certificates
+Requires: ca-certificates
+# Bundled libraries
+Provides: bundled(php-composer-ca-bundle) = 1.3.1
+Provides: bundled(php-composer-metadata-minifier) = 1.0.0
+Provides: bundled(php-composer-pcre) = 1.0.1
+Provides: bundled(php-composer-semver) = 3.2.7
+Provides: bundled(php-composer-spdx-licenses) = 1.5.6
+Provides: bundled(php-composer-xdebug-handler) = 2.0.4
+Provides: bundled(php-justinrainbow-json-schema) = 5.2.11
+Provides: bundled(php-psr-container) = 1.1.2
+Provides: bundled(php-psr-log) = 1.1.4
+Provides: bundled(php-react-promise) = v2.8.0
+Provides: bundled(php-seld-jsonlint) = 1.8.3
+Provides: bundled(php-seld-phar-utils) = 1.2.0
+Provides: bundled(php-symfony-console) = v5.4.2
+Provides: bundled(php-symfony-deprecation-contracts) = v2.5.0
+Provides: bundled(php-symfony-filesystem) = v5.4.0
+Provides: bundled(php-symfony-finder) = v5.4.2
+Provides: bundled(php-symfony-polyfill-ctype) = v1.24.0
+Provides: bundled(php-symfony-polyfill-intl-grapheme) = v1.24.0
+Provides: bundled(php-symfony-polyfill-intl-normalizer) = v1.24.0
+Provides: bundled(php-symfony-polyfill-mbstring) = v1.24.0
+Provides: bundled(php-symfony-polyfill-php73) = v1.24.0
+Provides: bundled(php-symfony-polyfill-php80) = v1.24.0
+Provides: bundled(php-symfony-process) = v5.4.2
+Provides: bundled(php-symfony-service-contracts) = v2.5.0
+Provides: bundled(php-symfony-string) = v5.4.2
+%endif
# 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",
@@ -151,10 +192,6 @@ Requires: %{symfony_prefix}-filesystem >= %{symfony_min}
Requires: php-openssl
Requires: php-zip
Requires: php-zlib
-# For our autoloader
-Requires: php-composer(fedora/autoloader)
-Requires: php-seld-phar-utils >= 1.1
-Requires: php-PsrLog >= 1.1
# From phpcompatinfo for version 2.0.0
Requires: php-ctype
Requires: php-curl
@@ -202,6 +239,12 @@ if grep -r '\.\./res'; then
exit 1
fi
+rm src/bootstrap.php
+rm src/Composer/vendor/composer/ca-bundle/res/cacert.pem
+
+%if %{with syslib}
+rm -rf src/Composer/vendor
+
phpab --template fedora --output src/Composer/autoload.php src/Composer
cat << 'EOF' | tee -a src/Composer/autoload.php
@@ -233,8 +276,30 @@ require 'Composer/autoload.php';
\Fedora\Autoloader\Autoload::addPsr0('Composer\\Test\\', __DIR__ . '/');
EOF
-rm src/bootstrap.php
+%else
+: 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);
+ }
+ $lic = [];
+ foreach($pkgs["packages"] as $pkg) {
+ printf("Provides: bundled(php-%s) = %s\n", str_replace(["/", "_"], ["-", "-"], $pkg["name"]), $pkg["version"]);
+ $lic = array_merge($lic, $pkg["license"]);
+ }
+ sort($lic);
+ printf("\nLicense: %s\n\n", implode(" and ", array_unique($lic)));
+'
+%endif
: fix reported version
%if 0%{?gh_date}
@@ -288,7 +353,7 @@ install -Dpm 755 bin/%{name} %{buildroot}%{_bindir}/%{name}
%check
-%if %{with tests}
+%if %{with tests} && %{with syslib}
: Online tests
rm tests/Composer/Test/Util/RemoteFilesystemTest.php
@@ -336,6 +401,9 @@ exit $ret
%changelog
+* Tue Jan 25 2022 Remi Collet <remi@remirepo.net> - 2.2.5-2
+- use system libraries on Fedora, bundled libraries on EL
+
* Sat Jan 22 2022 Remi Collet <remi@remirepo.net> - 2.2.5-1
- update to 2.2.5