From 1ec4c2532d54db5322944465d7b37faa7d38a95f Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Mon, 10 Oct 2016 15:58:07 +0200 Subject: php-patchwork-jsqueeze; 2.0.5 (backported from Fedora) --- php-patchwork-jsqueeze.spec | 113 ++++++++++++++++++++++++++++++++++---------- 1 file changed, 87 insertions(+), 26 deletions(-) (limited to 'php-patchwork-jsqueeze.spec') diff --git a/php-patchwork-jsqueeze.spec b/php-patchwork-jsqueeze.spec index ce0b23e..2fb304f 100644 --- a/php-patchwork-jsqueeze.spec +++ b/php-patchwork-jsqueeze.spec @@ -1,15 +1,33 @@ -%global github_owner tchwork -%global github_name jsqueeze -%global github_version 2.0.3 -%global github_commit 074a7ac403d1fae262fd662c43c04b62d71c3e50 -%global packagist_owner patchwork -%global packagist_name jsqueeze -%global psr4_namespace Patchwork - -# phpci (uses namespacing) -%global php_min_ver 5.3.0 - -Name: php-%{packagist_owner}-%{packagist_name} +# remirepo spec file for php-patchwork-jsqueeze, from: +# +# Fedora spec file for php-patchwork-jsqueeze +# +# Copyright (c) 2016 Adam Williamson +# Shawn Iwinski +# +# License: MIT +# http://opensource.org/licenses/MIT +# +# Please preserve changelog entries +# + +%global github_owner tchwork +%global github_name jsqueeze +%global github_version 2.0.5 +%global github_commit 693d64850eab2ce6a7c8f7cf547e1ab46e69d542 + +%global composer_vendor patchwork +%global composer_project jsqueeze + +# "php": ">=5.3.0" +%global php_min_ver 5.3.0 + +# Build using "--without tests" to disable tests +%global with_tests 0%{!?_without_tests:1} + +%{!?phpdir: %global phpdir %{_datadir}/php} + +Name: php-%{composer_vendor}-%{composer_project} Version: %{github_version} Release: 1%{?dist} Summary: Efficient JavaScript minification @@ -17,24 +35,35 @@ Summary: Efficient JavaScript minification Group: Development/Libraries License: ASL 2.0 or GPLv2 URL: https://github.com/%{github_owner}/%{github_name} -# Must use commit-based not tag-based github tarball: -# https://fedoraproject.org/wiki/Packaging:SourceURL#Github -Source0: https://github.com/%{github_owner}/%{github_name}/archive/%{github_commit}/%{github_name}-%{github_commit}.tar.gz + +# GitHub export does not include tests. +# Run php-patchwork-jsqueeze.sh to create full source. +Source0: %{name}-%{github_version}-%{github_commit}.tar.gz +Source1: %{name}-get-source.sh BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch -# For tests +# Autoloader +BuildRequires: %{_bindir}/phpab +# Tests +%if %{with_tests} +## composer.json BuildRequires: php(language) >= %{php_min_ver} -BuildRequires: %{_bindir}/phpunit +BuildRequires: php-composer(phpunit/phpunit) +## phpcompatinfo (computed from version 2.0.5) +BuildRequires: php-pcre +%endif Requires: php(language) >= %{php_min_ver} +# phpcompatinfo (computed from version 2.0.5) Requires: php-pcre -Provides: php-composer(%{packagist_owner}/%{packagist_name}) = %{version} +Provides: php-composer(%{composer_vendor}/%{composer_project}) = %{version} %description JSqueeze shrinks / compresses / minifies / mangles Javascript code. + It's a single PHP class that is developed, maintained and thoroughly tested since 2003 on major JavaScript frameworks (e.g. jQuery). @@ -44,24 +73,49 @@ semi-colons are missing. In term of compression ratio, it compares to YUI Compressor and UglifyJS. +Autoloader: %{phpdir}/Patchwork/autoload-jsqueeze.php + %prep %setup -qn %{github_name}-%{github_commit} %build -# Empty build section, nothing required +: Generate autoloader +%{_bindir}/phpab --output src/autoload-jsqueeze.php src/ +cat src/autoload-jsqueeze.php %install rm -rf %{buildroot} -# use PSR-0 layout relative to _datadir/php -mkdir -p %{buildroot}%{_datadir}/php/%{psr4_namespace} -cp -pr src/* %{buildroot}%{_datadir}/php/%{psr4_namespace} + +mkdir -p %{buildroot}%{phpdir}/Patchwork +cp -pr src/* %{buildroot}%{phpdir}/Patchwork/ %check -%{_bindir}/phpunit +%if %{with_tests} +# remirepo:11 +run=0 +ret=0 +if which php56; then + php56 %{_bindir}/phpunit --bootstrap %{buildroot}%{phpdir}/Patchwork/autoload-jsqueeze.php + run=1 +fi +if which php71; then + php71 %{_bindir}/phpunit --bootstrap %{buildroot}%{phpdir}/Patchwork/autoload-jsqueeze.php + run=1 +fi +if [ $run -eq 0 ]; then +: Run upstream test suite +%{_bindir}/phpunit --verbose \ + --bootstrap %{buildroot}%{phpdir}/Patchwork/autoload-jsqueeze.php +# remirepo:2 +fi +exit $ret +%else +: Tests skipped +%endif %clean @@ -71,12 +125,19 @@ rm -rf %{buildroot} %files %defattr(-,root,root,-) %{!?_licensedir:%global license %%doc} -%license LICENSE.ASL20 LICENSE.GPLv2 -%doc README.md composer.json -%{_datadir}/php/%{psr4_namespace} +%license LICENSE.* +%doc *.md +%doc composer.json +%dir %{phpdir}/Patchwork + %{phpdir}/Patchwork/autoload-jsqueeze.php + %{phpdir}/Patchwork/JSqueeze.php %changelog +* Mon Oct 10 2016 Shawn Iwinski - 2.0.5-1 +- Update to 2.0.5 (RHBZ #1383300, #1383302) +- Add spec license + * Thu Oct 15 2015 Remi Collet - 2.0.2-2 - update to 2.0.3 -- cgit