From 54eddd2149fe23f8bccbf4ffdab152b31ad84c31 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Mon, 21 Sep 2015 08:29:00 +0200 Subject: php-scssphp: 0.3.1 (backported from Fedora) --- php-scssphp-fix-lib-version.patch | 20 +++++++++++ php-scssphp-get-source.sh | 69 ++++++++++++++++++++++++++++++++++++++ php-scssphp-pre-0-1-0-compat.patch | 4 +-- php-scssphp.spec | 43 +++++++++++++++++++----- 4 files changed, 126 insertions(+), 10 deletions(-) create mode 100644 php-scssphp-fix-lib-version.patch create mode 100755 php-scssphp-get-source.sh diff --git a/php-scssphp-fix-lib-version.patch b/php-scssphp-fix-lib-version.patch new file mode 100644 index 0000000..60810a5 --- /dev/null +++ b/php-scssphp-fix-lib-version.patch @@ -0,0 +1,20 @@ +From 18fccbd309f250fd5fe34cd9c6d6f5da67aed958 Mon Sep 17 00:00:00 2001 +From: Anthon Pang +Date: Fri, 11 Sep 2015 23:11:09 -0400 +Subject: [PATCH] Bump version to 0.3.1 + +--- + src/Version.php | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/Version.php b/src/Version.php +index c650a26..efd45ca 100644 +--- a/src/Version.php ++++ b/src/Version.php +@@ -18,5 +18,5 @@ + */ + class Version + { +- const VERSION = 'v0.3.0'; ++ const VERSION = 'v0.3.1'; + } diff --git a/php-scssphp-get-source.sh b/php-scssphp-get-source.sh new file mode 100755 index 0000000..ba71f5d --- /dev/null +++ b/php-scssphp-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-scssphp-pre-0-1-0-compat.patch b/php-scssphp-pre-0-1-0-compat.patch index beea2f4..69375aa 100644 --- a/php-scssphp-pre-0-1-0-compat.patch +++ b/php-scssphp-pre-0-1-0-compat.patch @@ -1,5 +1,5 @@ diff --git a/classmap.php b/classmap.php -index 267eecd..9691a58 100644 +index 2d8a52b..749e01b 100644 --- a/classmap.php +++ b/classmap.php @@ -11,6 +11,8 @@ @@ -8,6 +8,6 @@ index 267eecd..9691a58 100644 +require_once dirname(__DIR__) . '/Leafo/ScssPhp/autoload.php'; + + // @codingStandardsIgnoreStart /** * @deprecated since 0.1.0 - */ diff --git a/php-scssphp.spec b/php-scssphp.spec index 7a955f1..a8dd4b4 100644 --- a/php-scssphp.spec +++ b/php-scssphp.spec @@ -13,8 +13,8 @@ %global github_owner leafo %global github_name scssphp -%global github_version 0.1.9 -%global github_commit 609c08586d583fc7d1db78b7edd8b4ac57fa5137 +%global github_version 0.3.1 +%global github_commit 2977aa444415787e931c048989b8c9195fd5b344 %global composer_vendor leafo %global composer_project scssphp @@ -34,20 +34,32 @@ Summary: A compiler for SCSS written in PHP Group: Development/Libraries License: MIT -URL: http://leafo.net/%{github_name} -Source0: https://github.com/%{github_owner}/%{github_name}/archive/%{github_commit}/%{name}-%{github_version}-%{github_commit}.tar.gz +URL: http://leafo.github.io/scssphp + +# GitHub export does not include tests. +# Run php-scssphp-get-source.sh to create full source. +Source0: %{name}-%{github_version}-%{github_commit}.tar.gz +Source1: %{name}-get-source.sh + +# Pre-0.1.0 compat Patch0: %{name}-pre-0-1-0-compat.patch +# Fix lib version to 0.3.1 +# https://github.com/leafo/scssphp/commit/18fccbd309f250fd5fe34cd9c6d6f5da67aed958 +Patch1: %{name}-fix-lib-version.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch +# Library version value check +BuildRequires: php-cli # Tests %if %{with_tests} ## composer.json BuildRequires: %{_bindir}/phpunit BuildRequires: php(language) >= %{php_min_ver} -## phpcompatinfo (computed from version 0.1.9) +## phpcompatinfo (computed from version 0.3.1) BuildRequires: php-ctype BuildRequires: php-date +BuildRequires: php-json BuildRequires: php-mbstring BuildRequires: php-pcre ## Autoloader @@ -57,7 +69,7 @@ BuildRequires: php-composer(symfony/class-loader) Requires: php-cli # composer.json Requires: php(language) >= %{php_min_ver} -# phpcompatinfo (computed from version 0.1.9) +# phpcompatinfo (computed from version 0.3.1) Requires: php-ctype Requires: php-date Requires: php-json @@ -66,6 +78,8 @@ Requires: php-pcre # Autoloader Requires: php-composer(symfony/class-loader) +# Standard "php-{COMPOSER_VENDOR}-{COMPOSER_PROJECT}" naming +Provides: php-%{composer_vendor}-%{composer_project} = %{version}-%{release} # Composer Provides: php-composer(%{composer_vendor}/%{composer_project}) = %{version} @@ -79,8 +93,8 @@ The entire compiler comes in a single class file ready for including in any kind of project in addition to a command line tool for running the compiler from the terminal. -scssphp implements SCSS (3.2.12). It does not implement the SASS syntax, only -the SCSS syntax. +scssphp implements SCSS. It does not implement the SASS syntax, only the SCSS +syntax. %prep @@ -89,6 +103,9 @@ the SCSS syntax. : Lib pre-0.1.0 compat %patch0 -p1 +: Fix lib version to 0.3.1 +%patch1 -p1 + : Bin sed "/scss.inc.php/s#.*#require_once '%{phpdir}/Leafo/ScssPhp/autoload.php';#" \ -i bin/pscss @@ -140,6 +157,10 @@ install -pm 0755 bin/pscss %{buildroot}%{_bindir}/ %check +: Library version value check +%{_bindir}/php -r 'require_once "%{buildroot}%{phpdir}/Leafo/ScssPhp/autoload.php"; + exit(version_compare("%{version}", ltrim(\Leafo\ScssPhp\Version::VERSION, "v"), "=") ? 0 : 1);' + %if %{with_tests} %{_bindir}/phpunit --verbose \ --bootstrap %{buildroot}%{phpdir}/Leafo/ScssPhp/autoload.php @@ -164,6 +185,12 @@ rm -rf %{buildroot} %changelog +* Sun Sep 20 2015 Shawn Iwinski - 0.3.1-1 +- Updated to 0.3.1 (RHBZ #1256168) +- Updated URL +- Added standard "php-{COMPOSER_VENDOR}-{COMPOSER_PROJECT}" naming provides +- Added library version value check + * Thu Aug 13 2015 Shawn Iwinski - 0.1.9-1 - Updated to 0.1.9 (RHBZ #1238727) - As of version 0.1.7 license is just MIT (i.e. GPLv3 removed) -- cgit