diff options
author | Remi Collet <remi@remirepo.net> | 2019-01-03 15:35:27 +0100 |
---|---|---|
committer | Remi Collet <remi@remirepo.net> | 2019-01-03 15:35:27 +0100 |
commit | 3ae5192e38b221e3dcc6089320e3806232c113e6 (patch) | |
tree | 7a52f0113a0cb9174a1a2b53ac540fb08a99cac5 |
new package
-rw-r--r-- | .gitignore | 8 | ||||
-rw-r--r-- | Makefile | 4 | ||||
-rw-r--r-- | composer.json | 25 | ||||
-rw-r--r-- | php-sensiolabs-security-checker-rpm.patch | 23 | ||||
-rw-r--r-- | php-sensiolabs-security-checker.spec | 134 |
5 files changed, 194 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fc9aa8c --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +clog +package-*.xml +*.tgz +*.tar.gz +*.tar.xz +*.tar.xz.asc +*.src.rpm +*/*rpm diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..13af741 --- /dev/null +++ b/Makefile @@ -0,0 +1,4 @@ +SRCDIR := $(shell pwd) +NAME := $(shell basename $(SRCDIR)) +include ../../../common/Makefile + diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..15dfbe9 --- /dev/null +++ b/composer.json @@ -0,0 +1,25 @@ +{ + "name": "sensiolabs/security-checker", + "description": "A security checker for your composer.lock", + "license": "MIT", + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien.potencier@gmail.com" + } + ], + "require": { + "php": ">=5.5.9", + "symfony/console": "~2.7|~3.0|~4.0", + "composer/ca-bundle": "^1.0" + }, + "bin": ["security-checker"], + "autoload": { + "psr-4": { "SensioLabs\\Security\\": "SensioLabs/Security" } + }, + "extra": { + "branch-alias": { + "dev-master": "5.0-dev" + } + } +} diff --git a/php-sensiolabs-security-checker-rpm.patch b/php-sensiolabs-security-checker-rpm.patch new file mode 100644 index 0000000..11bfe26 --- /dev/null +++ b/php-sensiolabs-security-checker-rpm.patch @@ -0,0 +1,23 @@ +diff -up ./security-checker.rpm ./security-checker +--- ./security-checker.rpm 2019-01-03 15:15:49.655195809 +0100 ++++ ./security-checker 2019-01-03 15:16:46.561441553 +0100 +@@ -10,18 +10,7 @@ + * file that was distributed with this source code. + */ + +-function includeIfExists($file) +-{ +- if (file_exists($file)) { +- return include $file; +- } +-} +- +-if ((!$loader = includeIfExists(__DIR__.'/vendor/autoload.php')) && (!$loader = includeIfExists(__DIR__.'/../../autoload.php'))) { +- die('You must set up the project dependencies, run the following commands:'.PHP_EOL. +- 'curl -sS https://getcomposer.org/installer | php'.PHP_EOL. +- 'php composer.phar install'.PHP_EOL); +-} ++require_once '/usr/share/php/SensioLabs/Security/autoload.php'; + + use Symfony\Component\Console\Application; + use SensioLabs\Security\Command\SecurityCheckerCommand; 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 |