diff options
author | CoprDistGit <infra@openeuler.org> | 2024-11-27 06:17:19 +0000 |
---|---|---|
committer | CoprDistGit <infra@openeuler.org> | 2024-11-27 06:17:19 +0000 |
commit | d7612666c8254912c85856b27e36f7aaee71d88b (patch) | |
tree | 5939ff4c0d471af73845d7f615396a5aefb088b1 | |
parent | 729634e1bbc04360bb86d8cf8ac71e9d1290d4f2 (diff) |
automatic import of composeropeneuler24.03_LTS
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | composer-bash-completion | 84 | ||||
-rw-r--r-- | composer-noxdg.patch | 14 | ||||
-rw-r--r-- | composer-rpm.patch | 45 | ||||
-rw-r--r-- | composer.csh | 9 | ||||
-rw-r--r-- | composer.sh | 11 | ||||
-rw-r--r-- | composer.spec | 225 | ||||
-rwxr-xr-x | makesrc.sh | 37 | ||||
-rw-r--r-- | sources | 1 |
9 files changed, 427 insertions, 0 deletions
@@ -0,0 +1 @@ +/composer-2.8.3-2a7c712.tgz diff --git a/composer-bash-completion b/composer-bash-completion new file mode 100644 index 0000000..4b7508d --- /dev/null +++ b/composer-bash-completion @@ -0,0 +1,84 @@ +# This file is part of the Symfony package. +# +# (c) Fabien Potencier <fabien@symfony.com> +# +# For the full copyright and license information, please view +# https://symfony.com/doc/current/contributing/code/license.html + +_sf_composer() { + # Use newline as only separator to allow space in completion values + local IFS=$'\n' + local sf_cmd="${COMP_WORDS[0]}" + + # for an alias, get the real script behind it + sf_cmd_type=$(type -t $sf_cmd) + if [[ $sf_cmd_type == "alias" ]]; then + sf_cmd=$(alias $sf_cmd | sed -E "s/alias $sf_cmd='(.*)'/\1/") + elif [[ $sf_cmd_type == "file" ]]; then + sf_cmd=$(type -p $sf_cmd) + fi + + if [[ $sf_cmd_type != "function" && ! -x $sf_cmd ]]; then + return 1 + fi + + 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.8.3") + for w in ${words[@]}; do + w=$(printf -- '%b' "$w") + # remove quotes from typed values + quote="${w:0:1}" + if [ "$quote" == \' ]; then + w="${w%\'}" + w="${w#\'}" + elif [ "$quote" == \" ]; then + w="${w%\"}" + w="${w#\"}" + fi + # empty values are ignored + if [ ! -z "$w" ]; then + completecmd+=("-i$w") + fi + done + + local sfcomplete + if sfcomplete=$(${completecmd[@]} 2>&1); then + local quote suggestions + quote=${cur:0:1} + + # Use single quotes by default if suggestions contains backslash (FQCN) + if [ "$quote" == '' ] && [[ "$sfcomplete" =~ \\ ]]; then + quote=\' + fi + + if [ "$quote" == \' ]; then + # single quotes: no additional escaping (does not accept ' in values) + suggestions=$(for s in $sfcomplete; do printf $'%q%q%q\n' "$quote" "$s" "$quote"; done) + elif [ "$quote" == \" ]; then + # double quotes: double escaping for \ $ ` " + suggestions=$(for s in $sfcomplete; do + s=${s//\\/\\\\} + s=${s//\$/\\\$} + s=${s//\`/\\\`} + s=${s//\"/\\\"} + printf $'%q%q%q\n' "$quote" "$s" "$quote"; + done) + else + # no quotes: double escaping + suggestions=$(for s in $sfcomplete; do printf $'%q\n' $(printf '%q' "$s"); done) + fi + COMPREPLY=($(IFS=$'\n' compgen -W "$suggestions" -- $(printf -- "%q" "$cur"))) + __ltrim_colon_completions "$cur" + else + if [[ "$sfcomplete" != *"Command \"_complete\" is not defined."* ]]; then + >&2 echo + >&2 echo $sfcomplete + fi + + return 1 + fi +} + +complete -F _sf_composer composer diff --git a/composer-noxdg.patch b/composer-noxdg.patch new file mode 100644 index 0000000..2927848 --- /dev/null +++ b/composer-noxdg.patch @@ -0,0 +1,14 @@ +diff -up ./src/Composer/Factory.php.noxdg ./src/Composer/Factory.php +--- ./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 partially implemented ++ // resulting in command/code in ~/.config ++ return false; ++ + foreach (array_keys($_SERVER) as $key) { + if (strpos((string) $key, 'XDG_') === 0) { + return true; diff --git a/composer-rpm.patch b/composer-rpm.patch new file mode 100644 index 0000000..fdc97ac --- /dev/null +++ b/composer-rpm.patch @@ -0,0 +1,45 @@ +diff -up ./bin/composer.rpm ./bin/composer +--- ./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/composer/src/bootstrap.php'; + + use Composer\Console\Application; + use Composer\XdebugHandler\XdebugHandler; +diff -up ./src/Composer/InstalledVersions.php.rpm ./src/Composer/InstalledVersions.php +--- ./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, + // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 +- if (substr(__DIR__, -8, 1) !== 'C') { ++ if (substr(__DIR__, -8, 1) !== 'C' && is_file(__DIR__ . '/installed.php')) { + self::$installed = include __DIR__ . '/installed.php'; + } else { + self::$installed = array(); +@@ -341,7 +341,7 @@ class InstalledVersions + if (null === self::$installed) { + // only require the installed.php file if this file is loaded from its dumped location, + // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 +- if (substr(__DIR__, -8, 1) !== 'C') { ++ if (substr(__DIR__, -8, 1) !== 'C' && is_file(__DIR__ . '/installed.php')) { + /** @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 ./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() + { +- $caBundleFile = __DIR__.'/../res/cacert.pem'; ++ $caBundleFile = '/etc/pki/tls/certs/ca-bundle.crt'; // System CA, always + + // cURL does not understand 'phar://' paths + // see https://github.com/composer/ca-bundle/issues/10 diff --git a/composer.csh b/composer.csh new file mode 100644 index 0000000..b57b1d0 --- /dev/null +++ b/composer.csh @@ -0,0 +1,9 @@ +# Composer initialization script + +# Add path to commands installed using "composer global require ..." +if ( ${euid} > 0 ) then + if ( "${path}" !~ *${HOME}/.composer/vendor/bin* ) then + set path = ( $path ${HOME}/.composer/vendor/bin ) + endif +endif + diff --git a/composer.sh b/composer.sh new file mode 100644 index 0000000..c75753c --- /dev/null +++ b/composer.sh @@ -0,0 +1,11 @@ +# Composer initialization script + +# Add path to commands installed using "composer global require ..." +if [ "${EUID:-0}" != "0" ]; then + case :$PATH: in + *:${HOME}/.composer/vendor/bin:*) ;; + *) PATH=$PATH:${HOME}/.composer/vendor/bin ;; + esac + export PATH +fi + 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 diff --git a/makesrc.sh b/makesrc.sh new file mode 100755 index 0000000..dc25efb --- /dev/null +++ b/makesrc.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +NAME=$(sed -n '/^Name:/{s/.* //;p}' *.spec) +OWNER=$(sed -n '/^%global gh_owner/{s/.* //;p}' $NAME.spec) +PROJECT=$(sed -n '/^%global gh_project/{s/.* //;p}' $NAME.spec) +VERSION=$(sed -n '/^%global upstream_version/{s/.* //;p}' $NAME.spec) +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 -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" + + echo "Cloning..." + git clone https://github.com/$OWNER/$PROJECT.git $PROJECT-$COMMIT + + echo "Getting commit..." + pushd $PROJECT-$COMMIT + git checkout $COMMIT || exit 1 + cp composer.json ../composer.json + composer config platform.php 7.2.5 + rm composer.lock + composer install --no-interaction --no-progress --no-dev --optimize-autoloader + cp vendor/composer/installed.json ../ + # bash completion + bin/composer completion bash >../composer-bash-completion + popd + + echo "Archiving..." + tar czf $NAME-$VERSION$PREVER-$SHORT.tgz --exclude .git $PROJECT-$COMMIT + + echo "Cleaning..." + rm -rf $PROJECT-$COMMIT +fi +echo "Done." @@ -0,0 +1 @@ +ea3a5cbbd5c986b38e83be1e7d036a56 composer-2.8.3-2a7c712.tgz |