From cb0763556086a07240cccdc75fd3f5897e490ce1 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Fri, 30 Dec 2016 07:27:59 +0100 Subject: php-Assetic: 1.4.0 (backported from Fedora) --- composer.json | 56 ++++++++++++++++++++++++ php-Assetic-get-source.sh | 4 +- php-Assetic.spec | 107 +++++++++++++++++++--------------------------- 3 files changed, 103 insertions(+), 64 deletions(-) create mode 100644 composer.json diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..80755d7 --- /dev/null +++ b/composer.json @@ -0,0 +1,56 @@ +{ + "name": "kriswallsmith/assetic", + "description": "Asset Management for PHP", + "keywords": [ "assets", "compression", "minification" ], + "homepage": "https://github.com/kriswallsmith/assetic", + "type": "library", + "license": "MIT", + "authors": [ + { + "name": "Kris Wallsmith", + "email": "kris.wallsmith@gmail.com", + "homepage": "http://kriswallsmith.net/" + } + ], + "require": { + "php": ">=5.3.1", + "symfony/process": "~2.1|~3.0" + }, + "conflict": { + "twig/twig": "<1.27" + }, + "require-dev": { + "leafo/lessphp": "^0.3.7", + "leafo/scssphp": "~0.1", + "meenie/javascript-packer": "^1.1", + "mrclay/minify": "<2.3", + "natxet/cssmin": "3.0.4", + "patchwork/jsqueeze": "~1.0|~2.0", + "phpunit/phpunit": "~4.8 || ^5.6", + "psr/log": "~1.0", + "ptachoire/cssembed": "~1.0", + "symfony/phpunit-bridge": "~2.7|~3.0", + "twig/twig": "~1.23|~2.0", + "yfix/packager": "dev-master" + }, + "suggest": { + "twig/twig": "Assetic provides the integration with the Twig templating engine", + "leafo/lessphp": "Assetic provides the integration with the lessphp LESS compiler", + "leafo/scssphp": "Assetic provides the integration with the scssphp SCSS compiler", + "ptachoire/cssembed": "Assetic provides the integration with phpcssembed to embed data uris", + "leafo/scssphp-compass": "Assetic provides the integration with the SCSS compass plugin", + "patchwork/jsqueeze": "Assetic provides the integration with the JSqueeze JavaScript compressor" + }, + "autoload": { + "psr-0": { "Assetic": "src/" }, + "files": [ "src/functions.php" ] + }, + "config": { + "bin-dir": "bin" + }, + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + } +} diff --git a/php-Assetic-get-source.sh b/php-Assetic-get-source.sh index ba71f5d..4ad1051 100755 --- a/php-Assetic-get-source.sh +++ b/php-Assetic-get-source.sh @@ -43,6 +43,8 @@ print "GIT_REPO = $GIT_REPO" print "GIT_DIR = $GIT_DIR" TEMP_DIR=$(mktemp --dir) +TAR_FILE=$PWD/${NAME}-${VERSION}-${GIT_COMMIT}.tar.gz +CMP_FILE=$PWD/composer.json pushd $TEMP_DIR print "Cloning git repo..." @@ -51,6 +53,7 @@ pushd $TEMP_DIR pushd $GIT_DIR print "Checking out commit..." $GIT checkout $GIT_COMMIT + cp composer.json $CMP_FILE popd TAR_DIR=${GIT_NAME}-${GIT_COMMIT} @@ -58,7 +61,6 @@ pushd $TEMP_DIR mv $GIT_DIR $TAR_DIR - TAR_FILE=`$RPM --eval='%{_sourcedir}'`/${NAME}-${VERSION}-${GIT_COMMIT}.tar.gz print "TAR_FILE = $TAR_FILE" [ -e $TAR_FILE ] && rm -f $TAR_FILE diff --git a/php-Assetic.spec b/php-Assetic.spec index 5c5a324..f8041f4 100644 --- a/php-Assetic.spec +++ b/php-Assetic.spec @@ -12,8 +12,8 @@ %global github_owner kriswallsmith %global github_name assetic -%global github_version 1.3.2 -%global github_commit 9928f7c4ad98b234e3559d1049abd13387f86db5 +%global github_version 1.4.0 +%global github_commit e911c437dbdf006a8f62c2f59b15b2d69a5e0aa1 %global composer_vendor kriswallsmith %global composer_project assetic @@ -44,7 +44,7 @@ %global jsqueeze_max_ver 3.0 # "psr/log": "~1.0" # NOTE: Min version not 1.0 because autoloader required -%global psr_log_min_ver 1.0.0-8 +%global psr_log_min_ver 1.0.1 %global psr_log_max_ver 2.0 # "ptachoire/cssembed": "~1.0" %global cssembed_min_ver 1.0 @@ -53,9 +53,9 @@ # NOTE: Min version not 2.1 because autoloader required %global symfony_min_ver %{?el6:2.3.31}%{!?el6:2.7.1} %global symfony_max_ver 4.0 -# twig/twig": "~1.8|~2.0" -# "conflict": "twig/twig": "<1.23" -%global twig_min_ver 1.23 +# twig/twig": "~1.23|~2.0" +# "conflict": "twig/twig": "<1.27" +%global twig_min_ver 1.27 %global twig_max_ver 3.0 # Conditionals for BuildRequires and Suggests @@ -74,7 +74,7 @@ Name: php-Assetic Version: %{github_version} -Release: 4%{?dist} +Release: 1%{?dist} Summary: Asset Management for PHP Group: Development/Libraries @@ -96,11 +96,10 @@ BuildRequires: php-composer(leafo/lessphp) >= %{lessphp_min_ver} BuildRequires: php-composer(leafo/scssphp) >= %{scssphp_min_ver} BuildRequires: php-composer(patchwork/jsqueeze) >= %{jsqueeze_min_ver} BuildRequires: php-composer(phpunit/phpunit) -#BuildRequires: php-composer(psr/log) >= %%{psr_log_min_ver} -BuildRequires: php-PsrLog >= %{psr_log_min_ver} +BuildRequires: php-composer(psr/log) >= %{psr_log_min_ver} BuildRequires: php-composer(symfony/process) >= %{symfony_min_ver} BuildRequires: php-composer(twig/twig) >= %{twig_min_ver} -## phpcompatinfo (computed from version 1.3.2) +## phpcompatinfo (computed from version 1.4.0) BuildRequires: php-ctype BuildRequires: php-curl BuildRequires: php-date @@ -113,7 +112,7 @@ BuildRequires: php-simplexml BuildRequires: php-spl BuildRequires: php-tokenizer ## Autoloader -BuildRequires: php-composer(symfony/class-loader) +BuildRequires: php-composer(fedora/autoloader) ## package.json %if %{with_npm_clean_css} BuildRequires: npm(clean-css) @@ -145,7 +144,7 @@ BuildRequires: optipng Requires: php(language) >= %{php_min_ver} Requires: php-composer(symfony/process) >= %{symfony_min_ver} Requires: php-composer(symfony/process) < %{symfony_max_ver} -# phpcompatinfo (computed from version 1.3.2) +# phpcompatinfo (computed from version 1.4.0) Requires: php-ctype Requires: php-curl Requires: php-date @@ -156,7 +155,7 @@ Requires: php-reflection Requires: php-spl Requires: php-tokenizer # Autoloader -Requires: php-composer(symfony/class-loader) +Requires: php-composer(fedora/autoloader) # Weak dependencies %if 0%{?fedora} >= 21 @@ -198,7 +197,7 @@ Conflicts: php-composer(twig/twig) < %{twig_min_ver} Conflicts: php-composer(twig/twig) >= %{twig_max_ver} # Standard "php-{COMPOSER_VENDOR}-{COMPOSER_PROJECT}" naming -Provides: php-%{composer_vendor}-%{composer_project} = %{version}-%{release} +Provides: php-%{composer_vendor}-%{composer_project} = %{version}-%{release} # Composer Provides: php-composer(%{composer_vendor}/%{composer_project}) = %{version} @@ -225,36 +224,22 @@ cat <<'AUTOLOAD' | tee src/Assetic/autoload.php /** * Autoloader for %{name} and its' dependencies * (created by %{name}-%{version}-%{release}). - * - * @return \Symfony\Component\ClassLoader\ClassLoader */ +require_once '%{phpdir}/Fedora/Autoloader/autoload.php'; -if (!isset($fedoraClassLoader) || !($fedoraClassLoader instanceof \Symfony\Component\ClassLoader\ClassLoader)) { - if (!class_exists('Symfony\\Component\\ClassLoader\\ClassLoader', false)) { - require_once '%{phpdir}/Symfony/Component/ClassLoader/ClassLoader.php'; - } - - $fedoraClassLoader = new \Symfony\Component\ClassLoader\ClassLoader(); - $fedoraClassLoader->register(); -} - -$fedoraClassLoader->addPrefix('Assetic\\', dirname(__DIR__)); -require_once __DIR__.'/functions.php'; - -// Dependencies (autoloader => required) -foreach (array( - '%{phpdir}/Symfony/Component/Process/autoload.php' => true, - '%{phpdir}/Leafo/ScssPhp/autoload.php' => false, - '%{phpdir}/lessphp/lessc.inc.php' => false, - '%{phpdir}/Patchwork/JSqueeze.php' => false, - '%{phpdir}/Twig/autoload.php' => false, -) as $dependency => $required) { - if ($required || file_exists($dependency)) { - require_once($dependency); - } -} - -return $fedoraClassLoader; +\Fedora\Autoloader\Autoload::addPsr4('Assetic\\', __DIR__); + +\Fedora\Autoloader\Dependencies::required(array( + __DIR__.'/functions.php', + '%{phpdir}/Symfony/Component/Process/autoload.php', +)); + +\Fedora\Autoloader\Dependencies::optional(array( + '%{phpdir}/Leafo/ScssPhp/autoload.php', + '%{phpdir}/lessphp/lessc.inc.php', + '%{phpdir}/Patchwork/JSqueeze.php', + '%{phpdir}/Twig/autoload.php', +)); AUTOLOAD @@ -271,34 +256,25 @@ cp -rp src/Assetic %{buildroot}%{phpdir}/ rm -f \ tests/Assetic/Test/Asset/HttpAssetTest.php \ tests/Assetic/Test/Filter/GoogleClosure/CompilerApiFilterTest.php -sed 's/function testCompassExtensionCanBeDisabled/function SKIP_testCompassExtensionCanBeDisabled/' \ - -i tests/Assetic/Test/Filter/ScssphpFilterTest.php : Create tests bootstrap cat <<'BOOTSTRAP' | tee bootstrap.php addPrefix('Assetic\\Test\\', __DIR__.'/tests'); +require '%{buildroot}%{phpdir}/Assetic/autoload.php'; +\Fedora\Autoloader\Autoload::addPsr4('Assetic\\Test\\', __DIR__.'/tests/Assetic/Test'); BOOTSTRAP -: Run tests -# remirepo:11 -run=0 -ret=0 -if which php56; then - php70 %{_bindir}/phpunit --bootstrap bootstrap.php - run=1 -fi -if which php71; then - php70 %{_bindir}/phpunit --bootstrap bootstrap.php - run=1 -fi -if [ $run -eq 0 ]; then -: Run upstream test suite +: Upstream tests %{_bindir}/phpunit --verbose --bootstrap bootstrap.php -# remirepo:2 -fi -exit $ret + +: Upstream tests with SCLs if available +SCL_RETURN_CODE=0 +for SCL in php56 php70 php71; do + if which $SCL; then + $SCL %{_bindir}/phpunit --verbose --bootstrap bootstrap.php || SCL_RETURN_CODE=1 + fi +done +exit $SCL_RETURN_CODE %else : Tests skipped %endif @@ -320,6 +296,11 @@ rm -rf %{buildroot} %changelog +* Thu Dec 29 2016 Shawn Iwinski - 1.4.0-1 +- Updated to 1.4.0 (RHBZ #1394441) +- Use php-composer(fedora/autoloader) +- Run upstream tests with SCLs if they are available + * Mon Oct 10 2016 Shawn Iwinski - 1.3.2-4 - Skip addtional test known to fail (FTBFS in rawhide; RHBZ #1383374) -- cgit