summaryrefslogtreecommitdiffstats
path: root/composer.spec
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2024-10-30 10:23:21 +0100
committerRemi Collet <remi@php.net>2024-10-30 10:23:21 +0100
commit48f643512bd0bcbd877d766bceb3de299777925a (patch)
tree10f9ebf56015e5d67db13ecd53f81d3e088122df /composer.spec
parent7f8d1837b7c5ae330af120647b2daf2174c1519b (diff)
keep upstream layout for simplicityHEADmaster
Diffstat (limited to 'composer.spec')
-rw-r--r--composer.spec62
1 files changed, 32 insertions, 30 deletions
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