diff options
author | Remi Collet <remi@remirepo.net> | 2024-10-30 10:23:21 +0100 |
---|---|---|
committer | Remi Collet <remi@php.net> | 2024-10-30 10:23:21 +0100 |
commit | 48f643512bd0bcbd877d766bceb3de299777925a (patch) | |
tree | 10f9ebf56015e5d67db13ecd53f81d3e088122df | |
parent | 7f8d1837b7c5ae330af120647b2daf2174c1519b (diff) |
keep upstream layout for simplicity
-rw-r--r-- | composer-noxdg.patch | 4 | ||||
-rw-r--r-- | composer-rpm.patch | 59 | ||||
-rw-r--r-- | composer.spec | 62 | ||||
-rwxr-xr-x | makesrc.sh | 6 |
4 files changed, 40 insertions, 91 deletions
diff --git a/composer-noxdg.patch b/composer-noxdg.patch index 8971527..2927848 100644 --- a/composer-noxdg.patch +++ b/composer-noxdg.patch @@ -1,11 +1,11 @@ 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 -@@ -680,6 +680,10 @@ class Factory +@@ -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; + diff --git a/composer-rpm.patch b/composer-rpm.patch index 52ed07b..fdc97ac 100644 --- a/composer-rpm.patch +++ b/composer-rpm.patch @@ -6,34 +6,10 @@ diff -up ./bin/composer.rpm ./bin/composer 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 2024-10-03 07:10:57.000000000 +0200 -+++ ./src/Composer/Autoload/AutoloadGenerator.php 2024-10-03 07:11:10.752092401 +0200 -@@ -458,7 +458,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 2024-10-03 07:10:57.000000000 +0200 -+++ ./src/Composer/Compiler.php 2024-10-03 07:11:10.752092401 +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 2024-10-03 07:10:57.000000000 +0200 +++ ./src/Composer/InstalledVersions.php 2024-10-03 07:11:10.752092401 +0200 @@ -55,36 +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 2024-10-03 07:11:10.752092401 +0200 -+++ ./src/Composer/Json/JsonFile.php 2024-10-03 07:14:54.219192080 +0200 -@@ -41,8 +41,8 @@ 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 LOCK_SCHEMA_PATH = __DIR__ . '/../../../res/composer-lock-schema.json'; -+ public const COMPOSER_SCHEMA_PATH = '/usr/share/composer/res/composer-schema.json'; -+ public const LOCK_SCHEMA_PATH = '/usr/share/composer/res/composer-lock-schema.json'; - - public const INDENT_DEFAULT = ' '; - -@@ -231,10 +231,10 @@ class JsonFile - $isComposerSchemaFile = false; - if (null === $schemaFile) { - if ($schema === self::LOCK_SCHEMA) { -- $schemaFile = self::LOCK_SCHEMA_PATH; -+ $schemaFile = (getenv('BUILDROOT')?:'') . self::LOCK_SCHEMA_PATH; - } else { - $isComposerSchemaFile = true; -- $schemaFile = self::COMPOSER_SCHEMA_PATH; -+ $schemaFile = (getenv('BUILDROOT')?:'') . self::COMPOSER_SCHEMA_PATH; - } - } - -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 2024-09-25 09:49:53.000000000 +0200 -+++ ./src/Composer/vendor/composer/ca-bundle/src/CaBundle.php 2024-10-03 07:11:10.752092401 +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 eaa3291..9a8bd33 100644 --- a/composer.spec +++ b/composer.spec @@ -32,7 +32,7 @@ Name: composer Version: %{upstream_version}%{?upstream_prever:~%{upstream_lower}} -Release: 2%{?dist} +Release: 3%{?dist} Summary: Dependency Manager for PHP # SPDX: composer and all dependencies are MIT @@ -167,27 +167,12 @@ Documentation: https://getcomposer.org/doc/ %patch -P1 -p1 -b .noxdg 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 -sed -e "s:../../vendor:vendor:" \ - -i src/Composer/Command/DiagnoseCommand.php src/Composer/Compiler.php +rm vendor/composer/ca-bundle/res/cacert.pem %if %{without generators} : 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"; @@ -213,7 +198,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); @@ -225,7 +210,7 @@ if (version_compare(Composer::RUNTIME_API_VERSION, "%{run_version}")) { %build -# Nothing +: Nothing to build %install @@ -234,32 +219,46 @@ install -Dpm 644 %{SOURCE1} %{buildroot}%{bashcompdir}/%{name} mkdir -p %{buildroot}%{_sysconfdir}/profile.d install -m 644 %{SOURCE3} %{SOURCE4} %{buildroot}%{_sysconfdir}/profile.d/ -: Library -mkdir -p %{buildroot}%{_datadir}/php -cp -pr src/* %{buildroot}%{_datadir}/php +: Library autoloader for compatibility +mkdir -p %{buildroot}%{_datadir}/php/Composer +ln -s ../../composer/vendor/autoload.php %{buildroot}%{_datadir}/php/Composer/autoload.php -: Resources -mkdir -p %{buildroot}%{_datadir}/%{name} -cp -pr res %{buildroot}%{_datadir}/%{name}/res -cp -p LICENSE %{buildroot}%{_datadir}/%{name}/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 src/Composer/vendor +cd vendor for lic in */*/LICENSE do dir=$(dirname $lic) own=$(dirname $dir) prj=$(basename $dir) - ln -sf ../../php/Composer/vendor/$own/$prj/LICENSE ../../../$own-$prj-LICENSE + 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 *.md +%doc doc %doc composer.json %config(noreplace) %{_sysconfdir}/profile.d/%{name}.* %{_bindir}/%{name} @@ -269,6 +268,9 @@ done %changelog +* Wed Oct 30 2024 Remi Collet <remi@remirepo.net> - 2.8.2-3 +- keep upstream layout for simplicity + * Wed Oct 30 2024 Remi Collet <remi@remirepo.net> - 2.8.2-2 - fix diagnose command @@ -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 |