There is a limited cli phar utility that should come with php, but doesn't appear to be installed with use phar. Reproducible: Always Steps to Reproduce: equery u dev-lang/php | grep phar +phar Actual Results: equery f dev-lang/php | grep phar /usr/lib64/php7.2/include/php/ext/phar /usr/lib64/php7.2/include/php/ext/phar/php_phar.h /usr/lib64/php7.4/include/php/ext/phar /usr/lib64/php7.4/include/php/ext/phar/php_phar.h Expected Results: /usr/bin/phar.phar7.3 /usr/bin/phar7.3 /usr/bin/php7.3 /usr/share/man/man1/phar.phar7.3.1.gz /usr/share/man/man1/phar7.3.1.gz /usr/share/man/man1/php7.3.1.gz https://packages.ubuntu.com/eoan/amd64/php7.3-cli/filelist
Just to clarify, this affects php 7.2-7.4 in portage. I have 7.2 & 7.4 installed at the moment and no 7.3. I only posted information for 7.3 from ubuntu but their 7.2 & 7.4 packages are all similar.
It looks like this utility is built as ext/phar/phar/phar.php and we just need to install it. First slotted, and then we can have eselect-php link it to /usr/bin/phar once every supported version of PHP installs it.
Is this really necessary? I've always done, eg., php composer.phar and it works just fine in Gentoo.
For the PHP side, we can do: diff --git a/dev-lang/php/php-7.4.2.ebuild b/dev-lang/php/php-7.4.2.ebuild index 4123e985061..41cbe58124b 100644 --- a/dev-lang/php/php-7.4.2.ebuild +++ b/dev-lang/php/php-7.4.2.ebuild @@ -549,6 +549,10 @@ src_install() { case "$sapi" in cli) source="sapi/cli/php" + if use phar ; then + emake INSTALL_ROOT="${D}" install-pharcmd + dosym "${dest}/bin/phar" "/usr/bin/phar${SLOT}" + fi ;; cgi) source="sapi/cgi/php-cgi" This will put things into place
(In reply to Brian Evans from comment #3) > Is this really necessary? I've always done, eg., php composer.phar and it > works just fine in Gentoo. Hi Brian, This is more for working with the phar archives like listing contents and extracting. You can do everything (better) with a few lines of php, but it's nice to have and should be relatively easy to add. I will give your patch a go and report back. Thanks for taking a look.
This patch appears to work, but now I understand why you are reluctant to add it. I think the only major side effect is eselect php cli for the /usr/bin/phar symlink. If it makes it less painful on your side, I can try to patch app-eselect/eselect-php and submit a pr or we can just leave it as is or we can just close this bug because phar archiving is really buggy and software generally sucks.
This should only be a one-line change in eselect-php, and there's going to be a new release after bug 709422 is finished, so it's not a big deal.
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=9f957137544df01e20e5ae49f5bf8d7ee6a352f5 commit 9f957137544df01e20e5ae49f5bf8d7ee6a352f5 Author: Michael Orlitzky <mjo@gentoo.org> AuthorDate: 2020-02-29 22:10:29 +0000 Commit: Michael Orlitzky <mjo@gentoo.org> CommitDate: 2020-02-29 22:10:29 +0000 src/php.eselect.in.in: add support for the "phar" executable. PHP supports installing a "phar" executable that can archive/extract the phar file format without the user having to learn the API and write a little script. This commit allows "eselect php ... cli" to manage a symlink to the "phar" command, so that when dev-lang/php starts installing them, we can switch between the various versions. Bug: https://bugs.gentoo.org/707876 Signed-off-by: Michael Orlitzky <mjo@gentoo.org> src/php.eselect.in.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=80e9cccfa6bf0f6fc15dda9f1423d5cdca8b2354 commit 80e9cccfa6bf0f6fc15dda9f1423d5cdca8b2354 Author: Michael Orlitzky <mjo@gentoo.org> AuthorDate: 2020-03-01 13:10:27 +0000 Commit: Michael Orlitzky <mjo@gentoo.org> CommitDate: 2020-03-01 13:58:34 +0000 app-eselect/eselect-php: new version 0.9.6. New EAPI=7 version with some nice stuff: * The php-fpm-launcher script and php-fpm.conf tmpfiles.d entry are now upstream, simplifying the ebuild. * We install a logrotate script for php-fpm. * The eselect module itself now supports $ROOT. * We support symlinks for the "phar" executable. Closes: https://bugs.gentoo.org/692194 Closes: https://bugs.gentoo.org/709422 Closes: https://bugs.gentoo.org/707876 Package-Manager: Portage-2.3.84, Repoman-2.3.20 Signed-off-by: Michael Orlitzky <mjo@gentoo.org> app-eselect/eselect-php/Manifest | 1 + app-eselect/eselect-php/eselect-php-0.9.6.ebuild | 33 ++++++++++++++++++++++++ 2 files changed, 34 insertions(+) Additionally, it has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=396d51b16d817726bca38b1342e89d57e3a7ea68 commit 396d51b16d817726bca38b1342e89d57e3a7ea68 Author: Michael Orlitzky <mjo@gentoo.org> AuthorDate: 2020-02-29 22:34:43 +0000 Commit: Michael Orlitzky <mjo@gentoo.org> CommitDate: 2020-03-01 13:58:31 +0000 dev-lang/php: new revisions that install the "phar" executable PHP supports installing a "phar" executable that simplifies creating and extracting phar archives. This commit does so when USE=phar is set. A forthcoming release of eselect-php will allow users to switch between the different versions of the command. While we're making revisions, the virtual/libffi dependency was replaced by its sole provider, dev-libs/libffi. Bug: https://bugs.gentoo.org/707876 Package-Manager: Portage-2.3.84, Repoman-2.3.20 Signed-off-by: Michael Orlitzky <mjo@gentoo.org> dev-lang/php/Manifest | 2 - .../{php-7.2.28.ebuild => php-7.2.28-r1.ebuild} | 3 + .../{php-7.3.15.ebuild => php-7.3.15-r1.ebuild} | 3 + dev-lang/php/php-7.4.1.ebuild | 741 --------------------- dev-lang/php/php-7.4.2.ebuild | 741 --------------------- .../php/{php-7.4.3.ebuild => php-7.4.3-r1.ebuild} | 5 +- 6 files changed, 10 insertions(+), 1485 deletions(-)
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1da1f7fe7ebc3a02ada674c2a65900ed076ae0a6 commit 1da1f7fe7ebc3a02ada674c2a65900ed076ae0a6 Author: Brian Evans <grknight@gentoo.org> AuthorDate: 2020-03-02 02:50:12 +0000 Commit: Brian Evans <grknight@gentoo.org> CommitDate: 2020-03-02 02:50:12 +0000 dev-lang/php: Fix installation of phar command Originally added in the wrong location as it requires the cli SAPI to be active Bug: https://bugs.gentoo.org/707876 Signed-off-by: Brian Evans <grknight@gentoo.org> dev-lang/php/php-7.2.28-r1.ebuild | 8 +++++--- dev-lang/php/php-7.3.15-r1.ebuild | 8 +++++--- dev-lang/php/php-7.4.3-r1.ebuild | 8 +++++--- 3 files changed, 15 insertions(+), 9 deletions(-)