summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--composer.spec12
-rwxr-xr-xmakesrc.sh3
2 files changed, 14 insertions, 1 deletions
diff --git a/composer.spec b/composer.spec
index b12715f..9acb522 100644
--- a/composer.spec
+++ b/composer.spec
@@ -35,10 +35,13 @@
%global symfony_min 5.4.1
%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}%{?upstream_prever:~%{upstream_lower}}
-Release: 1%{?dist}
+Release: 2%{?dist}
Summary: Dependency Manager for PHP
# composer and all dependencies are MIT
@@ -46,6 +49,7 @@ License: MIT
URL: https://getcomposer.org/
Source0: %{gh_project}-%{upstream_version}%{?upstream_prever}-%{gh_short}.tgz
# Profile scripts
+Source1: %{name}-bash-completion
Source3: %{name}.sh
Source4: %{name}.csh
# Get a git snapshot to retrieve the test suite
@@ -61,6 +65,7 @@ BuildArch: noarch
BuildRequires: php(language) >= 7.2.5
BuildRequires: php-cli
BuildRequires: php-json
+BuildRequires: pkgconfig(bash-completion)
%if %{with tests}
# remirepo:1
%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8
@@ -347,6 +352,7 @@ if (version_compare(Composer::RUNTIME_API_VERSION, "%{run_version}")) {
%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/
@@ -414,9 +420,13 @@ exit $ret
%{_bindir}/%{name}
%{_datadir}/php/Composer
%{_datadir}/%{name}
+%{bashcomproot}
%changelog
+* Wed Jun 22 2022 Remi Collet <remi@remirepo.net> - 2.3.7-2
+- add bash completion file
+
* Tue Jun 7 2022 Remi Collet <remi@remirepo.net> - 2.3.7-1
- update to 2.3.7
diff --git a/makesrc.sh b/makesrc.sh
index 930ec0b..cb5e069 100755
--- a/makesrc.sh
+++ b/makesrc.sh
@@ -25,6 +25,9 @@ else
export COMPOSER_VENDOR_DIR=src/Composer/vendor
composer install --no-interaction --no-progress --no-dev --optimize-autoloader
cp src/Composer/vendor/composer/installed.json ../
+ # bash completion
+ ln -sf Composer/vendor/autoload.php src/bootstrap.php
+ bin/composer completion bash >../composer-bash-completion
popd
echo "Archiving..."