Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 707876 - dev-lang/php[phar] should install phar command line utility
Summary: dev-lang/php[phar] should install phar command line utility
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: PHP Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-02-02 08:53 UTC by Alex Barker
Modified: 2020-03-02 02:51 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Barker 2020-02-02 08:53:39 UTC
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
Comment 1 Alex Barker 2020-02-02 18:06:10 UTC
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.
Comment 2 Michael Orlitzky gentoo-dev 2020-02-02 18:08:44 UTC
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.
Comment 3 Brian Evans (RETIRED) gentoo-dev 2020-02-18 14:24:38 UTC
Is this really necessary?  I've always done, eg., php composer.phar and it works just fine in Gentoo.
Comment 4 Brian Evans (RETIRED) gentoo-dev 2020-02-18 15:43:11 UTC
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
Comment 5 Alex Barker 2020-02-20 03:38:22 UTC
(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.
Comment 6 Alex Barker 2020-02-20 03:56:43 UTC
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.
Comment 7 Michael Orlitzky gentoo-dev 2020-02-20 12:28:31 UTC
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.
Comment 8 Larry the Git Cow gentoo-dev 2020-02-29 22:16:18 UTC
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(-)
Comment 9 Larry the Git Cow gentoo-dev 2020-03-01 13:59:45 UTC
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(-)
Comment 10 Larry the Git Cow gentoo-dev 2020-03-02 02:51:51 UTC
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(-)