Skip to content

build: always use /usr/local/bin/composer, fixes #6771#6772

Merged
rfay merged 3 commits into
ddev:masterfrom
stasadev:20241125_stasadev_composer
Nov 27, 2024
Merged

build: always use /usr/local/bin/composer, fixes #6771#6772
rfay merged 3 commits into
ddev:masterfrom
stasadev:20241125_stasadev_composer

Conversation

@stasadev

@stasadev stasadev commented Nov 25, 2024

Copy link
Copy Markdown
Member

The Issue

vendor/bin/composer doesn't seem to be what we want, it's confusing and people can't override it with ddev config --composer-version=<version>

How This PR Solves The Issue

Reverts behavior to use /usr/local/bin/composer.
Removes vendor/bin/composer from $PATH inside the container with EXECIGNORE https://www.gnu.org/software/bash/manual/html_node/Bash-Variables.html

This way it will use /usr/local/bin/composer instead of /var/www/html/vendor/bin/composer with ddev ssh.

(Prior to this PR, ddev ssh && composer -V had always preferred vendor/bin/composer no matter what.)
vendor/bin/composer can still be called directly.

Manual Testing Instructions

https://ddev--6772.org.readthedocs.build/en/6772/users/configuration/config/#composer_version

ddev composer require composer/composer:v2.8.0

ddev composer -V
Composer version 2.8.3 2024-11-17 13:13:04

ddev exec composer -V
Composer version 2.8.3 2024-11-17 13:13:04

ddev exec vendor/bin/composer -V       
Composer version 2.8.0 2024-10-02 16:40:29

ddev ssh

composer -V
Composer version 2.8.3 2024-11-17 13:13:04

vendor/bin/composer -V
Composer version 2.8.0 2024-10-02 16:40:29

The only downside is that EXECIGNORE has no effect on which, so it will still show /var/www/html/vendor/bin/composer, but will actually use /usr/local/bin/composer, so we will have consistency between inside and outside:

ddev ssh

which composer
/var/www/html/vendor/bin/composer

which -a composer
/var/www/html/vendor/bin/composer
/usr/local/bin/composer

composer -V
Composer version 2.8.3 2024-11-17 13:13:04

/var/www/html/vendor/bin/composer -V
Composer version 2.8.0 2024-10-02 16:40:29

/usr/local/bin/composer -V
Composer version 2.8.3 2024-11-17 13:13:04

Automated Testing Overview

Release/Deployment Notes

@stasadev stasadev requested review from a team as code owners November 25, 2024 14:20
@github-actions github-actions Bot added dependencies Pull requests that update a dependency file maintenance labels Nov 25, 2024
@github-actions

github-actions Bot commented Nov 25, 2024

Copy link
Copy Markdown

@rfay

rfay commented Nov 25, 2024

Copy link
Copy Markdown
Member

Let's add to doc here what people need to do if they do want to use the composer-installed composer.

@rfay rfay left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems correct. There's still going to be a little confusion, but I think it's ok.

The weird thing I encountered is this:
ddev exec which composer gets vendor/bin
ddev exec composer --version gets /usr/local/bin

Not sure how that can happen. I guess because which is a bash built-in.

ddev composer is always getting the right version.

Docs look good.

Comment thread pkg/ddevapp/composer.go
Tty: isatty.IsTerminal(os.Stdin.Fd()),
Env: env,
// Prevent Composer from debugging when Xdebug is enabled
Env: []string{"XDEBUG_MODE=off"},

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this related to the revert here? Or just a good idea? I thought it was in here before.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reverted the Env to its original state.

@rfay rfay merged commit 4bb1db4 into ddev:master Nov 27, 2024
@rfay rfay deleted the 20241125_stasadev_composer branch November 27, 2024 19:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file maintenance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants