summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--composer-add-huaweicloud-repository.patch14
-rw-r--r--composer-bash-completion4
-rw-r--r--composer-noxdg.patch10
-rw-r--r--composer-rpm.patch63
-rw-r--r--composer.spec140
-rwxr-xr-xmakesrc.sh6
-rw-r--r--sources2
8 files changed, 96 insertions, 144 deletions
diff --git a/.gitignore b/.gitignore
index 3a4e581..e3529a2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
/composer-2.6.2-623e5e1.tgz
+/composer-2.8.3-2a7c712.tgz
diff --git a/composer-add-huaweicloud-repository.patch b/composer-add-huaweicloud-repository.patch
deleted file mode 100644
index 2754820..0000000
--- a/composer-add-huaweicloud-repository.patch
+++ /dev/null
@@ -1,14 +0,0 @@
---- a/src/Composer/Config.php.orig 2023-02-25 11:59:19.951057271 +0800
-+++ b/src/Composer/Config.php 2023-02-25 12:03:48.490871158 +0800
-@@ -86,6 +86,11 @@
-
- /** @var array<string, mixed> */
- public static $defaultRepositories = [
-+ 'huaweicloud.com' => [
-+ 'type' => 'composer',
-+ 'url' => 'https://repo.huaweicloud.com/repository/php/',
-+ 'canonical' => false,
-+ ],
- 'packagist.org' => [
- 'type' => 'composer',
- 'url' => 'https://repo.packagist.org',
diff --git a/composer-bash-completion b/composer-bash-completion
index c75682d..4b7508d 100644
--- a/composer-bash-completion
+++ b/composer-bash-completion
@@ -7,7 +7,7 @@
_sf_composer() {
# Use newline as only separator to allow space in completion values
- IFS=$'\n'
+ local IFS=$'\n'
local sf_cmd="${COMP_WORDS[0]}"
# for an alias, get the real script behind it
@@ -25,7 +25,7 @@ _sf_composer() {
local cur prev words cword
_get_comp_words_by_ref -n := cur prev words cword
- local completecmd=("$sf_cmd" "_complete" "--no-interaction" "-sbash" "-c$cword" "-S2.6.2")
+ local completecmd=("$sf_cmd" "_complete" "--no-interaction" "-sbash" "-c$cword" "-S2.8.3")
for w in ${words[@]}; do
w=$(printf -- '%b' "$w")
# remove quotes from typed values
diff --git a/composer-noxdg.patch b/composer-noxdg.patch
index 73195e7..2927848 100644
--- a/composer-noxdg.patch
+++ b/composer-noxdg.patch
@@ -1,14 +1,14 @@
diff -up ./src/Composer/Factory.php.noxdg ./src/Composer/Factory.php
---- ./src/Composer/Factory.php.noxdg 2022-03-16 09:51:30.398977729 +0100
-+++ ./src/Composer/Factory.php 2022-03-16 09:52:14.113841110 +0100
-@@ -665,6 +665,10 @@ class Factory
+--- ./src/Composer/Factory.php.noxdg 2024-04-20 12:34:54.442117723 +0200
++++ ./src/Composer/Factory.php 2024-04-20 12:35:39.497640757 +0200
+@@ -702,6 +702,10 @@ class Factory
private static function useXdg(): bool
{
-+ // As XDG is very patially implemted
++ // As XDG is very partially implemented
+ // resulting in command/code in ~/.config
+ return false;
+
foreach (array_keys($_SERVER) as $key) {
- if (strpos($key, 'XDG_') === 0) {
+ if (strpos((string) $key, 'XDG_') === 0) {
return true;
diff --git a/composer-rpm.patch b/composer-rpm.patch
index 162dcdd..fdc97ac 100644
--- a/composer-rpm.patch
+++ b/composer-rpm.patch
@@ -1,42 +1,18 @@
diff -up ./bin/composer.rpm ./bin/composer
---- ./bin/composer.rpm 2023-09-01 11:05:16.000000000 +0200
-+++ ./bin/composer 2023-09-01 11:05:28.156309389 +0200
-@@ -11,7 +11,7 @@ if (PHP_VERSION_ID < 70205) {
+--- ./bin/composer.rpm 2024-10-03 07:10:57.000000000 +0200
++++ ./bin/composer 2024-10-03 07:11:10.751092365 +0200
+@@ -16,7 +16,7 @@ if (PHP_VERSION_ID < 70205) {
}
setlocale(LC_ALL, 'C');
-require __DIR__.'/../src/bootstrap.php';
-+require '/usr/share/php/Composer/autoload.php';
++require '/usr/share/composer/src/bootstrap.php';
use Composer\Console\Application;
use Composer\XdebugHandler\XdebugHandler;
-diff -up ./src/Composer/Autoload/AutoloadGenerator.php.rpm ./src/Composer/Autoload/AutoloadGenerator.php
---- ./src/Composer/Autoload/AutoloadGenerator.php.rpm 2023-09-01 11:05:16.000000000 +0200
-+++ ./src/Composer/Autoload/AutoloadGenerator.php 2023-09-01 11:05:28.156309389 +0200
-@@ -448,7 +448,7 @@ EOF;
- $filesystem->filePutContentsIfModified($targetDir.'/autoload_real.php', $this->getAutoloadRealFile(true, (bool) $includePathFileContents, $targetDirLoader, (bool) $includeFilesFileContents, $vendorPathCode, $appBaseDirCode, $suffix, $useGlobalIncludePath, $prependAutoloader, $checkPlatform));
-
- $filesystem->safeCopy(__DIR__.'/ClassLoader.php', $targetDir.'/ClassLoader.php');
-- $filesystem->safeCopy(__DIR__.'/../../../LICENSE', $targetDir.'/LICENSE');
-+ $filesystem->safeCopy((getenv('BUILDROOT')?:'') . '/usr/share/composer/LICENSE', $targetDir.'/LICENSE');
-
- if ($this->runScripts) {
- $this->eventDispatcher->dispatchScript(ScriptEvents::POST_AUTOLOAD_DUMP, $this->devMode, [], [
-diff -up ./src/Composer/Compiler.php.rpm ./src/Composer/Compiler.php
---- ./src/Composer/Compiler.php.rpm 2023-09-01 11:05:16.000000000 +0200
-+++ ./src/Composer/Compiler.php 2023-09-01 11:05:28.156309389 +0200
-@@ -105,7 +105,7 @@ class Compiler
- // Add Composer resources
- $finder = new Finder();
- $finder->files()
-- ->in(__DIR__.'/../../res')
-+ ->in((getenv('BUILDROOT')?:'') . '/usr/share/composer/res')
- ->sort($finderSort)
- ;
- foreach ($finder as $file) {
diff -up ./src/Composer/InstalledVersions.php.rpm ./src/Composer/InstalledVersions.php
---- ./src/Composer/InstalledVersions.php.rpm 2023-09-01 11:05:16.000000000 +0200
-+++ ./src/Composer/InstalledVersions.php 2023-09-01 11:05:28.156309389 +0200
+--- ./src/Composer/InstalledVersions.php.rpm 2024-10-03 07:10:57.000000000 +0200
++++ ./src/Composer/InstalledVersions.php 2024-10-03 07:11:10.752092401 +0200
@@ -266,7 +266,7 @@ class InstalledVersions
if (null === self::$installed) {
// only require the installed.php file if this file is loaded from its dumped location,
@@ -55,30 +31,9 @@ diff -up ./src/Composer/InstalledVersions.php.rpm ./src/Composer/InstalledVersio
/** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
$required = require __DIR__ . '/installed.php';
self::$installed = $required;
-diff -up ./src/Composer/Json/JsonFile.php.rpm ./src/Composer/Json/JsonFile.php
---- ./src/Composer/Json/JsonFile.php.rpm 2023-09-01 11:05:16.000000000 +0200
-+++ ./src/Composer/Json/JsonFile.php 2023-09-01 11:06:16.767233012 +0200
-@@ -40,7 +40,7 @@ class JsonFile
- /** @deprecated Use \JSON_UNESCAPED_UNICODE */
- public const JSON_UNESCAPED_UNICODE = 256;
-
-- public const COMPOSER_SCHEMA_PATH = __DIR__ . '/../../../res/composer-schema.json';
-+ public const COMPOSER_SCHEMA_PATH = '/usr/share/composer/res/composer-schema.json';
-
- public const INDENT_DEFAULT = ' ';
-
-@@ -229,7 +229,7 @@ class JsonFile
- $isComposerSchemaFile = false;
- if (null === $schemaFile) {
- $isComposerSchemaFile = true;
-- $schemaFile = self::COMPOSER_SCHEMA_PATH;
-+ $schemaFile = (getenv('BUILDROOT')?:'') . self::COMPOSER_SCHEMA_PATH;
- }
-
- // Prepend with file:// only when not using a special schema already (e.g. in the phar)
-diff -up ./src/Composer/vendor/composer/ca-bundle/src/CaBundle.php.rpm ./src/Composer/vendor/composer/ca-bundle/src/CaBundle.php
---- ./src/Composer/vendor/composer/ca-bundle/src/CaBundle.php.rpm 2023-08-30 11:31:38.000000000 +0200
-+++ ./src/Composer/vendor/composer/ca-bundle/src/CaBundle.php 2023-09-01 11:05:28.156309389 +0200
+diff -up ./vendor/composer/ca-bundle/src/CaBundle.php.rpm ./vendor/composer/ca-bundle/src/CaBundle.php
+--- ./vendor/composer/ca-bundle/src/CaBundle.php.rpm 2024-09-25 09:49:53.000000000 +0200
++++ ./vendor/composer/ca-bundle/src/CaBundle.php 2024-10-03 07:11:10.752092401 +0200
@@ -125,7 +125,7 @@ class CaBundle
*/
public static function getBundledCaBundlePath()
diff --git a/composer.spec b/composer.spec
index 8789216..c446f15 100644
--- a/composer.spec
+++ b/composer.spec
@@ -1,6 +1,6 @@
%undefine __brp_mangle_shebangs
-%global gh_commit 623e5e1de055e65bc6c3c61b8348dc4662d75e2b
+%global gh_commit 2a7c71266b2545a3bed9f4860734081963f6e688
%global gh_short %(c=%{gh_commit}; echo ${c:0:7})
%global gh_branch 2.0-dev
%global gh_owner composer
@@ -8,7 +8,7 @@
%global api_version 2.6.0
%global run_version 2.2.2
-%global upstream_version 2.6.2
+%global upstream_version 2.8.3
%global _phpunit %{_bindir}/phpunit9
%global bashcompdir %(pkg-config --variable=completionsdir bash-completion 2>/dev/null)
@@ -35,51 +35,24 @@ Source5: makesrc.sh
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: php-json
BuildRequires: pkgconfig(bash-completion)
-Requires: php(language) >= 7.2.5
+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
+# 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
@@ -92,6 +65,7 @@ Requires: php-filter
Requires: php-hash
Requires: php-iconv
Requires: php-intl
+Requires: php-json
Requires: php-libxml
Requires: php-mbstring
Requires: php-pcntl
@@ -104,8 +78,39 @@ 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}
@@ -122,23 +127,11 @@ Documentation: https://getcomposer.org/doc/
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
+rm vendor/composer/ca-bundle/res/cacert.pem
: List bundled libraries and Licenses
php -r '
- $pkgs = file_get_contents("src/Composer/vendor/composer/installed.json");
+ $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";
@@ -148,7 +141,7 @@ php -r '
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"]);
+ $res[$lic][] = sprintf("Provides: bundled(php-composer(%s)) = %s", $pkg["name"], $pkg["version"]);
}
foreach($res as $lic => $lib) {
sort($lib);
@@ -163,7 +156,7 @@ sed -e '/BRANCH_ALIAS_VERSION/s/@package_branch_alias_version@//' \
: check Plugin API version
php -r '
namespace Composer;
-include "src/Composer/autoload.php";
+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);
@@ -173,27 +166,49 @@ if (version_compare(Composer::RUNTIME_API_VERSION, "%{run_version}")) {
exit(1);
}'
-
%build
-# Nothing
+# 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/
-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
+: Library autoloader for compatibility
+mkdir -p %{buildroot}%{_datadir}/php/Composer
+ln -s ../../composer/vendor/autoload.php %{buildroot}%{_datadir}/php/Composer/autoload.php
-ln -sf %{_datadir}/%{name}/LICENSE LICENSE
+: 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
@@ -206,8 +221,5 @@ install -Dpm 755 bin/%{name} %{buildroot}%{_bindir}/%{name}
%{bashcomproot}
%changelog
-* Mon Sep 04 2023 Funda Wang <fundawang@yeah.net> - 2.6.2-1
-- New version 2.6.2
-
-* Mon Jul 10 2023 Funda Wang <fundawang@yeah.net> - 2.5.8-1
+* Wed Nov 27 2024 Funda Wang <fundawang@yeah.net> - 2.8.3-1
- Import package from Remi
diff --git a/makesrc.sh b/makesrc.sh
index cb5e069..dc25efb 100755
--- a/makesrc.sh
+++ b/makesrc.sh
@@ -8,7 +8,7 @@ PREVER=$(sed -n '/^%global upstream_prever/{s/.* //;p}' $NAME.spec)
COMMIT=$(sed -n '/^%global gh_commit/{s/.* //;p}' $NAME.spec)
SHORT=${COMMIT:0:7}
-if [ -f $NAME-$VERSION$PREVER-$SHORT.tgz ]; then
+if [ -f $NAME-$VERSION$PREVER-$SHORT.tgz -a "$1" != "-f" ]; then
echo skip $NAME-$VERSION$PREVER-$SHORT.tgz already here
else
echo -e "\nCreate git snapshot\nName=$NAME, Owner=$OWNER, Project=$PROJECT, Version=$VERSION$PREVER\n"
@@ -22,11 +22,9 @@ else
cp composer.json ../composer.json
composer config platform.php 7.2.5
rm composer.lock
- export COMPOSER_VENDOR_DIR=src/Composer/vendor
composer install --no-interaction --no-progress --no-dev --optimize-autoloader
- cp src/Composer/vendor/composer/installed.json ../
+ cp vendor/composer/installed.json ../
# bash completion
- ln -sf Composer/vendor/autoload.php src/bootstrap.php
bin/composer completion bash >../composer-bash-completion
popd
diff --git a/sources b/sources
index 5f5154e..a9a7c57 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-b3dc3f01102a654d0eb20df45ca06beb composer-2.6.2-623e5e1.tgz
+ea3a5cbbd5c986b38e83be1e7d036a56 composer-2.8.3-2a7c712.tgz