From 091e1cbfa5410d7f763e9375ed19c200affda944 Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@remirepo.net>
Date: Fri, 11 Oct 2024 15:30:46 +0200
Subject: use composer-generators

---
 composer.spec | 72 ++++++++++++++++++++++++++++++++++-------------------------
 1 file changed, 41 insertions(+), 31 deletions(-)

diff --git a/composer.spec b/composer.spec
index 35b658e..76785dc 100644
--- a/composer.spec
+++ b/composer.spec
@@ -7,9 +7,12 @@
 # Please, preserve the changelog entries
 #
 
+# remirepo:2
 # For compatibility with SCL
 %undefine __brp_mangle_shebangs
 
+%bcond_with          generators
+
 %global gh_commit    e52b8672276cf436670cdd6bd5de4353740e83b2
 %global gh_short     %(c=%{gh_commit}; echo ${c:0:7})
 %global gh_branch    2.0-dev
@@ -40,7 +43,7 @@ Source0:        %{gh_project}-%{upstream_version}%{?upstream_prever}-%{gh_short}
 Source1:        %{name}-bash-completion
 Source3:        %{name}.sh
 Source4:        %{name}.csh
-# Get a git snapshot to retrieve the test suite
+# Create a git snapshot with dependencies
 Source5:        makesrc.sh
 
 # Use our autoloader, resources path, fix for tests
@@ -54,6 +57,9 @@ BuildRequires:  php(language) >= 7.2.5
 BuildRequires:  php-cli
 BuildRequires:  php-json
 BuildRequires:  pkgconfig(bash-completion)
+%if %{with generators}
+BuildRequires:  composer-generators
+%endif
 
 # From composer.json, "require": {
 #        "php": "^7.2.5 || ^8.0",
@@ -78,36 +84,6 @@ Requires:       php(language)                           >= 7.2.5
 Requires:       php-cli
 # System certificates
 Requires:       ca-certificates
-# Bundled libraries
-# License MIT
-Provides:       bundled(php-composer-ca-bundle) = 1.5.2
-Provides:       bundled(php-composer-class-map-generator) = 1.4.0
-Provides:       bundled(php-composer-metadata-minifier) = 1.0.0
-Provides:       bundled(php-composer-pcre) = 2.3.1
-Provides:       bundled(php-composer-semver) = 3.4.3
-Provides:       bundled(php-composer-spdx-licenses) = 1.5.8
-Provides:       bundled(php-composer-xdebug-handler) = 3.0.5
-Provides:       bundled(php-justinrainbow-json-schema) = 5.3.0
-Provides:       bundled(php-psr-container) = 1.1.1
-Provides:       bundled(php-psr-log) = 1.1.4
-Provides:       bundled(php-react-promise) = v3.2.0
-Provides:       bundled(php-seld-jsonlint) = 1.11.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.44
-Provides:       bundled(php-symfony-deprecation-contracts) = v2.5.3
-Provides:       bundled(php-symfony-filesystem) = v5.4.44
-Provides:       bundled(php-symfony-finder) = v5.4.43
-Provides:       bundled(php-symfony-polyfill-ctype) = v1.31.0
-Provides:       bundled(php-symfony-polyfill-intl-grapheme) = v1.31.0
-Provides:       bundled(php-symfony-polyfill-intl-normalizer) = v1.31.0
-Provides:       bundled(php-symfony-polyfill-mbstring) = v1.31.0
-Provides:       bundled(php-symfony-polyfill-php73) = v1.31.0
-Provides:       bundled(php-symfony-polyfill-php80) = v1.31.0
-Provides:       bundled(php-symfony-polyfill-php81) = v1.31.0
-Provides:       bundled(php-symfony-process) = v5.4.44
-Provides:       bundled(php-symfony-service-contracts) = v2.5.3
-Provides:       bundled(php-symfony-string) = v5.4.44
 
 # From composer.json, suggest
 #        "ext-openssl": "Enabling the openssl extension allows you to access https URLs for repositories and packages",
@@ -138,8 +114,40 @@ Requires:       php-tokenizer
 Requires:       php-xsl
 Requires:       php-zlib
 
+# Bundled libraries
+%if %{without generators}
+# License MIT
+Provides:       bundled(php-composer-ca-bundle) = 1.5.2
+Provides:       bundled(php-composer-class-map-generator) = 1.4.0
+Provides:       bundled(php-composer-metadata-minifier) = 1.0.0
+Provides:       bundled(php-composer-pcre) = 2.3.1
+Provides:       bundled(php-composer-semver) = 3.4.3
+Provides:       bundled(php-composer-spdx-licenses) = 1.5.8
+Provides:       bundled(php-composer-xdebug-handler) = 3.0.5
+Provides:       bundled(php-justinrainbow-json-schema) = 5.3.0
+Provides:       bundled(php-psr-container) = 1.1.1
+Provides:       bundled(php-psr-log) = 1.1.4
+Provides:       bundled(php-react-promise) = v3.2.0
+Provides:       bundled(php-seld-jsonlint) = 1.11.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.44
+Provides:       bundled(php-symfony-deprecation-contracts) = v2.5.3
+Provides:       bundled(php-symfony-filesystem) = v5.4.44
+Provides:       bundled(php-symfony-finder) = v5.4.43
+Provides:       bundled(php-symfony-polyfill-ctype) = v1.31.0
+Provides:       bundled(php-symfony-polyfill-intl-grapheme) = v1.31.0
+Provides:       bundled(php-symfony-polyfill-intl-normalizer) = v1.31.0
+Provides:       bundled(php-symfony-polyfill-mbstring) = v1.31.0
+Provides:       bundled(php-symfony-polyfill-php73) = v1.31.0
+Provides:       bundled(php-symfony-polyfill-php80) = v1.31.0
+Provides:       bundled(php-symfony-polyfill-php81) = v1.31.0
+Provides:       bundled(php-symfony-process) = v5.4.44
+Provides:       bundled(php-symfony-service-contracts) = v2.5.3
+Provides:       bundled(php-symfony-string) = v5.4.44
 # Composer library
 Provides:       php-composer(composer/composer) = %{version}
+%endif
 # Special internal for Plugin API
 Provides:       php-composer(composer-plugin-api) = %{api_version}
 Provides:       php-composer(composer-runtime-api) = %{run_version}
@@ -173,6 +181,7 @@ ln -s vendor/autoload.php src/Composer/autoload.php
 : fix layout
 sed -e "s:/../..' . '/src/Composer::" -i src/Composer/vendor/composer/autoload_static.php
 
+%if %{without generators}
 : List bundled libraries and Licenses
 php -r '
 	$pkgs = file_get_contents("src/Composer/vendor/composer/installed.json");
@@ -192,6 +201,7 @@ php -r '
 		printf("# License %s\n%s\n", $lic, implode("\n", $lib));
 	}
 '
+%endif
 
 : fix reported version
 sed -e '/BRANCH_ALIAS_VERSION/s/@package_branch_alias_version@//' \
-- 
cgit