Bug 1809097

Summary: Review Request: php-marcusschwarz-lesserphp - a LESS compiler written in PHP
Product: [Fedora] Fedora Reporter: Artur Frenszek-Iwicki <fedora>
Component: Package ReviewAssignee: Zbigniew Jędrzejewski-Szmek <zbyszek>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: medium    
Version: rawhideCC: fedora, package-review, zbyszek
Target Milestone: ---Flags: zbyszek: fedora-review+
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-04-01 00:16:59 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Artur Frenszek-Iwicki 2020-03-02 12:31:02 UTC
spec: https://svgames.pl/fedora/php-marcusschwarz-lesserphp-0.5.4-1.spec
srpm: https://svgames.pl/fedora/php-marcusschwarz-lesserphp-0.5.4-1.src.rpm
koji: https://koji.fedoraproject.org/koji/taskinfo?taskID=42104670

Description: lesserphp is a LESS compiler written in PHP. It is designed to be compatible with less.js, and suitable as a drop-in replacement for PHP projects.

FAS username: suve

Comment 1 Artur Frenszek-Iwicki 2020-03-02 12:33:56 UTC
This package is required for dokuwiki (https://src.fedoraproject.org/rpms/dokuwiki), since one of its dependent packages (https://src.fedoraproject.org/rpms/php-lessphp) was retired recently. This new package is a backwards-compatible fork of the retired one.

For more info, check also: https://bugzilla.redhat.com/show_bug.cgi?id=1807717

Comment 3 Zbigniew Jędrzejewski-Szmek 2020-03-09 16:30:45 UTC
Obsoletes is wrong: php-lessphp-0.5.0-11.fc32 is the latest, so you need something like
Obsoletes: php-lessphp < 0.5.0+0

Including the version in the spec file name seems wrong.

+ package name is OK (please rename the spec file)
+ latest version
+ license is acceptable (MIT (or GPLv3))
+ license is specified correctly
+ build and installs OK
+ fedora-review and rpmlint seem happy
+ Provides/Requires/BuildRequires look OK

rpmlint says:
E: description-line-too-long C It is designed to be compatible with less.js (https://lesscss.org/), and suitable
→ please wrap.

php-marcusschwarz-lesserphp.src:65: W: mixed-use-of-spaces-and-tabs (spaces: line 1, tab: line 65)

$ /usr/bin/plessc
PHP Fatal error:  Uncaught Error: Class 'lessc' not found in /usr/bin/plessc:47
Stack trace:
#0 {main}
  thrown in /usr/bin/plessc on line 47
→ that doesn't seem right :(

Comment 4 Artur Frenszek-Iwicki 2020-03-09 20:04:08 UTC
>Obsoletes is wrong: php-lessphp-0.5.0-11.fc32 is the latest, so you need something like
>Obsoletes: php-lessphp < 0.5.0+0
I'm sorry, I don't quite understand. I want the package to be marked as obsoleting "php-lessphp" v0.5.0 and older. Is not not the proper way to do it?

>$ /usr/bin/plessc
>PHP Fatal error:  Uncaught Error: Class 'lessc' not found in /usr/bin/plessc:47
Oopsie daisy. Gonna take a look immediately. Thanks for catching this!

Comment 5 Zbigniew Jędrzejewski-Szmek 2020-03-09 21:20:55 UTC
For rpm, 0.5.0-11.fc32 is newer than 0.5.0. This can be checked with
$ rpmdev-vercmp 0.5.0 0.5.0-11.fc32
0.5.0 < 0.5.0-11.fc32

Comment 7 Zbigniew Jędrzejewski-Szmek 2020-03-10 07:33:18 UTC
Hmmm...

<mock-chroot> sh-5.0# lessify
Usage: /usr/bin/lessify input-file
<mock-chroot> sh-5.0# lessify /dev/null
PHP Warning:  Declaration of lessify::parse($str = NULL) should be compatible with lessc::parse($str = NULL, $initialVariables = NULL) in /usr/share/php/marcusschwarz-lesserphp/lessify.inc.php on line 366
PHP Fatal error:  Uncaught Error: Call to undefined method lessify::prepareParser() in /usr/share/php/marcusschwarz-lesserphp/lessify.inc.php:367
Stack trace:
#0 /usr/bin/lessify(18): lessify->parse()
#1 {main}
  thrown in /usr/share/php/marcusschwarz-lesserphp/lessify.inc.php on line 367

<mock-chroot> sh-5.0# /usr/bin/plessc
PHP Deprecated:  Array and string offset access syntax with curly braces is deprecated in /usr/share/php/marcusschwarz-lesserphp/lessc.inc.php on line 761
PHP Deprecated:  Array and string offset access syntax with curly braces is deprecated in /usr/share/php/marcusschwarz-lesserphp/lessc.inc.php on line 2762
PHP Deprecated:  Array and string offset access syntax with curly braces is deprecated in /usr/share/php/marcusschwarz-lesserphp/lessc.inc.php on line 2816
Usage: /usr/bin/plessc [options] input-file [output-file]
...

Comment 8 Artur Frenszek-Iwicki 2020-03-10 10:53:45 UTC
Looks like lessify is broken upstream. I'll try to write a patch or will just drop it from the package - I care mostly about the library, not the executables.

Comment 9 Artur Frenszek-Iwicki 2020-03-12 14:32:36 UTC
Ok, so apprently lessify has been broken upstream... since 2011. I'm writing a patch to fix this, but it will take some time, so meanwhile, I removed it from the package (since, as mentioned before, I care mostly about the plessc part of the package, required for dokuwiki).

Added a patch that fixes the uses of deprecated syntax inside lessc.inc.php. Hopefully now everything will be ok.

spec: https://svgames.pl/fedora/php-marcusschwarz-lesserphp-0.5.4-4.spec
srpm: https://svgames.pl/fedora/php-marcusschwarz-lesserphp-0.5.4-4.src.rpm
koji: https://koji.fedoraproject.org/koji/taskinfo?taskID=42431968

Comment 10 Remi Collet 2020-03-12 14:54:19 UTC
When running the build:

     PHP Warning:  file_get_contents(fedora): failed to open stream: No such file or directory in /usr/share/php/TheSeer/Autoload/Application.php on line 65


indeed, you use "phpab --template fedora ..."

So you must have

BuildRequires: php-fedora-autoloader-devel

To ensure the fedora template is there.

Comment 11 Remi Collet 2020-03-12 14:56:41 UTC
> - Make executables include required files directly, instead of using the autoloader

better to use the autoloader, but because of above issue, it is empty.

Comment 12 Artur Frenszek-Iwicki 2020-03-12 19:12:00 UTC
>So you must have
>BuildRequires: php-fedora-autoloader-devel
>To ensure the fedora template is there.
Oh, thanks, I just used "dnf provides /usr/bin/phpab", which said theeser-autoload, and I went with that.

>> - Make executables include required files directly, instead of using the autoloader
>better to use the autoloader, but because of above issue, it is empty.
Including the autoloader file does not register ("activate") the Fedora Autoloader, so to use the autoloader file, I'd need to modify the executables further. Since all the classes required by the executable are located in one file, I think it's simpler to just include that file.

Comment 13 Remi Collet 2020-03-13 06:02:44 UTC
(In reply to Artur Iwicki from comment #12)

> Including the autoloader file does not register ("activate") the Fedora
> Autoloader, 

What do you mean ?

Including the autoloader is usually enough, classes will be loaded as soon as needed (and only when needed)

Comment 14 Artur Frenszek-Iwicki 2020-03-13 09:58:19 UTC
Ok, I took a better look at the code and yeah, the first thing Autoload::addClassMap() does is register the autoloader, if it wasn't registered already. Weird, I remember having issues with the autoloader not being active when doing a require on the autoload file. Either way, I'll experiment with this and switch back requiring the autoloader file, if it works ok.

Comment 15 Zbigniew Jędrzejewski-Szmek 2020-03-13 11:19:56 UTC
OK, so let me know when it's ready for review again.

Comment 16 Artur Frenszek-Iwicki 2020-03-13 11:29:05 UTC
Fixed the BuildRequires: issue. As for the "require" call, I decided to stick with including the file directly instead of using the autoloader, since that's what upstream does and all the required classes are in one file either way.

spec: https://svgames.pl/fedora/php-marcusschwarz-lesserphp-0.5.4-5.spec
srpm: https://svgames.pl/fedora/php-marcusschwarz-lesserphp-0.5.4-5.src.rpm
koji: https://koji.fedoraproject.org/koji/taskinfo?taskID=42445598

Comment 17 Artur Frenszek-Iwicki 2020-03-13 11:46:51 UTC
Thanks to Remi once again for pointing out the autoloader issue - I admit that I submitted the koji builds, saw them pass and didn't even check the build.log. The latest build generates the autoloader file correctly.

I have submitted a patch upstream that makes phpab throw an exception and fail if the template does not exist: https://github.com/theseer/Autoload/pull/93

Comment 18 Zbigniew Jędrzejewski-Szmek 2020-03-22 10:17:50 UTC
+ package name is OK
+ latest version
+ license is acceptable for Fedora (MIT or GPLv3)
+ license is specified correctly
  (Though I think it would be possible to simplify this to just MIT. MIT is upwards compatible with GPLv3,
   so anyone who wants to distribute the code as GPLv3 can already do so starting with the MIT license.)
+ builds and installs OK
+ fedora-review and rpmlint find no issues (except for false positive spelling recommendations)
+ /usr/bin/plessc runs OK for simple inputs
+ R/BR/P look OK

Package is APPROVED.

Comment 19 Igor Raits 2020-03-22 15:36:25 UTC
(fedscm-admin):  The Pagure repository was created at https://src.fedoraproject.org/rpms/php-marcusschwarz-lesserphp

Comment 20 Fedora Update System 2020-03-23 10:33:17 UTC
FEDORA-2020-589fa35724 has been submitted as an update to Fedora 32. https://bodhi.fedoraproject.org/updates/FEDORA-2020-589fa35724

Comment 21 Fedora Update System 2020-03-24 01:52:00 UTC
FEDORA-2020-589fa35724 has been pushed to the Fedora 32 testing repository.
In short time you'll be able to install the update with the following command:
`sudo dnf install --enablerepo=updates-testing --advisory=FEDORA-2020-589fa35724 \*`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-589fa35724

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 22 Fedora Update System 2020-04-01 00:16:59 UTC
FEDORA-2020-589fa35724 has been pushed to the Fedora 32 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 23 Fedora Update System 2020-04-01 16:32:00 UTC
FEDORA-2020-589fa35724 has been pushed to the Fedora 32 stable repository.
If problem still persists, please make note of it in this bug report.