summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xphp-Assetic-get-source.sh69
-rw-r--r--php-Assetic.spec298
2 files changed, 334 insertions, 33 deletions
diff --git a/php-Assetic-get-source.sh b/php-Assetic-get-source.sh
new file mode 100755
index 0000000..ba71f5d
--- /dev/null
+++ b/php-Assetic-get-source.sh
@@ -0,0 +1,69 @@
+#/bin/sh
+
+GIT=`which git`
+RPM=`which rpm`
+
+if [ -z "$GIT" ]
+then
+ echo "ERROR: 'git' command not found" 1>&2
+ exit 1
+elif [ -z "$RPM" ]
+then
+ echo "ERROR: 'rpm' command not found" 1>&2
+ exit 1
+fi
+
+function print {
+ echo -e "\e[0;33m>>>>> ${1}\e[0m"
+}
+
+if [ -x "$1" ]
+then
+ SPEC=$1
+else
+ SPEC=`ls *.spec | head -1`
+fi
+
+NAME=`echo $SPEC | sed 's#\.spec##'`
+VERSION=`egrep '%global\s*github_version' $SPEC | awk '{print $3}'`
+
+print "SPEC = $SPEC"
+print "NAME = $NAME"
+
+GIT_OWNER=`egrep '%global\s*github_owner' $SPEC | awk '{print $3}'`
+GIT_NAME=`egrep '%global\s*github_name' $SPEC | awk '{print $3}'`
+GIT_COMMIT=`egrep '%global\s*github_commit' $SPEC | awk '{print $3}'`
+GIT_REPO=https://github.com/${GIT_OWNER}/${GIT_NAME}
+GIT_DIR=`echo $GIT_REPO | sed 's#.*/##'`
+
+print "GIT_OWNER = $GIT_OWNER"
+print "GIT_NAME = $GIT_NAME"
+print "GIT_COMMIT = $GIT_COMMIT"
+print "GIT_REPO = $GIT_REPO"
+print "GIT_DIR = $GIT_DIR"
+
+TEMP_DIR=$(mktemp --dir)
+
+pushd $TEMP_DIR
+ print "Cloning git repo..."
+ $GIT clone $GIT_REPO
+
+ pushd $GIT_DIR
+ print "Checking out commit..."
+ $GIT checkout $GIT_COMMIT
+ popd
+
+ TAR_DIR=${GIT_NAME}-${GIT_COMMIT}
+ print "TAR_DIR = $TAR_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
+ tar --exclude-vcs -czf $TAR_FILE $TAR_DIR
+ chmod 0644 $TAR_FILE
+popd
+
+rm -rf $TEMP_DIR
diff --git a/php-Assetic.spec b/php-Assetic.spec
index 77e6e5c..bafb275 100644
--- a/php-Assetic.spec
+++ b/php-Assetic.spec
@@ -1,7 +1,76 @@
-%global github_owner kriswallsmith
-%global github_name assetic
-%global github_version 1.2.1
-%global github_commit b20efe38845d20458702f97f3ff625d80805897b
+# remirepo spec file for php-Assetic, from
+#
+# Fedora spec file for php-Assetic
+#
+# Copyright (c) 2013-2016 Shawn Iwinski <shawn.iwinski@gmail.com>
+#
+# License: MIT
+# http://opensource.org/licenses/MIT
+#
+# Please preserve changelog entries
+#
+
+%global github_owner kriswallsmith
+%global github_name assetic
+%global github_version 1.3.2
+%global github_commit 9928f7c4ad98b234e3559d1049abd13387f86db5
+
+%global composer_vendor kriswallsmith
+%global composer_project assetic
+
+# "php": ">=5.3.1"
+%global php_min_ver 5.3.1
+# "cssmin/cssmin": "3.0.1"
+%global cssmin_min_ver 3.0.1
+%global cssmin_max_ver 3.0.2
+# "joliclic/javascript-packer": "1.1"
+%global javascript_packer_min_ver 1.1
+%global javascript_packer_max_ver 1.2
+# "kamicane/packager": "1.0"
+%global packager_min_ver 1.0
+%global packager_max_ver 1.1
+# "leafo/lessphp": "^0.3.7"
+%global lessphp_min_ver 0.3.7
+%global lessphp_max_ver 1.0
+# "leafo/scssphp": "~0.1"
+# NOTE: Min version not 0.1 because autoloader required
+%global scssphp_min_ver 0.1.6
+%global scssphp_max_ver 1.0
+# "mrclay/minify": "~2.2"
+%global minify_min_ver 2.2
+%global minify_max_ver 3.0
+# "patchwork/jsqueeze": "~1.0|~2.0"
+%global jsqueeze_min_ver 1.0
+%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_max_ver 2.0
+# "ptachoire/cssembed": "~1.0"
+%global cssembed_min_ver 1.0
+%global cssembed_max_ver 2.0
+# "symfony/process": "~2.1|~3.0"
+# 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
+%global twig_max_ver 3.0
+
+# Conditionals for BuildRequires and Suggests
+%global with_libjpeg_turbo_utils 0%{?fedora} || 0%{?rhl} >= 7
+%global with_npm_clean_css 0%{?fedora} || 0%{?rhl} >= 7
+%global with_npm_handlebars 0%{?fedora} || 0%{?rhl} >= 6
+%global with_npm_typescript 0%{?fedora} >= 23
+%global with_rubygem_compass 0%{?fedora} >= 23
+%global with_rubygem_sass 0%{?fedora} >= 23
+%global with_rubygem_sprockets 0%{?fedora}
+
+# Build using "--without tests" to disable tests
+%global with_tests 0%{!?_without_tests:1}
+
+%{!?phpdir: %global phpdir %{_datadir}/php}
Name: php-Assetic
Version: %{github_version}
@@ -11,78 +80,241 @@ Summary: Asset Management for PHP
Group: Development/Libraries
License: MIT
URL: https://github.com/%{github_owner}/%{github_name}
-Source0: %{url}/archive/%{github_commit}/%{name}-%{github_version}-%{github_commit}.tar.gz
+
+# GitHub export does not include tests.
+# Run php-Assetic-get-source.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
+# Tests
+%if %{with_tests}
+## composer.json
+BuildRequires: php(language) >= %{php_min_ver}
+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(symfony/process) >= %{symfony_min_ver}
+BuildRequires: php-composer(twig/twig) >= %{twig_min_ver}
+## phpcompatinfo (computed from version 1.3.2)
+BuildRequires: php-ctype
+BuildRequires: php-curl
+BuildRequires: php-date
+BuildRequires: php-fileinfo
+BuildRequires: php-hash
+BuildRequires: php-json
+BuildRequires: php-pcre
+BuildRequires: php-reflection
+BuildRequires: php-simplexml
+BuildRequires: php-spl
+BuildRequires: php-tokenizer
+## Autoloader
+BuildRequires: php-composer(symfony/class-loader)
+## package.json
+%if %{with_npm_clean_css}
+BuildRequires: npm(clean-css)
+%endif
+%if %{with_npm_handlebars}
+BuildRequires: npm(handlebars)
+%endif
+%if %{with_npm_typescript}
+BuildRequires: npm(typescript)
+%endif
+## Gemfile
+%if %{with_rubygem_compass}
+BuildRequires: rubygem(compass)
+%endif
+%if %{with_rubygem_sass}
+BuildRequires: rubygem(sass)
+%endif
+%if %{with_rubygem_sprockets}
+BuildRequires: rubygem(sprockets)
+%endif
+## Other
+%if %{with_libjpeg_turbo_utils}
+BuildRequires: libjpeg-turbo-utils
+%endif
+BuildRequires: optipng
+%endif
-Requires: php(language) >= 5.3.1
-Requires: php-pear(pear.symfony.com/Process) >= 2.1
-Requires: php-pear(pear.symfony.com/Process) < 3.0
-# phpcompatinfo
+# composer.json
+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)
Requires: php-ctype
Requires: php-curl
Requires: php-date
Requires: php-hash
Requires: php-json
Requires: php-pcre
+Requires: php-reflection
Requires: php-spl
-Requires: php-standard
Requires: php-tokenizer
-# Optional
-Requires: php-pear(pear.twig-project.org/Twig) >= 1.6
-Requires: php-pear(pear.twig-project.org/Twig) < 2.0
-Requires: php-lessphp
-Requires: php-scssphp
+# Autoloader
+Requires: php-composer(symfony/class-loader)
-Provides: php-composer(%{github_owner}/%{github_name}) = %{version}
+# Weak dependencies
+%if 0%{?fedora} >= 21
+Suggests: optipng
+Suggests: php-composer(leafo/lessphp)
+Suggests: php-composer(leafo/scssphp)
+Suggests: php-composer(patchwork/jsqueeze)
+Suggests: php-composer(twig/twig)
+Suggests: php-pecl(apcu)
+%if %{with_libjpeg_turbo_utils}
+Suggests: libjpeg-turbo-utils
+%endif
+%if %{with_npm_clean_css}
+Suggests: npm(clean-css)
+%endif
+%if %{with_npm_handlebars}
+Suggests: npm(handlebars)
+%endif
+%if %{with_npm_typescript}
+Suggests: npm(typescript)
+%endif
+%if %{with_rubygem_compass}
+Suggests: rubygem(compass)
+%endif
+%if %{with_rubygem_sass}
+Suggests: rubygem(sass)
+%endif
+%if %{with_rubygem_sprockets}
+Suggests: rubygem(sprockets)
+%endif
+%endif
+Conflicts: php-composer(leafo/lessphp) < %{lessphp_min_ver}
+Conflicts: php-composer(leafo/lessphp) >= %{lessphp_max_ver}
+Conflicts: php-composer(leafo/scssphp) < %{scssphp_min_ver}
+Conflicts: php-composer(leafo/scssphp) >= %{scssphp_max_ver}
+Conflicts: php-composer(patchwork/jsqueeze) < %{jsqueeze_min_ver}
+Conflicts: php-composer(patchwork/jsqueeze) >= %{jsqueeze_max_ver}
+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}
+# Composer
+Provides: php-composer(%{composer_vendor}/%{composer_project}) = %{version}
%description
Assetic is an asset management framework for PHP.
-Optional dependency: APC (php-pecl-apc)
-
-Optional packages:
-* https://github.com/leafo/scssphp-compass
-* https://github.com/krichprollsch/phpCssEmbed
+Autoloader: %{phpdir}/Assetic/autoload.php
%prep
%setup -q -n %{github_name}-%{github_commit}
-# Move functions file
+: Move functions file
mv src/functions.php src/Assetic/
+: Remove executable bits
+chmod a-x package.json
+
%build
-# Empty build section, nothing to build
+: Create autoloader
+cat <<'AUTOLOAD' | tee src/Assetic/autoload.php
+<?php
+/**
+ * Autoloader for %{name} and its' dependencies
+ * (created by %{name}-%{version}-%{release}).
+ *
+ * @return \Symfony\Component\ClassLoader\ClassLoader
+ */
+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';
+ }
-%install
-rm -rf %{buildroot}
-mkdir -p -m 755 %{buildroot}%{_datadir}/php
-cp -rp src/Assetic %{buildroot}%{_datadir}/php/
+ $fedoraClassLoader = new \Symfony\Component\ClassLoader\ClassLoader();
+ $fedoraClassLoader->register();
+}
+$fedoraClassLoader->addPrefix('Assetic\\', dirname(__DIR__));
+require_once __DIR__.'/functions.php';
-%clean
+// Required dependencies
+require_once '%{phpdir}/Symfony/Component/Process/autoload.php';
+
+// Optional dependencies
+@include_once '%{phpdir}/Leafo/ScssPhp/autoload.php';
+@include_once '%{phpdir}/lessphp/lessc.inc.php';
+@include_once '%{phpdir}/Patchwork/JSqueeze.php';
+@include_once '%{phpdir}/Twig/autoload.php';
+
+return $fedoraClassLoader;
+AUTOLOAD
+
+
+%install
rm -rf %{buildroot}
+mkdir -p %{buildroot}%{phpdir}
+cp -rp src/Assetic %{buildroot}%{phpdir}/
+
%check
-# TODO: Work with upstream to figure out why tests are ignored for export
-# (and therefore not included in a GitHub archive)
-# https://github.com/kriswallsmith/assetic/blob/v1.1.2/.gitattributes
+%if %{with_tests}
+: Skip tests known to fail
+rm -f \
+ tests/Assetic/Test/Asset/HttpAssetTest.php \
+ tests/Assetic/Test/Filter/GoogleClosure/CompilerApiFilterTest.php
+
+: Create tests bootstrap
+cat <<'BOOTSTRAP' | tee bootstrap.php
+<?php
+$fedoraClassLoader = require '%{buildroot}%{phpdir}/Assetic/autoload.php';
+$fedoraClassLoader->addPrefix('Assetic\\Test\\', __DIR__.'/tests');
+BOOTSTRAP
+
+: Run tests
+%{_bindir}/phpunit --verbose --bootstrap bootstrap.php
+
+if which php70; then
+ php70 %{_bindir}/phpunit --verbose --bootstrap bootstrap.php
+fi
+%else
+: Tests skipped
+%endif
+
+
+%clean
+rm -rf %{buildroot}
%files
%defattr(-,root,root,-)
%{!?_licensedir:%global license %%doc}
%license LICENSE
-%doc *.md composer.json
-%{_datadir}/php/Assetic
+%doc *.json
+%doc *.md
+%doc docs
+%doc Gemfile
+%{phpdir}/Assetic
%changelog
+* Sat Mar 26 2016 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.3.2-1
+- Updated to 1.3.2 (RHBZ #1153986)
+- Added additional non-PHP build dependencies
+- Added additional non-PHP weak dependencies
+
+* Fri Mar 25 2016 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.2.1-4
+- Added spec copyright header
+- Included tests in source, added BuildRequires, enabled tests
+- Dependencies changed to virtual provides ("php*(*)")
+- Added weak dependencies suggests (Fedora >= 21)
+- Added autoloader
+- Added additional docs
+
* Mon Dec 29 2014 Adam Williamson <awilliam@redhat.com> - 1.2.1-1
- new release 1.2.1