diff options
Diffstat (limited to 'php-sensiolabs-security-checker.spec')
-rw-r--r-- | php-sensiolabs-security-checker.spec | 134 |
1 files changed, 134 insertions, 0 deletions
diff --git a/php-sensiolabs-security-checker.spec b/php-sensiolabs-security-checker.spec new file mode 100644 index 0000000..ffe9279 --- /dev/null +++ b/php-sensiolabs-security-checker.spec @@ -0,0 +1,134 @@ +# remirepo/fedora spec file for php-sensiolabs-security-checker +# +# Copyright (c) 2019 Remi Collet +# License: CC-BY-SA +# http://creativecommons.org/licenses/by-sa/4.0/ +# +# Please, preserve the changelog entries +# +# Github +%global gh_commit 46be3f58adac13084497961e10eed9a7fb4d44d1 +%global gh_short %(c=%{gh_commit}; echo ${c:0:7}) +%global gh_owner sensiolabs +%global gh_project security-checker +# Packagist +%global pk_vendor %{gh_owner} +%global pk_name %{gh_project} +# PSR-0 namespace +%global ns_vendor SensioLabs +%global ns_project Security + +Name: php-%{pk_vendor}-%{pk_name} +Version: 5.0.3 +Release: 1%{?dist} +Summary: A security checker for your composer.lock + +License: MIT +URL: https://github.com/%{gh_owner}/%{gh_project} +Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{name}-%{version}-%{gh_short}.tar.gz + +# Fix autoloader path +Patch0: %{name}-rpm.patch + +BuildArch: noarch +# Autoloader +BuildRequires: php-fedora-autoloader-devel +# For check +BuildRequires: php(language) >= 5.5.9 +BuildRequires: php-json +BuildRequires: php-pcre +BuildRequires: php-spl +BuildRequires: php-cli +# remirepo:1 +%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8 +BuildRequires: (php-composer(symfony/console) >= 2.7 with php-composer(symfony/console) < 5) +BuildRequires: (php-composer(composer/ca-bundle) >= 1.0 with php-composer(composer/ca-bundle) < 2) +# remirepo:5 +%else +BuildRequires: php-symfony3-console +BuildRequires: php-composer(composer/ca-bundle) < 2 +BuildRequires: php-composer(composer/ca-bundle) >= 1.0 +%endif + +# From composer.json, "require": { +# "php": ">=5.5.9", +# "symfony/console": "~2.7|~3.0|~4.0", +# "composer/ca-bundle": "^1.0" +Requires: php(language) >= 5.5.9 +# remirepo:1 +%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8 +Requires: (php-composer(symfony/console) >= 2.7 with php-composer(symfony/console) < 5) +Requires: (php-composer(composer/ca-bundle) >= 1.0 with php-composer(composer/ca-bundle) < 2) +# remirepo:5 +%else +Requires: php-symfony3-console +Requires: php-composer(composer/ca-bundle) < 2 +Requires: php-composer(composer/ca-bundle) >= 1.0 +%endif + +# From phpcompatifo report for 5.0.3 +Requires: php-json +Requires: php-pcre +Requires: php-spl +# Autoloader +Requires: php-composer(fedora/autoloader) + +Provides: php-composer(%{pk_vendor}/%{pk_name}) = %{version} + + +%description +The SensioLabs Security Checker is a command line tool that checks if your +application uses dependencies with known security vulnerabilities. It uses +the Security Check Web service and the Security Advisories Database. + +Autoloader: %{_datadir}/php/%{ns_vendor}/%{ns_project}/autoload.php + + +%prep +%setup -q -n %{gh_project}-%{gh_commit} +%patch0 -p1 -b .rpm + + +%build +: Generate a simple autoloader +%{_bindir}/phpab -t fedora -o %{ns_vendor}/%{ns_project}/autoload.php %{ns_vendor}/%{ns_project} + +cat << 'EOF' | tee -a %{ns_vendor}/%{ns_project}/autoload.php +\Fedora\Autoloader\Dependencies::required([ + [ + '%{_datadir}/php/Symfony4/Component/Console/autoload.php', + '%{_datadir}/php/Symfony3/Component/Console/autoload.php', + '%{_datadir}/php/Symfony/Component/Console/autoload.php', + ], + '%{_datadir}/php/Composer/CaBundle/autoload.php', +]); +EOF + + + +%install +mkdir -p %{buildroot}%{_datadir}/php +cp -pr %{ns_vendor} %{buildroot}%{_datadir}/php/%{ns_vendor} + +install -Dpm 755 security-checker %{buildroot}%{_bindir}/%{name} + + +%check +: Ensure our autoloader is ok. +sed -e 's:%{_datadir}:%{buildroot}%{_datadir}:' security-checker >test +%{_bindir}/php test --version + + +%files +# remirepo:1 +%{!?_licensedir:%global license %%doc} +%license LICENSE +%doc *.md +%doc composer.json +%{_datadir}/php/%{ns_vendor} +%{_bindir}/%{name} + + +%changelog +* Thu Jan 3 2019 Remi Collet <remi@remirepo.net> - 5.0.3-1 +- initial package, version 5.0.3 |