Hello PHP SIG,
My name is Otto Urpelainen. I have been contributing to Fedora since the beginning of 2021, and using Fedora for many years before.
Recently, there was a call for help for reviewing a batch of php packages on the devel mailing list [1]. This led me to take a look at php packaging. I have not run into any major issues, but I did what I always try to do when I start with some thing new: a critical look a the existing documentation, namely PHP Packaging Guidelines [2]. I will send a pull request to the Packaging Committee, but since I really am a newcomer in this field, I tought it is better to open discussion here.
- There are some trivial things, like typos and places where applying monospace formatting would help. - In some places, it is said: "do A, or on Fedora >=19 do B". The given Fedora edition is always something that has reached its end-of-life already a long time ago. I plan to replace all of these with simply "do B". - There is one similar place, except it compares RHEL 5 to later versions. I plan to remove the reference to RHEL 5. - Wiki still has page Packaging:PHP [3], which seems to be an older version of the guidelines. I plan to replace it with a link to the current guidelines.
There is one more field where I would like to see improvement: Test execution. The two projects I have been looking at this far have both used a system where the source actually includes tests, but they are stripped from Git archived through .gitattributes. In case this was not just a coincidence and such stripping is common for php projects, it would be great if there was a way to grab those test cases anyhow and execute them. I have not been able to find a way yet.
I also wonder if something like %py3_check_import [4] would be useful for cases where there are no real tests to run? The idea there is to run a program that imports the library, but does not do anything, just to catch those cases where the import itself fails, rendering the package library completely unusable. For compiled languages this is not so important, since compilation usually fails if things are totally broken. But for interpreted languages where packaging basically means copying files around, it is useful to run at least something to catch the most basic problems.
[1]: https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/... [2]: https://docs.fedoraproject.org/en-US/packaging-guidelines/PHP/ [3]: https://fedoraproject.org/wiki/Packaging:PHP [4]: https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/...
Hi Otto,
Welcome on the PHP SIG.
Le 19/07/2021 à 21:04, Otto Urpelainen a écrit :
There is one more field where I would like to see improvement: Test execution. The two projects I have been looking at this far have both used a system where the source actually includes tests, but they are stripped from Git archived through .gitattributes. In case this was not just a coincidence and such stripping is common for php projects, it would be great if there was a way to grab those test cases anyhow and execute them. I have not been able to find a way yet.
Nearly all the php-* packages are affected by this common terrible practice. You have to use a git snapshot. Please see any package which have a makesrc.sh or %{name}-get-sources.sh script.
Ex:
https://src.fedoraproject.org/rpms/php-laminas-escaper/blob/rawhide/f/makesr...
And
https://src.fedoraproject.org/rpms/php-laminas-escaper/blob/rawhide/f/php-la...
I also wonder if something like %py3_check_import [4] would be useful for cases where there are no real tests to run? The idea there is to run a program that imports the library, but does not do anything, just to catch those cases where the import itself fails, rendering the package library completely unusable.
As we usually add an autoloader (recommended), at least it needs to be tested.
Ex: https://src.fedoraproject.org/rpms/php-psr-cache/blob/rawhide/f/php-psr-cach...
This ensure one of class/interface provided by the library is found.
For compiled languages this is not so important, since compilation usually fails if things are totally broken.
Even for C extension a minimal "load" test is required, to ensure (at least) that all symbols are prooerly resolved (common error)
Remi
php-devel@lists.fedoraproject.org