void-packages icon indicating copy to clipboard operation
void-packages copied to clipboard

php/php8.0/php8.1 and composer/composer8.0/composer8.1: add alternatives groups.

Open TinfoilSubmarine opened this issue 3 years ago • 3 comments

Testing the changes

  • I tested the changes in this PR: briefly

TinfoilSubmarine avatar Aug 08 '22 16:08 TinfoilSubmarine

I think this is a bit too fragile and we should wait with this for php 7.4 EOL which should be in November. Which /usr/bin/php gets chosen when the user has php (7) and php8.0 installed? Are we sure it always works as expected and won't break the setup for some users who rely on /usr/bin/php being php7, etc?

paper42 avatar Aug 08 '22 23:08 paper42

It does not work correctly:

before:

composer --version
Composer version 2.2.4 2022-01-08 12:30:42

after:

composer --version
PHP 7.4.30 (cli) (built: Aug  9 2022 17:56:39) ( NTS )
Copyright (c) The PHP Group

composer -h       
Usage: php [options] [-f] <file> [--] [args...]

Chocimier avatar Aug 09 '22 18:08 Chocimier

It does not work correctly:

before:

composer --version
Composer version 2.2.4 2022-01-08 12:30:42

after:

composer --version
PHP 7.4.30 (cli) (built: Aug  9 2022 17:56:39) ( NTS )
Copyright (c) The PHP Group

composer -h       
Usage: php [options] [-f] <file> [--] [args...]

Should be fixed, I dropped the -f from /usr/bin/composer${_php_version}

TinfoilSubmarine avatar Aug 09 '22 18:08 TinfoilSubmarine

So, the one thing that I'm unsure of is for composer. Currently, there is a package for each PHP version with a shim script to invoke composer with the right interpreter: https://github.com/void-linux/void-packages/blob/b1800a91d5d6054e6981eccdfdde0979d059448b/srcpkgs/composer8.0/files/composer8.0#L2 https://github.com/void-linux/void-packages/blob/b1800a91d5d6054e6981eccdfdde0979d059448b/srcpkgs/composer8.1/files/composer8.1#L2

This could also be handled by having a single composer package with the shim script, but call php which is handled by alternatives. But I think that may be confusing since it isn't as explicit.

TinfoilSubmarine avatar Aug 29 '22 12:08 TinfoilSubmarine

So, the one thing that I'm unsure of is for composer. Currently, there is a package for each PHP version with a shim script to invoke composer with the right interpreter:

https://github.com/void-linux/void-packages/blob/b1800a91d5d6054e6981eccdfdde0979d059448b/srcpkgs/composer8.0/files/composer8.0#L2

https://github.com/void-linux/void-packages/blob/b1800a91d5d6054e6981eccdfdde0979d059448b/srcpkgs/composer8.1/files/composer8.1#L2

This could also be handled by having a single composer package with the shim script, but call php which is handled by alternatives. But I think that may be confusing since it isn't as explicit.

After thinking about this, I think that it's best to keep the separate composer packages, since collapsing into one and relying on xbps-alternatives to choose a php version restricts the utility of having alternatives in the first place. If I want to have both a PHP 8.0 and 8.1 installation on a single machine, I would still like to be able to use composer with both 8.0 and 8.1.

TinfoilSubmarine avatar Aug 30 '22 18:08 TinfoilSubmarine

I think it would be nice to make every package depend on a specific version that's the last supported one.

paper42 avatar Nov 27 '22 10:11 paper42

Anything else needed for this? 7.4 is officially EOL now

TinfoilSubmarine avatar Dec 01 '22 13:12 TinfoilSubmarine

@TinfoilSubmarine thank you very much my man. Very appreciative of this much-needed change! Also very educational to read the PR as well.

jchook avatar Apr 08 '23 03:04 jchook