summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lesserphp--pullrequest-18.patch140
-rw-r--r--php-marcusschwarz-lesserphp.spec123
2 files changed, 263 insertions, 0 deletions
diff --git a/lesserphp--pullrequest-18.patch b/lesserphp--pullrequest-18.patch
new file mode 100644
index 0000000..d3e42b9
--- /dev/null
+++ b/lesserphp--pullrequest-18.patch
@@ -0,0 +1,140 @@
+diff --git a/.travis.yml b/.travis.yml
+index fbaf2e8..f2ead47 100644
+--- a/.travis.yml
++++ b/.travis.yml
+@@ -2,7 +2,6 @@ language: php
+
+ php:
+ - 5.6
+- - 7.1
+ - 7.2
+ - 7.3
+ - 7.4
+diff --git a/composer.json b/composer.json
+index d32a5d4..f96d98d 100644
+--- a/composer.json
++++ b/composer.json
+@@ -30,7 +30,7 @@
+ }
+ },
+ "require-dev": {
+- "phpunit/phpunit": "~4.3"
++ "phpunit/phpunit": ">=4.8.35 <8"
+ },
+ "scripts": {
+ "test": "phpunit"
+diff --git a/lessc.inc.php b/lessc.inc.php
+index 4764b28..14299d1 100644
+--- a/lessc.inc.php
++++ b/lessc.inc.php
+@@ -1,7 +1,7 @@
+ <?php
+
+ /**
+- * lessphp v0.5.2
++ * lessphp v0.5.4
+ * http://leafo.net/lessphp
+ *
+ * LESS CSS compiler, adapted from http://lesscss.org
+@@ -39,7 +39,7 @@
+ * handling things like indentation.
+ */
+ class lessc {
+- static public $VERSION = "v0.5.2";
++ static public $VERSION = "v0.5.4";
+
+ static public $TRUE = array("keyword", "true");
+ static public $FALSE = array("keyword", "false");
+@@ -758,7 +758,7 @@ protected function compileProp($prop, $block, $out) {
+ if ($suffix !== null &&
+ $subProp[0] == "assign" &&
+ is_string($subProp[1]) &&
+- $subProp[1]{0} != $this->vPrefix)
++ $subProp[1][0] != $this->vPrefix)
+ {
+ $subProp[2] = array(
+ 'list', ' ',
+@@ -2759,7 +2759,7 @@ protected function parseChunk() {
+ $hidden = true;
+ if (!isset($block->args)) {
+ foreach ($block->tags as $tag) {
+- if (!is_string($tag) || $tag{0} != $this->lessc->mPrefix) {
++ if (!is_string($tag) || $tag[0] != $this->lessc->mPrefix) {
+ $hidden = false;
+ break;
+ }
+@@ -2813,7 +2813,7 @@ protected function isDirective($dirname, $directives) {
+ protected function fixTags($tags) {
+ // move @ tags out of variable namespace
+ foreach ($tags as &$tag) {
+- if ($tag{0} == $this->lessc->vPrefix)
++ if ($tag[0] == $this->lessc->vPrefix)
+ $tag[0] = $this->lessc->mPrefix;
+ }
+ return $tags;
+diff --git a/tests/ApiTest.php b/tests/ApiTest.php
+index fe1bbff..8e0a6f4 100644
+--- a/tests/ApiTest.php
++++ b/tests/ApiTest.php
+@@ -2,7 +2,9 @@
+
+ require_once __DIR__ . "/../lessc.inc.php";
+
+-class ApiTest extends PHPUnit_Framework_TestCase {
++use PHPUnit\Framework\TestCase;
++
++class ApiTest extends TestCase {
+ public function setUp() {
+ $this->less = new lessc();
+ $this->less->importDir = array(__DIR__ . "/inputs/test-imports");
+diff --git a/tests/ErrorHandlingTest.php b/tests/ErrorHandlingTest.php
+index f928974..5bb7b6f 100644
+--- a/tests/ErrorHandlingTest.php
++++ b/tests/ErrorHandlingTest.php
+@@ -1,7 +1,9 @@
+ <?php
+ require_once __DIR__ . "/../lessc.inc.php";
+
+-class ErrorHandlingTest extends PHPUnit_Framework_TestCase {
++use PHPUnit\Framework\TestCase;
++
++class ErrorHandlingTest extends TestCase {
+ public function setUp() {
+ $this->less = new lessc();
+ }
+diff --git a/tests/InputTest.php b/tests/InputTest.php
+index 32db95b..8a0724c 100644
+--- a/tests/InputTest.php
++++ b/tests/InputTest.php
+@@ -2,6 +2,8 @@
+
+ require_once __DIR__ . "/../lessc.inc.php";
+
++use PHPUnit\Framework\TestCase;
++
+ // Runs all the tests in inputs/ and compares their output to ouputs/
+
+ function _dump($value) {
+@@ -12,7 +14,7 @@ function _quote($str) {
+ return preg_quote($str, "/");
+ }
+
+-class InputTest extends PHPUnit_Framework_TestCase {
++class InputTest extends TestCase {
+ protected static $importDirs = array("inputs/test-imports");
+
+ protected static $testDirs = array(
+diff --git a/tests/ServerTest.php b/tests/ServerTest.php
+index 5537f59..5e8a03f 100644
+--- a/tests/ServerTest.php
++++ b/tests/ServerTest.php
+@@ -1,6 +1,8 @@
+ <?php
+
+-class ServerTest extends \PHPUnit_Framework_TestCase
++use PHPUnit\Framework\TestCase;
++
++class ServerTest extends TestCase
+ {
+
+ public function testCheckedCachedCompile()
diff --git a/php-marcusschwarz-lesserphp.spec b/php-marcusschwarz-lesserphp.spec
new file mode 100644
index 0000000..1edeaae
--- /dev/null
+++ b/php-marcusschwarz-lesserphp.spec
@@ -0,0 +1,123 @@
+%global composer_vendor marcusschwarz
+%global composer_project lesserphp
+
+%{!?phpdir: %global phpdir %{_datadir}/php}
+%global pkgdir %{phpdir}/%{composer_vendor}-%{composer_project}
+
+%global with_tests 1
+
+Name: php-%{composer_vendor}-%{composer_project}
+Version: 0.5.4
+Release: 5%{?dist}
+
+Summary: A compiler for LESS written in PHP
+License: MIT or GPLv3
+URL: https://www.maswaba.de/lesserphpdocs/
+
+%global repo_owner MarcusSchwarz
+%global repo_name lesserphp
+Source0: https://github.com/%{repo_owner}/%{repo_name}/archive/v%{version}/%{repo_name}-%{version}.tar.gz
+
+# A yet-unmerged Pull Request submitted upstream by someone else.
+# Fixes uses of deprecated syntax and old PHPUnit code.
+#
+# https://github.com/MarcusSchwarz/lesserphp/pull/18
+Patch0: lesserphp--pullrequest-18.patch
+
+BuildArch: noarch
+
+%if 0%{?with_tests}
+BuildRequires: php-composer(phpunit/phpunit) >= 4.8.35
+%endif
+BuildRequires: php-fedora-autoloader-devel
+
+Requires: php-cli >= 5.3.0
+Requires: php-ctype
+Requires: php-date
+Requires: php-fileinfo
+Requires: php-pcre
+Requires: php-composer(fedora/autoloader)
+
+# Composer
+Provides: php-composer(%{composer_vendor}/%{composer_project}) = %{version}
+
+# This project is a fork of lessphp, which was previously packaged for Fedora
+Obsoletes: php-lessphp <= 0.5.0+0
+
+
+%description
+lesserphp is a compiler that generates CSS from a superset language which adds
+a collection of convenient features often seen in other languages.
+All CSS is compatible with LESS, so you can start using new features
+with your existing CSS.
+
+It is designed to be compatible with less.js (https://lesscss.org/),
+and suitable as a drop-in replacement for PHP projects.
+
+Autoloader: %{pkgdir}/autoload.php
+
+
+%prep
+%autosetup -p1 -n %{repo_name}-%{version}
+
+# Lessify is broken upstream and we don't want to install it
+rm lessify lessify.inc.php
+
+# Fix include paths
+sed -e 's|^require $path."lessc.inc.php";$|require "%{pkgdir}/lessc.inc.php";|' -i plessc
+
+# Fix homepage link in composer.json (still points to pre-fork page)
+sed -e 's|"http://leafo.net/lessphp/"|"https://www.maswaba.de/lesserphpdocs/"|' -i composer.json
+
+
+%build
+# Create autoloader
+phpab \
+ --template fedora \
+ --output autoload.php \
+ lessc.inc.php
+cat autoload.php
+
+
+%install
+# Library
+install -d -m 755 %{buildroot}%{pkgdir}
+install -m 644 -p autoload.php lessc.inc.php %{buildroot}%{pkgdir}/
+
+# Executables
+install -d -m 755 %{buildroot}%{_bindir}
+install -m 0755 -p plessc %{buildroot}%{_bindir}/plessc
+
+
+%check
+%if 0%{?with_tests}
+phpunit --verbose --bootstrap %{buildroot}%{pkgdir}/autoload.php
+%endif
+
+
+%files
+%license LICENSE
+%doc *.md
+%doc composer.json
+%{pkgdir}/
+%{_bindir}/plessc
+
+
+%changelog
+* Fri Mar 13 2020 Artur Iwicki <fedora@svgames.pl> - 0.5.4-5
+- Fix FedoraAutoloader-related Requires/BuildRequires
+
+* Thu Mar 12 2020 Artur Iwicki <fedora@svgames.pl> - 0.5.4-4
+- Include a patch to address uses of deprecated syntax in plessc
+- Do not include "lessify" in the package (broken upstream code)
+
+* Tue Mar 10 2020 Artur Iwicki <fedora@svgames.pl> - 0.5.4-3
+- Add a fake revision number to the "Obsoletes: php-lessphp" tag
+- Make executables include required files directly, instead of using the autoloader
+
+* Sat Mar 07 2020 Artur Iwicki <fedora@svgames.pl> - 0.5.4-2
+- Fix the License: tag
+- Preserve timestamps during %%install
+
+* Mon Mar 02 2020 Artur Iwicki <fedora@svgames.pl> - 0.5.4-1
+- Initial packaging